From dd51eb1ac3bcff2f3b7244df9066e2c79d41e7b0 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 7 Aug 2026 19:55:34 +0000 Subject: [PATCH 1/2] feat: add support for custom content types docs: clarify wording around quota usage Clients can now specify the content type of chat messages explicitly, instead of relying on autodetection. PiperOrigin-RevId: 961002476 Source-Link: https://github.com/googleapis/googleapis/commit/2d0def9c8f9a195fda2b9f524e5eedcfa1b670b6 Source-Link: https://github.com/googleapis/googleapis-gen/commit/eab3c6a3d29524b73c6f7e6c3c7754d9fcd9b6e5 Copy-Tag: eyJwIjoiZ29vZ2xlLWNsb3VkLXJldGFpbC12Mi8uT3dsQm90LnlhbWwiLCJoIjoiZWFiM2M2YTNkMjk1MjRiNzNjNmY3ZTZjM2M3NzU0ZDlmY2Q5YjZlNSJ9 --- .../google-cloud-retail-v2/.gitignore | 20 + .../.repo-metadata.json | 18 + .../google-cloud-retail-v2/.rubocop.yml | 33 + .../google-cloud-retail-v2/.toys.rb | 28 + .../google-cloud-retail-v2/.yardopts | 12 + .../google-cloud-retail-v2/AUTHENTICATION.md | 122 + .../google-cloud-retail-v2/CHANGELOG.md | 2 + .../google-cloud-retail-v2/Gemfile | 15 + .../google-cloud-retail-v2/LICENSE.md | 201 ++ .../google-cloud-retail-v2/README.md | 154 ++ .../google-cloud-retail-v2/Rakefile | 169 ++ .../gapic_metadata.json | 412 +++ .../google-cloud-retail-v2.gemspec | 29 + .../lib/google-cloud-retail-v2.rb | 21 + .../lib/google/cloud/retail/v2.rb | 56 + .../cloud/retail/v2/analytics_service.rb | 56 + .../retail/v2/analytics_service/client.rb | 543 ++++ .../v2/analytics_service/credentials.rb | 51 + .../retail/v2/analytics_service/operations.rb | 843 ++++++ .../cloud/retail/v2/analytics_service/rest.rb | 53 + .../v2/analytics_service/rest/client.rb | 493 ++++ .../v2/analytics_service/rest/operations.rb | 962 +++++++ .../v2/analytics_service/rest/service_stub.rb | 143 + .../cloud/retail/v2/analytics_service_pb.rb | 27 + .../v2/analytics_service_services_pb.rb | 49 + .../lib/google/cloud/retail/v2/catalog_pb.rb | 42 + .../google/cloud/retail/v2/catalog_service.rb | 55 + .../cloud/retail/v2/catalog_service/client.rb | 1590 +++++++++++ .../retail/v2/catalog_service/credentials.rb | 51 + .../cloud/retail/v2/catalog_service/paths.rb | 128 + .../cloud/retail/v2/catalog_service/rest.rb | 52 + .../retail/v2/catalog_service/rest/client.rb | 1470 ++++++++++ .../v2/catalog_service/rest/service_stub.rb | 759 ++++++ .../cloud/retail/v2/catalog_service_pb.rb | 42 + .../retail/v2/catalog_service_services_pb.rb | 125 + .../lib/google/cloud/retail/v2/common_pb.rb | 58 + .../cloud/retail/v2/completion_service.rb | 59 + .../retail/v2/completion_service/client.rb | 716 +++++ .../v2/completion_service/credentials.rb | 51 + .../v2/completion_service/operations.rb | 843 ++++++ .../retail/v2/completion_service/paths.rb | 52 + .../retail/v2/completion_service/rest.rb | 56 + .../v2/completion_service/rest/client.rb | 659 +++++ .../v2/completion_service/rest/operations.rb | 962 +++++++ .../completion_service/rest/service_stub.rb | 204 ++ .../cloud/retail/v2/completion_service_pb.rb | 33 + .../v2/completion_service_services_pb.rb | 61 + .../lib/google/cloud/retail/v2/control_pb.rb | 25 + .../google/cloud/retail/v2/control_service.rb | 55 + .../cloud/retail/v2/control_service/client.rb | 911 +++++++ .../retail/v2/control_service/credentials.rb | 51 + .../cloud/retail/v2/control_service/paths.rb | 73 + .../cloud/retail/v2/control_service/rest.rb | 52 + .../retail/v2/control_service/rest/client.rb | 833 ++++++ .../v2/control_service/rest/service_stub.rb | 388 +++ .../cloud/retail/v2/control_service_pb.rb | 34 + .../retail/v2/control_service_services_pb.rb | 65 + .../v2/conversational_search_service.rb | 59 + .../conversational_search_service/client.rb | 576 ++++ .../credentials.rb | 51 + .../v2/conversational_search_service/paths.rb | 54 + .../v2/conversational_search_service/rest.rb | 56 + .../rest/client.rb | 528 ++++ .../rest/service_stub.rb | 145 + .../v2/conversational_search_service_pb.rb | 41 + ...nversational_search_service_services_pb.rb | 52 + .../cloud/retail/v2/export_config_pb.rb | 35 + .../cloud/retail/v2/generative_question_pb.rb | 24 + .../retail/v2/generative_question_service.rb | 55 + .../v2/generative_question_service/client.rb | 879 ++++++ .../credentials.rb | 51 + .../v2/generative_question_service/paths.rb | 52 + .../v2/generative_question_service/rest.rb | 52 + .../rest/client.rb | 801 ++++++ .../rest/service_stub.rb | 389 +++ .../v2/generative_question_service_pb.rb | 34 + ...generative_question_service_services_pb.rb | 55 + .../cloud/retail/v2/import_config_pb.rb | 46 + .../lib/google/cloud/retail/v2/model_pb.rb | 34 + .../google/cloud/retail/v2/model_service.rb | 67 + .../cloud/retail/v2/model_service/client.rb | 1221 +++++++++ .../retail/v2/model_service/credentials.rb | 51 + .../retail/v2/model_service/operations.rb | 843 ++++++ .../cloud/retail/v2/model_service/paths.rb | 73 + .../cloud/retail/v2/model_service/rest.rb | 64 + .../retail/v2/model_service/rest/client.rb | 1122 ++++++++ .../v2/model_service/rest/operations.rb | 962 +++++++ .../v2/model_service/rest/service_stub.rb | 574 ++++ .../cloud/retail/v2/model_service_pb.rb | 41 + .../retail/v2/model_service_services_pb.rb | 73 + .../cloud/retail/v2/prediction_service.rb | 55 + .../retail/v2/prediction_service/client.rb | 623 +++++ .../v2/prediction_service/credentials.rb | 51 + .../retail/v2/prediction_service/paths.rb | 56 + .../retail/v2/prediction_service/rest.rb | 52 + .../v2/prediction_service/rest/client.rb | 573 ++++ .../prediction_service/rest/service_stub.rb | 151 ++ .../cloud/retail/v2/prediction_service_pb.rb | 30 + .../v2/prediction_service_services_pb.rb | 45 + .../lib/google/cloud/retail/v2/product_pb.rb | 32 + .../google/cloud/retail/v2/product_service.rb | 57 + .../cloud/retail/v2/product_service/client.rb | 2239 ++++++++++++++++ .../retail/v2/product_service/credentials.rb | 51 + .../retail/v2/product_service/operations.rb | 843 ++++++ .../cloud/retail/v2/product_service/paths.rb | 77 + .../cloud/retail/v2/product_service/rest.rb | 54 + .../retail/v2/product_service/rest/client.rb | 2112 +++++++++++++++ .../v2/product_service/rest/operations.rb | 962 +++++++ .../v2/product_service/rest/service_stub.rb | 822 ++++++ .../cloud/retail/v2/product_service_pb.rb | 54 + .../retail/v2/product_service_services_pb.rb | 248 ++ .../google/cloud/retail/v2/promotion_pb.rb | 21 + .../google/cloud/retail/v2/purge_config_pb.rb | 30 + .../lib/google/cloud/retail/v2/rest.rb | 48 + .../lib/google/cloud/retail/v2/safety_pb.rb | 26 + .../google/cloud/retail/v2/search_service.rb | 58 + .../cloud/retail/v2/search_service/client.rb | 789 ++++++ .../retail/v2/search_service/credentials.rb | 51 + .../cloud/retail/v2/search_service/paths.rb | 54 + .../cloud/retail/v2/search_service/rest.rb | 55 + .../retail/v2/search_service/rest/client.rb | 739 +++++ .../v2/search_service/rest/service_stub.rb | 151 ++ .../cloud/retail/v2/search_service_pb.rb | 61 + .../retail/v2/search_service_services_pb.rb | 51 + .../cloud/retail/v2/serving_config_pb.rb | 27 + .../cloud/retail/v2/serving_config_service.rb | 55 + .../v2/serving_config_service/client.rb | 1102 ++++++++ .../v2/serving_config_service/credentials.rb | 51 + .../retail/v2/serving_config_service/paths.rb | 73 + .../retail/v2/serving_config_service/rest.rb | 52 + .../v2/serving_config_service/rest/client.rb | 1010 +++++++ .../rest/service_stub.rb | 512 ++++ .../retail/v2/serving_config_service_pb.rb | 36 + .../v2/serving_config_service_services_pb.rb | 74 + .../google/cloud/retail/v2/user_event_pb.rb | 30 + .../cloud/retail/v2/user_event_service.rb | 56 + .../retail/v2/user_event_service/client.rb | 1008 +++++++ .../v2/user_event_service/credentials.rb | 51 + .../v2/user_event_service/operations.rb | 843 ++++++ .../retail/v2/user_event_service/paths.rb | 75 + .../retail/v2/user_event_service/rest.rb | 53 + .../v2/user_event_service/rest/client.rb | 930 +++++++ .../v2/user_event_service/rest/operations.rb | 962 +++++++ .../user_event_service/rest/service_stub.rb | 398 +++ .../cloud/retail/v2/user_event_service_pb.rb | 36 + .../v2/user_event_service_services_pb.rb | 75 + .../lib/google/cloud/retail/v2/version.rb | 28 + .../proto_docs/README.md | 4 + .../proto_docs/google/api/client.rb | 593 ++++ .../proto_docs/google/api/field_behavior.rb | 85 + .../proto_docs/google/api/httpbody.rb | 80 + .../proto_docs/google/api/launch_stage.rb | 71 + .../proto_docs/google/api/resource.rb | 227 ++ .../google/cloud/retail/v2/catalog.rb | 516 ++++ .../google/cloud/retail/v2/catalog_service.rb | 297 +++ .../google/cloud/retail/v2/common.rb | 1085 ++++++++ .../cloud/retail/v2/completion_service.rb | 230 ++ .../google/cloud/retail/v2/control.rb | 75 + .../google/cloud/retail/v2/control_service.rb | 122 + .../v2/conversational_search_service.rb | 358 +++ .../google/cloud/retail/v2/export_config.rb | 184 ++ .../cloud/retail/v2/generative_question.rb | 75 + .../retail/v2/generative_question_service.rb | 109 + .../google/cloud/retail/v2/import_config.rb | 404 +++ .../google/cloud/retail/v2/model.rb | 267 ++ .../google/cloud/retail/v2/model_service.rb | 172 ++ .../cloud/retail/v2/prediction_service.rb | 237 ++ .../google/cloud/retail/v2/product.rb | 588 ++++ .../google/cloud/retail/v2/product_service.rb | 653 +++++ .../google/cloud/retail/v2/promotion.rb | 43 + .../google/cloud/retail/v2/purge_config.rb | 178 ++ .../google/cloud/retail/v2/safety.rb | 96 + .../google/cloud/retail/v2/search_service.rb | 1301 +++++++++ .../google/cloud/retail/v2/serving_config.rb | 259 ++ .../cloud/retail/v2/serving_config_service.rb | 143 + .../google/cloud/retail/v2/user_event.rb | 364 +++ .../cloud/retail/v2/user_event_service.rb | 130 + .../google/longrunning/operations.rb | 191 ++ .../proto_docs/google/protobuf/any.rb | 145 + .../proto_docs/google/protobuf/duration.rb | 98 + .../proto_docs/google/protobuf/empty.rb | 34 + .../proto_docs/google/protobuf/field_mask.rb | 229 ++ .../proto_docs/google/protobuf/struct.rb | 108 + .../proto_docs/google/protobuf/timestamp.rb | 128 + .../proto_docs/google/protobuf/wrappers.rb | 148 + .../proto_docs/google/rpc/status.rb | 48 + .../proto_docs/google/type/date.rb | 56 + .../google-cloud-retail-v2/snippets/Gemfile | 32 + .../export_analytics_metrics.rb | 54 + .../catalog_service/add_catalog_attribute.rb | 47 + .../catalog_service/get_attributes_config.rb | 47 + .../catalog_service/get_completion_config.rb | 47 + .../catalog_service/get_default_branch.rb | 47 + .../snippets/catalog_service/list_catalogs.rb | 51 + .../remove_catalog_attribute.rb | 47 + .../replace_catalog_attribute.rb | 47 + .../catalog_service/set_default_branch.rb | 47 + .../update_attributes_config.rb | 47 + .../catalog_service/update_catalog.rb | 47 + .../update_completion_config.rb | 47 + .../completion_service/complete_query.rb | 47 + .../import_completion_data.rb | 54 + .../control_service/create_control.rb | 47 + .../control_service/delete_control.rb | 47 + .../snippets/control_service/get_control.rb | 47 + .../snippets/control_service/list_controls.rb | 51 + .../control_service/update_control.rb | 47 + .../conversational_search.rb | 50 + ...atch_update_generative_question_configs.rb | 47 + ...get_generative_questions_feature_config.rb | 47 + .../list_generative_question_configs.rb | 47 + .../update_generative_question_config.rb | 47 + ...ate_generative_questions_feature_config.rb | 47 + .../snippets/model_service/create_model.rb | 54 + .../snippets/model_service/delete_model.rb | 47 + .../snippets/model_service/get_model.rb | 47 + .../snippets/model_service/list_models.rb | 51 + .../snippets/model_service/pause_model.rb | 47 + .../snippets/model_service/resume_model.rb | 47 + .../snippets/model_service/tune_model.rb | 54 + .../snippets/model_service/update_model.rb | 47 + .../snippets/prediction_service/predict.rb | 47 + .../product_service/add_fulfillment_places.rb | 54 + .../product_service/add_local_inventories.rb | 54 + .../product_service/create_product.rb | 47 + .../product_service/delete_product.rb | 47 + .../snippets/product_service/get_product.rb | 47 + .../product_service/import_products.rb | 54 + .../snippets/product_service/list_products.rb | 51 + .../product_service/purge_products.rb | 54 + .../remove_fulfillment_places.rb | 54 + .../remove_local_inventories.rb | 54 + .../snippets/product_service/set_inventory.rb | 54 + .../product_service/update_product.rb | 47 + .../snippets/search_service/search.rb | 51 + .../serving_config_service/add_control.rb | 47 + .../create_serving_config.rb | 47 + .../delete_serving_config.rb | 47 + .../get_serving_config.rb | 47 + .../list_serving_configs.rb | 51 + .../serving_config_service/remove_control.rb | 47 + .../update_serving_config.rb | 47 + ...ippet_metadata_google.cloud.retail.v2.json | 2375 +++++++++++++++++ .../user_event_service/collect_user_event.rb | 47 + .../user_event_service/import_user_events.rb | 54 + .../user_event_service/purge_user_events.rb | 54 + .../user_event_service/rejoin_user_events.rb | 54 + .../user_event_service/write_user_event.rb | 47 + .../v2/analytics_service_operations_test.rb | 400 +++ .../retail/v2/analytics_service_rest_test.rb | 155 ++ .../cloud/retail/v2/analytics_service_test.rb | 185 ++ .../retail/v2/catalog_service_paths_test.rb | 103 + .../retail/v2/catalog_service_rest_test.rb | 705 +++++ .../cloud/retail/v2/catalog_service_test.rb | 771 ++++++ .../v2/completion_service_operations_test.rb | 400 +++ .../v2/completion_service_paths_test.rb | 55 + .../retail/v2/completion_service_rest_test.rb | 217 ++ .../retail/v2/completion_service_test.rb | 259 ++ .../retail/v2/control_service_paths_test.rb | 67 + .../retail/v2/control_service_rest_test.rb | 375 +++ .../cloud/retail/v2/control_service_test.rb | 411 +++ ...onversational_search_service_paths_test.rb | 55 + ...conversational_search_service_rest_test.rb | 163 ++ .../v2/conversational_search_service_test.rb | 197 ++ .../generative_question_service_paths_test.rb | 55 + .../generative_question_service_rest_test.rb | 372 +++ .../v2/generative_question_service_test.rb | 400 +++ .../v2/model_service_operations_test.rb | 400 +++ .../retail/v2/model_service_paths_test.rb | 67 + .../retail/v2/model_service_rest_test.rb | 536 ++++ .../cloud/retail/v2/model_service_test.rb | 607 +++++ .../v2/prediction_service_paths_test.rb | 55 + .../retail/v2/prediction_service_rest_test.rb | 160 ++ .../retail/v2/prediction_service_test.rb | 176 ++ .../v2/product_service_operations_test.rb | 400 +++ .../retail/v2/product_service_paths_test.rb | 67 + .../retail/v2/product_service_rest_test.rb | 781 ++++++ .../cloud/retail/v2/product_service_test.rb | 922 +++++++ .../retail/v2/search_service_paths_test.rb | 55 + .../retail/v2/search_service_rest_test.rb | 180 ++ .../cloud/retail/v2/search_service_test.rb | 222 ++ .../v2/serving_config_service_paths_test.rb | 67 + .../v2/serving_config_service_rest_test.rb | 484 ++++ .../retail/v2/serving_config_service_test.rb | 529 ++++ .../v2/user_event_service_operations_test.rb | 400 +++ .../v2/user_event_service_paths_test.rb | 67 + .../retail/v2/user_event_service_rest_test.rb | 381 +++ .../retail/v2/user_event_service_test.rb | 448 ++++ .../google-cloud-retail-v2/test/helper.rb | 35 + 289 files changed, 70905 insertions(+) create mode 100644 owl-bot-staging/google-cloud-retail-v2/.gitignore create mode 100644 owl-bot-staging/google-cloud-retail-v2/.repo-metadata.json create mode 100644 owl-bot-staging/google-cloud-retail-v2/.rubocop.yml create mode 100644 owl-bot-staging/google-cloud-retail-v2/.toys.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/.yardopts create mode 100644 owl-bot-staging/google-cloud-retail-v2/AUTHENTICATION.md create mode 100644 owl-bot-staging/google-cloud-retail-v2/CHANGELOG.md create mode 100644 owl-bot-staging/google-cloud-retail-v2/Gemfile create mode 100644 owl-bot-staging/google-cloud-retail-v2/LICENSE.md create mode 100644 owl-bot-staging/google-cloud-retail-v2/README.md create mode 100644 owl-bot-staging/google-cloud-retail-v2/Rakefile create mode 100644 owl-bot-staging/google-cloud-retail-v2/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-retail-v2/google-cloud-retail-v2.gemspec create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google-cloud-retail-v2.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/client.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/credentials.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/operations.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/rest.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/rest/client.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/rest/operations.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/rest/service_stub.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service_pb.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service_services_pb.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_pb.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/client.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/credentials.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/paths.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/rest.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/rest/client.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/rest/service_stub.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service_pb.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service_services_pb.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/common_pb.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/client.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/credentials.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/operations.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/paths.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/rest.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/rest/client.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/rest/operations.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/rest/service_stub.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service_pb.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service_services_pb.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_pb.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/client.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/credentials.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/paths.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/rest.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/rest/client.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/rest/service_stub.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service_pb.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service_services_pb.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/client.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/credentials.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/paths.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/rest.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/rest/client.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/rest/service_stub.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service_pb.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service_services_pb.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/export_config_pb.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_pb.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/client.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/credentials.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/paths.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/rest.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/rest/client.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/rest/service_stub.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service_pb.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service_services_pb.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/import_config_pb.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_pb.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/client.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/credentials.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/operations.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/paths.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/rest.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/rest/client.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/rest/operations.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/rest/service_stub.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service_pb.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service_services_pb.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/client.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/credentials.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/paths.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/rest.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/rest/client.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/rest/service_stub.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service_pb.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service_services_pb.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_pb.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/client.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/credentials.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/operations.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/paths.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/rest.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/rest/client.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/rest/operations.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/rest/service_stub.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service_pb.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service_services_pb.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/promotion_pb.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/purge_config_pb.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/rest.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/safety_pb.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/client.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/credentials.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/paths.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/rest.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/rest/client.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/rest/service_stub.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service_pb.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service_services_pb.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_pb.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/client.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/credentials.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/paths.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/rest.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/rest/client.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/rest/service_stub.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service_pb.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service_services_pb.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_pb.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/client.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/credentials.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/operations.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/paths.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/rest.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/rest/client.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/rest/operations.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/rest/service_stub.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service_pb.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service_services_pb.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/version.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/README.md create mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/api/client.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/api/field_behavior.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/api/httpbody.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/api/launch_stage.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/api/resource.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/catalog.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/catalog_service.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/common.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/completion_service.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/control.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/control_service.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/conversational_search_service.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/export_config.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/generative_question.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/generative_question_service.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/import_config.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/model.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/model_service.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/prediction_service.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/product.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/product_service.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/promotion.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/purge_config.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/safety.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/search_service.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/serving_config.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/serving_config_service.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/user_event.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/user_event_service.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/longrunning/operations.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/any.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/duration.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/empty.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/field_mask.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/struct.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/timestamp.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/wrappers.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/rpc/status.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/type/date.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/Gemfile create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/analytics_service/export_analytics_metrics.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/add_catalog_attribute.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/get_attributes_config.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/get_completion_config.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/get_default_branch.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/list_catalogs.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/remove_catalog_attribute.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/replace_catalog_attribute.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/set_default_branch.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/update_attributes_config.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/update_catalog.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/update_completion_config.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/completion_service/complete_query.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/completion_service/import_completion_data.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/control_service/create_control.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/control_service/delete_control.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/control_service/get_control.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/control_service/list_controls.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/control_service/update_control.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/conversational_search_service/conversational_search.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/generative_question_service/batch_update_generative_question_configs.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/generative_question_service/get_generative_questions_feature_config.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/generative_question_service/list_generative_question_configs.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/generative_question_service/update_generative_question_config.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/generative_question_service/update_generative_questions_feature_config.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/model_service/create_model.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/model_service/delete_model.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/model_service/get_model.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/model_service/list_models.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/model_service/pause_model.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/model_service/resume_model.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/model_service/tune_model.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/model_service/update_model.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/prediction_service/predict.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/product_service/add_fulfillment_places.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/product_service/add_local_inventories.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/product_service/create_product.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/product_service/delete_product.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/product_service/get_product.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/product_service/import_products.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/product_service/list_products.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/product_service/purge_products.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/product_service/remove_fulfillment_places.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/product_service/remove_local_inventories.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/product_service/set_inventory.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/product_service/update_product.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/search_service/search.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/add_control.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/create_serving_config.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/delete_serving_config.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/get_serving_config.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/list_serving_configs.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/remove_control.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/update_serving_config.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/snippet_metadata_google.cloud.retail.v2.json create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/user_event_service/collect_user_event.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/user_event_service/import_user_events.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/user_event_service/purge_user_events.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/user_event_service/rejoin_user_events.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/user_event_service/write_user_event.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/analytics_service_operations_test.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/analytics_service_rest_test.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/analytics_service_test.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/catalog_service_paths_test.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/catalog_service_rest_test.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/catalog_service_test.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/completion_service_operations_test.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/completion_service_paths_test.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/completion_service_rest_test.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/completion_service_test.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/control_service_paths_test.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/control_service_rest_test.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/control_service_test.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/conversational_search_service_paths_test.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/conversational_search_service_rest_test.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/conversational_search_service_test.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/generative_question_service_paths_test.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/generative_question_service_rest_test.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/generative_question_service_test.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/model_service_operations_test.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/model_service_paths_test.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/model_service_rest_test.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/model_service_test.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/prediction_service_paths_test.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/prediction_service_rest_test.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/prediction_service_test.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/product_service_operations_test.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/product_service_paths_test.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/product_service_rest_test.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/product_service_test.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/search_service_paths_test.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/search_service_rest_test.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/search_service_test.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/serving_config_service_paths_test.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/serving_config_service_rest_test.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/serving_config_service_test.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/user_event_service_operations_test.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/user_event_service_paths_test.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/user_event_service_rest_test.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/user_event_service_test.rb create mode 100644 owl-bot-staging/google-cloud-retail-v2/test/helper.rb diff --git a/owl-bot-staging/google-cloud-retail-v2/.gitignore b/owl-bot-staging/google-cloud-retail-v2/.gitignore new file mode 100644 index 000000000000..a2e97ac84259 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/.gitignore @@ -0,0 +1,20 @@ +gems.locked + +# Ignore documentation output +doc/* +.yardoc/* + +# Ignore test output +coverage/* + +# Ignore build artifacts +pkg/* + +# Ignore files commonly present in certain dev environments +.vagrant +.DS_STORE +.idea +*.iml + +# Ignore synth output +__pycache__ diff --git a/owl-bot-staging/google-cloud-retail-v2/.repo-metadata.json b/owl-bot-staging/google-cloud-retail-v2/.repo-metadata.json new file mode 100644 index 000000000000..034a00868333 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/.repo-metadata.json @@ -0,0 +1,18 @@ +{ + "api_id": "retail.googleapis.com", + "api_shortname": "retail", + "client_documentation": "https://cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest", + "distribution_name": "google-cloud-retail-v2", + "is_cloud": true, + "language": "ruby", + "name": "retail", + "name_pretty": "Retail V2 API", + "product_documentation": "https://cloud.google.com/retail/docs/apis", + "release_level": "unreleased", + "repo": "googleapis/google-cloud-ruby", + "requires_billing": true, + "ruby-cloud-description": "Retail enables you to build an end-to-end personalized recommendation system based on state-of-the-art deep learning ML models, without a need for expertise in ML or recommendation systems. Note that google-cloud-retail-v2 is a version-specific client library. For most uses, we recommend installing the main client library google-cloud-retail instead. See the readme for more details.", + "ruby-cloud-env-prefix": "RETAIL", + "ruby-cloud-product-url": "https://cloud.google.com/retail/docs/apis", + "library_type": "GAPIC_AUTO" +} diff --git a/owl-bot-staging/google-cloud-retail-v2/.rubocop.yml b/owl-bot-staging/google-cloud-retail-v2/.rubocop.yml new file mode 100644 index 000000000000..def961aa4ee5 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/.rubocop.yml @@ -0,0 +1,33 @@ +inherit_gem: + google-style: google-style.yml + +AllCops: + Exclude: + - "google-cloud-retail-v2.gemspec" + - "lib/**/*_pb.rb" + - "proto_docs/**/*" + - "test/**/*" + - "acceptance/**/*" + - "samples/acceptance/**/*" + - "Rakefile" + +Layout/LineLength: + Enabled: false +Metrics/AbcSize: + Enabled: false +Metrics/ClassLength: + Enabled: false +Metrics/CyclomaticComplexity: + Enabled: false +Metrics/MethodLength: + Enabled: false +Metrics/ModuleLength: + Enabled: false +Metrics/PerceivedComplexity: + Enabled: false +Naming/AccessorMethodName: + Exclude: + - "snippets/**/*.rb" +Naming/FileName: + Exclude: + - "lib/google-cloud-retail-v2.rb" diff --git a/owl-bot-staging/google-cloud-retail-v2/.toys.rb b/owl-bot-staging/google-cloud-retail-v2/.toys.rb new file mode 100644 index 000000000000..177e22456e8a --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/.toys.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +toys_version! ">= 0.15.3" + +if ENV["RUBY_COMMON_TOOLS"] + common_tools_dir = File.expand_path ENV["RUBY_COMMON_TOOLS"] + load File.join(common_tools_dir, "toys", "gapic") +else + load_git remote: "https://github.com/googleapis/ruby-common-tools.git", + path: "toys/gapic", + update: true +end diff --git a/owl-bot-staging/google-cloud-retail-v2/.yardopts b/owl-bot-staging/google-cloud-retail-v2/.yardopts new file mode 100644 index 000000000000..038190b897cc --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/.yardopts @@ -0,0 +1,12 @@ +--no-private +--title="Retail V2 API" +--exclude _pb\.rb$ +--markup markdown +--markup-provider redcarpet + +./lib/**/*.rb +./proto_docs/**/*.rb +- +README.md +LICENSE.md +AUTHENTICATION.md diff --git a/owl-bot-staging/google-cloud-retail-v2/AUTHENTICATION.md b/owl-bot-staging/google-cloud-retail-v2/AUTHENTICATION.md new file mode 100644 index 000000000000..8862a3fae853 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/AUTHENTICATION.md @@ -0,0 +1,122 @@ +# Authentication + +The recommended way to authenticate to the google-cloud-retail-v2 library is to use +[Application Default Credentials (ADC)](https://cloud.google.com/docs/authentication/application-default-credentials). +To review all of your authentication options, see [Credentials lookup](#credential-lookup). + +## Quickstart + +The following example shows how to set up authentication for a local development +environment with your user credentials. + +**NOTE:** This method is _not_ recommended for running in production. User credentials +should be used only during development. + +1. [Download and install the Google Cloud CLI](https://cloud.google.com/sdk). +2. Set up a local ADC file with your user credentials: + +```sh +gcloud auth application-default login +``` + +3. Write code as if already authenticated. + +For more information about setting up authentication for a local development environment, see +[Set up Application Default Credentials](https://cloud.google.com/docs/authentication/provide-credentials-adc#local-dev). + +## Credential Lookup + +The google-cloud-retail-v2 library provides several mechanisms to configure your system. +Generally, using Application Default Credentials to facilitate automatic +credentials discovery is the easist method. But if you need to explicitly specify +credentials, there are several methods available to you. + +Credentials are accepted in the following ways, in the following order or precedence: + +1. Credentials specified in method arguments +2. Credentials specified in configuration +3. Credentials pointed to or included in environment variables +4. Credentials found in local ADC file +5. Credentials returned by the metadata server for the attached service account (GCP) + +### Configuration + +You can configure a path to a JSON credentials file, either for an individual client object or +globally, for all client objects. The JSON file can contain credentials created for +[workload identity federation](https://cloud.google.com/iam/docs/workload-identity-federation), +[workforce identity federation](https://cloud.google.com/iam/docs/workforce-identity-federation), or a +[service account key](https://cloud.google.com/docs/authentication/provide-credentials-adc#local-key). + +Note: Service account keys are a security risk if not managed correctly. You should +[choose a more secure alternative to service account keys](https://cloud.google.com/docs/authentication#auth-decision-tree) +whenever possible. + +To configure a credentials file for an individual client initialization: + +```ruby +require "google/cloud/retail/v2" + +client = ::Google::Cloud::Retail::V2::AnalyticsService::Client.new do |config| + config.credentials = "path/to/credentialfile.json" +end +``` + +To configure a credentials file globally for all clients: + +```ruby +require "google/cloud/retail/v2" + +::Google::Cloud::Retail::V2::AnalyticsService::Client.configure do |config| + config.credentials = "path/to/credentialfile.json" +end + +client = ::Google::Cloud::Retail::V2::AnalyticsService::Client.new +``` + +### Environment Variables + +You can also use an environment variable to provide a JSON credentials file. +The environment variable can contain a path to the credentials file or, for +environments such as Docker containers where writing files is not encouraged, +you can include the credentials file itself. + +The JSON file can contain credentials created for +[workload identity federation](https://cloud.google.com/iam/docs/workload-identity-federation), +[workforce identity federation](https://cloud.google.com/iam/docs/workforce-identity-federation), or a +[service account key](https://cloud.google.com/docs/authentication/provide-credentials-adc#local-key). + +Note: Service account keys are a security risk if not managed correctly. You should +[choose a more secure alternative to service account keys](https://cloud.google.com/docs/authentication#auth-decision-tree) +whenever possible. + +The environment variables that google-cloud-retail-v2 +checks for credentials are: + +* `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents +* `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file + +```ruby +require "google/cloud/retail/v2" + +ENV["GOOGLE_APPLICATION_CREDENTIALS"] = "path/to/credentialfile.json" + +client = ::Google::Cloud::Retail::V2::AnalyticsService::Client.new +``` + +### Local ADC file + +You can set up a local ADC file with your user credentials for authentication during +development. If credentials are not provided in code or in environment variables, +then the local ADC credentials are discovered. + +Follow the steps in [Quickstart](#quickstart) to set up a local ADC file. + +### Google Cloud Platform environments + +When running on Google Cloud Platform (GCP), including Google Compute Engine +(GCE), Google Kubernetes Engine (GKE), Google App Engine (GAE), Google Cloud +Functions (GCF) and Cloud Run, credentials are retrieved from the attached +service account automatically. Code should be written as if already authenticated. + +For more information, see +[Set up ADC for Google Cloud services](https://cloud.google.com/docs/authentication/provide-credentials-adc#attached-sa). diff --git a/owl-bot-staging/google-cloud-retail-v2/CHANGELOG.md b/owl-bot-staging/google-cloud-retail-v2/CHANGELOG.md new file mode 100644 index 000000000000..f88957a62ba2 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/CHANGELOG.md @@ -0,0 +1,2 @@ +# Release History + diff --git a/owl-bot-staging/google-cloud-retail-v2/Gemfile b/owl-bot-staging/google-cloud-retail-v2/Gemfile new file mode 100644 index 000000000000..823c136ec3c0 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/Gemfile @@ -0,0 +1,15 @@ +source "https://rubygems.org" + +gemspec + +gem "google-style", "~> 1.32.0" +gem "irb", "~> 1.17" +gem "minitest", "~> 6.0.2" +gem "minitest-focus", "~> 1.4" +gem "minitest-mock", "~> 5.27" +gem "minitest-reporters", "~> 1.8.0", require: false +gem "minitest-rg", "~> 5.3" +gem "ostruct", "~> 0.5.5" +gem "rake", ">= 13.0" +gem "redcarpet", "~> 3.6" +gem "yard", "~> 0.9" diff --git a/owl-bot-staging/google-cloud-retail-v2/LICENSE.md b/owl-bot-staging/google-cloud-retail-v2/LICENSE.md new file mode 100644 index 000000000000..c261857ba6ad --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/LICENSE.md @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/owl-bot-staging/google-cloud-retail-v2/README.md b/owl-bot-staging/google-cloud-retail-v2/README.md new file mode 100644 index 000000000000..43e25a86caf7 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/README.md @@ -0,0 +1,154 @@ +# Ruby Client for the Retail V2 API + +AI Commerce Search API is made up of Search, Browse and Recommendations. These discovery AI solutions help you implement personalized search, browse and recommendations, based on machine learning models, across your websites and mobile applications. + +Retail enables you to build an end-to-end personalized recommendation system based on state-of-the-art deep learning ML models, without a need for expertise in ML or recommendation systems. + +https://github.com/googleapis/google-cloud-ruby + +This gem is a _versioned_ client. It provides basic client classes for a +specific version of the Retail V2 API. Most users should consider using +the main client gem, +[google-cloud-retail](https://rubygems.org/gems/google-cloud-retail). +See the section below titled *Which client should I use?* for more information. + +## Installation + +``` +$ gem install google-cloud-retail-v2 +``` + +## Before You Begin + +In order to use this library, you first need to go through the following steps: + +1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project) +1. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project) +1. [Enable the API.](https://console.cloud.google.com/apis/library/retail.googleapis.com) +1. [Set up authentication.](AUTHENTICATION.md) + +## Quick Start + +```ruby +require "google/cloud/retail/v2" + +client = ::Google::Cloud::Retail::V2::AnalyticsService::Client.new +request = ::Google::Cloud::Retail::V2::ExportAnalyticsMetricsRequest.new # (request fields as keyword arguments...) +response = client.export_analytics_metrics request +``` + +View the [Client Library Documentation](https://cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest) +for class and method documentation. + +See also the [Product Documentation](https://cloud.google.com/retail/docs/apis) +for general usage information. + +## Debug Logging + +This library comes with opt-in Debug Logging that can help you troubleshoot +your application's integration with the API. When logging is activated, key +events such as requests and responses, along with data payloads and metadata +such as headers and client configuration, are logged to the standard error +stream. + +**WARNING:** Client Library Debug Logging includes your data payloads in +plaintext, which could include sensitive data such as PII for yourself or your +customers, private keys, or other security data that could be compromising if +leaked. Always practice good data hygiene with your application logs, and follow +the principle of least access. Google also recommends that Client Library Debug +Logging be enabled only temporarily during active debugging, and not used +permanently in production. + +To enable logging, set the environment variable `GOOGLE_SDK_RUBY_LOGGING_GEMS` +to the value `all`. Alternatively, you can set the value to a comma-delimited +list of client library gem names. This will select the default logging behavior, +which writes logs to the standard error stream. On a local workstation, this may +result in logs appearing on the console. When running on a Google Cloud hosting +service such as [Google Cloud Run](https://cloud.google.com/run), this generally +results in logs appearing alongside your application logs in the +[Google Cloud Logging](https://cloud.google.com/logging/) service. + +You can customize logging by modifying the `logger` configuration when +constructing a client object. For example: + +```ruby +require "google/cloud/retail/v2" +require "logger" + +client = ::Google::Cloud::Retail::V2::AnalyticsService::Client.new do |config| + config.logger = Logger.new "my-app.log" +end +``` + +## Google Cloud Samples + +To browse ready to use code samples check [Google Cloud Samples](https://cloud.google.com/docs/samples). + +## Supported Ruby Versions + +This library is supported on Ruby 3.2+. + +Google provides official support for Ruby versions that are actively supported +by Ruby Core—that is, Ruby versions that are either in normal maintenance or +in security maintenance, and not end of life. Older versions of Ruby _may_ +still work, but are unsupported and not recommended. See +https://www.ruby-lang.org/en/downloads/branches/ for details about the Ruby +support schedule. + +## Which client should I use? + +Most modern Ruby client libraries for Google APIs come in two flavors: the main +client library with a name such as `google-cloud-retail`, +and lower-level _versioned_ client libraries with names such as +`google-cloud-retail-v2`. +_In most cases, you should install the main client._ + +### What's the difference between the main client and a versioned client? + +A _versioned client_ provides a basic set of data types and client classes for +a _single version_ of a specific service. (That is, for a service with multiple +versions, there might be a separate versioned client for each service version.) +Most versioned clients are written and maintained by a code generator. + +The _main client_ is designed to provide you with the _recommended_ client +interfaces for the service. There will be only one main client for any given +service, even a service with multiple versions. The main client includes +factory methods for constructing the client objects we recommend for most +users. In some cases, those will be classes provided by an underlying versioned +client; in other cases, they will be handwritten higher-level client objects +with additional capabilities, convenience methods, or best practices built in. +Generally, the main client will default to a recommended service version, +although in some cases you can override this if you need to talk to a specific +service version. + +### Why would I want to use the main client? + +We recommend that most users install the main client gem for a service. You can +identify this gem as the one _without_ a version in its name, e.g. +`google-cloud-retail`. +The main client is recommended because it will embody the best practices for +accessing the service, and may also provide more convenient interfaces or +tighter integration into frameworks and third-party libraries. In addition, the +documentation and samples published by Google will generally demonstrate use of +the main client. + +### Why would I want to use a versioned client? + +You can use a versioned client if you are content with a possibly lower-level +class interface, you explicitly want to avoid features provided by the main +client, or you want to access a specific service version not be covered by the +main client. You can identify versioned client gems because the service version +is part of the name, e.g. `google-cloud-retail-v2`. + +### What about the google-apis- clients? + +Client library gems with names that begin with `google-apis-` are based on an +older code generation technology. They talk to a REST/JSON backend (whereas +most modern clients talk to a [gRPC](https://grpc.io/) backend) and they may +not offer the same performance, features, and ease of use provided by more +modern clients. + +The `google-apis-` clients have wide coverage across Google services, so you +might need to use one if there is no modern client available for the service. +However, if a modern client is available, we generally recommend it over the +older `google-apis-` clients. diff --git a/owl-bot-staging/google-cloud-retail-v2/Rakefile b/owl-bot-staging/google-cloud-retail-v2/Rakefile new file mode 100644 index 000000000000..b4e6091ef9cd --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/Rakefile @@ -0,0 +1,169 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "bundler/setup" +require "bundler/gem_tasks" + +require "rubocop/rake_task" +RuboCop::RakeTask.new + +require "rake/testtask" +desc "Run tests." +Rake::TestTask.new do |t| + t.libs << "test" + t.test_files = FileList["test/**/*_test.rb"] + t.warning = false +end + +desc "Runs the smoke tests." +Rake::TestTask.new :smoke_test do |t| + t.test_files = FileList["acceptance/**/*smoke_test.rb"] + t.warning = false +end + +# Acceptance tests +desc "Run the google-cloud-retail-v2 acceptance tests." +task :acceptance, :project, :keyfile do |t, args| + project = args[:project] + project ||= + ENV["RETAIL_TEST_PROJECT"] || + ENV["GCLOUD_TEST_PROJECT"] + keyfile = args[:keyfile] + keyfile ||= + ENV["RETAIL_TEST_KEYFILE"] || + ENV["GCLOUD_TEST_KEYFILE"] + if keyfile + keyfile = File.read keyfile + else + keyfile ||= + ENV["RETAIL_TEST_KEYFILE_JSON"] || + ENV["GCLOUD_TEST_KEYFILE_JSON"] + end + if project.nil? || keyfile.nil? + fail "You must provide a project and keyfile. e.g. rake acceptance[test123, /path/to/keyfile.json] or RETAIL_TEST_PROJECT=test123 RETAIL_TEST_KEYFILE=/path/to/keyfile.json rake acceptance" + end + require "google/cloud/retail/v2/analytics_service/credentials" + ::Google::Cloud::Retail::V2::AnalyticsService::Credentials.env_vars.each do |path| + ENV[path] = nil + end + ENV["RETAIL_PROJECT"] = project + ENV["RETAIL_TEST_PROJECT"] = project + ENV["RETAIL_KEYFILE_JSON"] = keyfile + + Rake::Task["acceptance:run"].invoke +end + +namespace :acceptance do + task :run do + if File.directory? "acceptance" + Rake::Task[:smoke_test].invoke + else + puts "The google-cloud-retail-v2 gem has no acceptance tests." + end + end + + desc "Run acceptance cleanup." + task :cleanup do + end +end + +task :samples do + Rake::Task["samples:latest"].invoke +end + +namespace :samples do + task :latest do + if File.directory? "samples" + Dir.chdir "samples" do + Bundler.with_clean_env do + ENV["GOOGLE_CLOUD_SAMPLES_TEST"] = "not_master" + sh "bundle update" + sh "bundle exec rake test" + end + end + else + puts "The google-cloud-retail-v2 gem has no samples to test." + end + end + + task :master do + if File.directory? "samples" + Dir.chdir "samples" do + Bundler.with_clean_env do + ENV["GOOGLE_CLOUD_SAMPLES_TEST"] = "master" + sh "bundle update" + sh "bundle exec rake test" + end + end + else + puts "The google-cloud-retail-v2 gem has no samples to test." + end + end +end + +require "yard" +require "yard/rake/yardoc_task" +YARD::Rake::YardocTask.new do |y| + y.options << "--fail-on-warning" +end + +desc "Run yard-doctest example tests." +task :doctest do + puts "The google-cloud-retail-v2 gem does not have doctest tests." +end + +desc "Run the CI build" +task :ci do + header "BUILDING google-cloud-retail-v2" + header "google-cloud-retail-v2 rubocop", "*" + Rake::Task[:rubocop].invoke + header "google-cloud-retail-v2 yard", "*" + Rake::Task[:yard].invoke + header "google-cloud-retail-v2 test", "*" + Rake::Task[:test].invoke +end + +namespace :ci do + desc "Run the CI build, with smoke tests." + task :smoke_test do + Rake::Task[:ci].invoke + header "google-cloud-retail-v2 smoke_test", "*" + Rake::Task[:smoke_test].invoke + end + desc "Run the CI build, with acceptance tests." + task :acceptance do + Rake::Task[:ci].invoke + header "google-cloud-retail-v2 acceptance", "*" + Rake::Task[:acceptance].invoke + end + task :a do + # This is a handy shortcut to save typing + Rake::Task["ci:acceptance"].invoke + end +end + +task default: :test + +def header str, token = "#" + line_length = str.length + 8 + puts "" + puts token * line_length + puts "#{token * 3} #{str} #{token * 3}" + puts token * line_length + puts "" +end diff --git a/owl-bot-staging/google-cloud-retail-v2/gapic_metadata.json b/owl-bot-staging/google-cloud-retail-v2/gapic_metadata.json new file mode 100644 index 000000000000..d2b8ccdd6732 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/gapic_metadata.json @@ -0,0 +1,412 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "ruby", + "protoPackage": "google.cloud.retail.v2", + "libraryPackage": "::Google::Cloud::Retail::V2", + "services": { + "AnalyticsService": { + "clients": { + "grpc": { + "libraryClient": "::Google::Cloud::Retail::V2::AnalyticsService::Client", + "rpcs": { + "ExportAnalyticsMetrics": { + "methods": [ + "export_analytics_metrics" + ] + } + } + } + } + }, + "CatalogService": { + "clients": { + "grpc": { + "libraryClient": "::Google::Cloud::Retail::V2::CatalogService::Client", + "rpcs": { + "ListCatalogs": { + "methods": [ + "list_catalogs" + ] + }, + "UpdateCatalog": { + "methods": [ + "update_catalog" + ] + }, + "SetDefaultBranch": { + "methods": [ + "set_default_branch" + ] + }, + "GetDefaultBranch": { + "methods": [ + "get_default_branch" + ] + }, + "GetCompletionConfig": { + "methods": [ + "get_completion_config" + ] + }, + "UpdateCompletionConfig": { + "methods": [ + "update_completion_config" + ] + }, + "GetAttributesConfig": { + "methods": [ + "get_attributes_config" + ] + }, + "UpdateAttributesConfig": { + "methods": [ + "update_attributes_config" + ] + }, + "AddCatalogAttribute": { + "methods": [ + "add_catalog_attribute" + ] + }, + "RemoveCatalogAttribute": { + "methods": [ + "remove_catalog_attribute" + ] + }, + "ReplaceCatalogAttribute": { + "methods": [ + "replace_catalog_attribute" + ] + } + } + } + } + }, + "CompletionService": { + "clients": { + "grpc": { + "libraryClient": "::Google::Cloud::Retail::V2::CompletionService::Client", + "rpcs": { + "CompleteQuery": { + "methods": [ + "complete_query" + ] + }, + "ImportCompletionData": { + "methods": [ + "import_completion_data" + ] + } + } + } + } + }, + "ControlService": { + "clients": { + "grpc": { + "libraryClient": "::Google::Cloud::Retail::V2::ControlService::Client", + "rpcs": { + "CreateControl": { + "methods": [ + "create_control" + ] + }, + "DeleteControl": { + "methods": [ + "delete_control" + ] + }, + "UpdateControl": { + "methods": [ + "update_control" + ] + }, + "GetControl": { + "methods": [ + "get_control" + ] + }, + "ListControls": { + "methods": [ + "list_controls" + ] + } + } + } + } + }, + "SearchService": { + "clients": { + "grpc": { + "libraryClient": "::Google::Cloud::Retail::V2::SearchService::Client", + "rpcs": { + "Search": { + "methods": [ + "search" + ] + } + } + } + } + }, + "ConversationalSearchService": { + "clients": { + "grpc": { + "libraryClient": "::Google::Cloud::Retail::V2::ConversationalSearchService::Client", + "rpcs": { + "ConversationalSearch": { + "methods": [ + "conversational_search" + ] + } + } + } + } + }, + "GenerativeQuestionService": { + "clients": { + "grpc": { + "libraryClient": "::Google::Cloud::Retail::V2::GenerativeQuestionService::Client", + "rpcs": { + "UpdateGenerativeQuestionsFeatureConfig": { + "methods": [ + "update_generative_questions_feature_config" + ] + }, + "GetGenerativeQuestionsFeatureConfig": { + "methods": [ + "get_generative_questions_feature_config" + ] + }, + "ListGenerativeQuestionConfigs": { + "methods": [ + "list_generative_question_configs" + ] + }, + "UpdateGenerativeQuestionConfig": { + "methods": [ + "update_generative_question_config" + ] + }, + "BatchUpdateGenerativeQuestionConfigs": { + "methods": [ + "batch_update_generative_question_configs" + ] + } + } + } + } + }, + "ModelService": { + "clients": { + "grpc": { + "libraryClient": "::Google::Cloud::Retail::V2::ModelService::Client", + "rpcs": { + "CreateModel": { + "methods": [ + "create_model" + ] + }, + "GetModel": { + "methods": [ + "get_model" + ] + }, + "PauseModel": { + "methods": [ + "pause_model" + ] + }, + "ResumeModel": { + "methods": [ + "resume_model" + ] + }, + "DeleteModel": { + "methods": [ + "delete_model" + ] + }, + "ListModels": { + "methods": [ + "list_models" + ] + }, + "UpdateModel": { + "methods": [ + "update_model" + ] + }, + "TuneModel": { + "methods": [ + "tune_model" + ] + } + } + } + } + }, + "PredictionService": { + "clients": { + "grpc": { + "libraryClient": "::Google::Cloud::Retail::V2::PredictionService::Client", + "rpcs": { + "Predict": { + "methods": [ + "predict" + ] + } + } + } + } + }, + "ProductService": { + "clients": { + "grpc": { + "libraryClient": "::Google::Cloud::Retail::V2::ProductService::Client", + "rpcs": { + "CreateProduct": { + "methods": [ + "create_product" + ] + }, + "GetProduct": { + "methods": [ + "get_product" + ] + }, + "ListProducts": { + "methods": [ + "list_products" + ] + }, + "UpdateProduct": { + "methods": [ + "update_product" + ] + }, + "DeleteProduct": { + "methods": [ + "delete_product" + ] + }, + "PurgeProducts": { + "methods": [ + "purge_products" + ] + }, + "ImportProducts": { + "methods": [ + "import_products" + ] + }, + "SetInventory": { + "methods": [ + "set_inventory" + ] + }, + "AddFulfillmentPlaces": { + "methods": [ + "add_fulfillment_places" + ] + }, + "RemoveFulfillmentPlaces": { + "methods": [ + "remove_fulfillment_places" + ] + }, + "AddLocalInventories": { + "methods": [ + "add_local_inventories" + ] + }, + "RemoveLocalInventories": { + "methods": [ + "remove_local_inventories" + ] + } + } + } + } + }, + "ServingConfigService": { + "clients": { + "grpc": { + "libraryClient": "::Google::Cloud::Retail::V2::ServingConfigService::Client", + "rpcs": { + "CreateServingConfig": { + "methods": [ + "create_serving_config" + ] + }, + "DeleteServingConfig": { + "methods": [ + "delete_serving_config" + ] + }, + "UpdateServingConfig": { + "methods": [ + "update_serving_config" + ] + }, + "GetServingConfig": { + "methods": [ + "get_serving_config" + ] + }, + "ListServingConfigs": { + "methods": [ + "list_serving_configs" + ] + }, + "AddControl": { + "methods": [ + "add_control" + ] + }, + "RemoveControl": { + "methods": [ + "remove_control" + ] + } + } + } + } + }, + "UserEventService": { + "clients": { + "grpc": { + "libraryClient": "::Google::Cloud::Retail::V2::UserEventService::Client", + "rpcs": { + "WriteUserEvent": { + "methods": [ + "write_user_event" + ] + }, + "CollectUserEvent": { + "methods": [ + "collect_user_event" + ] + }, + "PurgeUserEvents": { + "methods": [ + "purge_user_events" + ] + }, + "ImportUserEvents": { + "methods": [ + "import_user_events" + ] + }, + "RejoinUserEvents": { + "methods": [ + "rejoin_user_events" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-retail-v2/google-cloud-retail-v2.gemspec b/owl-bot-staging/google-cloud-retail-v2/google-cloud-retail-v2.gemspec new file mode 100644 index 000000000000..e93626b80550 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/google-cloud-retail-v2.gemspec @@ -0,0 +1,29 @@ +# -*- ruby -*- +# encoding: utf-8 + +require File.expand_path("lib/google/cloud/retail/v2/version", __dir__) + +Gem::Specification.new do |gem| + gem.name = "google-cloud-retail-v2" + gem.version = Google::Cloud::Retail::V2::VERSION + + gem.authors = ["Google LLC"] + gem.email = "googleapis-packages@google.com" + gem.description = "Retail enables you to build an end-to-end personalized recommendation system based on state-of-the-art deep learning ML models, without a need for expertise in ML or recommendation systems. Note that google-cloud-retail-v2 is a version-specific client library. For most uses, we recommend installing the main client library google-cloud-retail instead. See the readme for more details." + gem.summary = "AI Commerce Search API is made up of Search, Browse and Recommendations. These discovery AI solutions help you implement personalized search, browse and recommendations, based on machine learning models, across your websites and mobile applications." + gem.homepage = "https://github.com/googleapis/google-cloud-ruby" + gem.license = "Apache-2.0" + + gem.platform = Gem::Platform::RUBY + + gem.files = `git ls-files -- lib/*`.split("\n") + + `git ls-files -- proto_docs/*`.split("\n") + + ["README.md", "LICENSE.md", "AUTHENTICATION.md", ".yardopts"] + gem.require_paths = ["lib"] + + gem.required_ruby_version = ">= 3.2" + + gem.add_dependency "gapic-common", "~> 1.3" + gem.add_dependency "google-cloud-errors", "~> 1.0" + gem.add_dependency "google-cloud-location", "~> 1.0" +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google-cloud-retail-v2.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google-cloud-retail-v2.rb new file mode 100644 index 000000000000..45db4898f66c --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google-cloud-retail-v2.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# This gem does not autoload during Bundler.require. To load this gem, +# issue explicit require statements for the packages desired, e.g.: +# require "google/cloud/retail/v2" diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2.rb new file mode 100644 index 000000000000..4214f1307e58 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2.rb @@ -0,0 +1,56 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/retail/v2/analytics_service" +require "google/cloud/retail/v2/catalog_service" +require "google/cloud/retail/v2/completion_service" +require "google/cloud/retail/v2/control_service" +require "google/cloud/retail/v2/search_service" +require "google/cloud/retail/v2/conversational_search_service" +require "google/cloud/retail/v2/generative_question_service" +require "google/cloud/retail/v2/model_service" +require "google/cloud/retail/v2/prediction_service" +require "google/cloud/retail/v2/product_service" +require "google/cloud/retail/v2/serving_config_service" +require "google/cloud/retail/v2/user_event_service" +require "google/cloud/retail/v2/version" + +module Google + module Cloud + module Retail + ## + # API client module. + # + # @example Load this package, including all its services, and instantiate a gRPC client + # + # require "google/cloud/retail/v2" + # client = ::Google::Cloud::Retail::V2::AnalyticsService::Client.new + # + # @example Load this package, including all its services, and instantiate a REST client + # + # require "google/cloud/retail/v2" + # client = ::Google::Cloud::Retail::V2::AnalyticsService::Rest::Client.new + # + module V2 + end + end + end +end + +helper_path = ::File.join __dir__, "v2", "_helpers.rb" +require "google/cloud/retail/v2/_helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service.rb new file mode 100644 index 000000000000..3eb7f4cce88a --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service.rb @@ -0,0 +1,56 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/common" +require "gapic/config" +require "gapic/config/method" + +require "google/cloud/retail/v2/version" + +require "google/cloud/retail/v2/analytics_service/credentials" +require "google/cloud/retail/v2/analytics_service/operations" +require "google/cloud/retail/v2/analytics_service/client" +require "google/cloud/retail/v2/analytics_service/rest" + +module Google + module Cloud + module Retail + module V2 + ## + # Service for managing & accessing retail search business metric. + # Retail recommendation business metric is currently not available. + # + # @example Load this service and instantiate a gRPC client + # + # require "google/cloud/retail/v2/analytics_service" + # client = ::Google::Cloud::Retail::V2::AnalyticsService::Client.new + # + # @example Load this service and instantiate a REST client + # + # require "google/cloud/retail/v2/analytics_service/rest" + # client = ::Google::Cloud::Retail::V2::AnalyticsService::Rest::Client.new + # + module AnalyticsService + end + end + end + end +end + +helper_path = ::File.join __dir__, "analytics_service", "helpers.rb" +require "google/cloud/retail/v2/analytics_service/helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/client.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/client.rb new file mode 100644 index 000000000000..6bf39fd8fb1d --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/client.rb @@ -0,0 +1,543 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/cloud/retail/v2/analytics_service_pb" +require "google/cloud/location" + +module Google + module Cloud + module Retail + module V2 + module AnalyticsService + ## + # Client for the AnalyticsService service. + # + # Service for managing & accessing retail search business metric. + # Retail recommendation business metric is currently not available. + # + class Client + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" + + # @private + attr_reader :analytics_service_stub + + ## + # Configure the AnalyticsService Client class. + # + # See {::Google::Cloud::Retail::V2::AnalyticsService::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all AnalyticsService clients + # ::Google::Cloud::Retail::V2::AnalyticsService::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "Retail", "V2"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config.rpcs.export_analytics_metrics.timeout = 60.0 + default_config.rpcs.export_analytics_metrics.retry_policy = { + initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4] + } + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the AnalyticsService Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Cloud::Retail::V2::AnalyticsService::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @analytics_service_stub.universe_domain + end + + ## + # Create a new AnalyticsService client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::Retail::V2::AnalyticsService::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::Retail::V2::AnalyticsService::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the AnalyticsService client. + # @yieldparam config [Client::Configuration] + # + def initialize + # These require statements are intentionally placed here to initialize + # the gRPC module only when it's required. + # See https://github.com/googleapis/toolkit/issues/446 + require "gapic/grpc" + require "google/cloud/retail/v2/analytics_service_services_pb" + + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @operations_client = Operations.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain + end + + @analytics_service_stub = ::Gapic::ServiceStub.new( + ::Google::Cloud::Retail::V2::AnalyticsService::Stub, + credentials: credentials, + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + channel_args: @config.channel_args, + interceptors: @config.interceptors, + channel_pool_config: @config.channel_pool, + logger: @config.logger + ) + + @analytics_service_stub.stub_logger&.info do |entry| + entry.set_system_name + entry.set_service + entry.message = "Created client for #{entry.service}" + entry.set_credentials_fields credentials + entry.set "customEndpoint", @config.endpoint if @config.endpoint + entry.set "defaultTimeout", @config.timeout if @config.timeout + entry.set "quotaProject", @quota_project_id if @quota_project_id + end + + @location_client = Google::Cloud::Location::Locations::Client.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @analytics_service_stub.endpoint + config.universe_domain = @analytics_service_stub.universe_domain + config.logger = @analytics_service_stub.logger if config.respond_to? :logger= + end + end + + ## + # Get the associated client for long-running operations. + # + # @return [::Google::Cloud::Retail::V2::AnalyticsService::Operations] + # + attr_reader :operations_client + + ## + # Get the associated client for mix-in of the Locations. + # + # @return [Google::Cloud::Location::Locations::Client] + # + attr_reader :location_client + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @analytics_service_stub.logger + end + + # Service calls + + ## + # Exports analytics metrics. + # + # `Operation.response` is of type `ExportAnalyticsMetricsResponse`. + # `Operation.metadata` is of type `ExportMetadata`. + # + # @overload export_analytics_metrics(request, options = nil) + # Pass arguments to `export_analytics_metrics` via a request object, either of type + # {::Google::Cloud::Retail::V2::ExportAnalyticsMetricsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::ExportAnalyticsMetricsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload export_analytics_metrics(catalog: nil, output_config: nil, filter: nil) + # Pass arguments to `export_analytics_metrics` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param catalog [::String] + # Required. Full resource name of the parent catalog. + # Expected format: `projects/*/locations/*/catalogs/*` + # @param output_config [::Google::Cloud::Retail::V2::OutputConfig, ::Hash] + # Required. The output location of the data. + # @param filter [::String] + # A filtering expression to specify restrictions on returned metrics. + # The expression is a sequence of terms. Each term applies a restriction to + # the returned metrics. Use this expression to restrict results to a + # specific time range. + # + # Currently we expect only one types of fields: + # + # * `timestamp`: This can be specified twice, once with a + # less than operator and once with a greater than operator. The + # `timestamp` restriction should result in one, contiguous, valid, + # `timestamp` range. + # + # Some examples of valid filters expressions: + # + # * Example 1: `timestamp > "2012-04-23T18:25:43.511Z" + # timestamp < "2012-04-23T18:30:43.511Z"` + # * Example 2: `timestamp > "2012-04-23T18:25:43.511Z"` + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::AnalyticsService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::ExportAnalyticsMetricsRequest.new + # + # # Call the export_analytics_metrics method. + # result = client.export_analytics_metrics request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def export_analytics_metrics request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ExportAnalyticsMetricsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.export_analytics_metrics.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.catalog + header_params["catalog"] = request.catalog + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.export_analytics_metrics.timeout, + metadata: metadata, + retry_policy: @config.rpcs.export_analytics_metrics.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @analytics_service_stub.call_rpc :export_analytics_metrics, request, options: options do |response, operation| + response = ::Gapic::Operation.new response, @operations_client, options: options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the AnalyticsService API. + # + # This class represents the configuration for AnalyticsService, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::Retail::V2::AnalyticsService::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # export_analytics_metrics to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Retail::V2::AnalyticsService::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.export_analytics_metrics.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Retail::V2::AnalyticsService::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.export_analytics_metrics.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`GRPC::Core::Channel`) a gRPC channel with included credentials + # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object + # * (`nil`) indicating no credentials + # + # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials + # is deprecated. Providing an unvalidated credential configuration to + # Google APIs can compromise the security of your systems and data. + # + # @example + # + # # The recommended way to provide credentials is to use the `make_creds` method + # # on the appropriate credentials class for your environment. + # + # require "googleauth" + # + # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds( + # json_key_io: ::File.open("/path/to/keyfile.json") + # ) + # + # client = ::Google::Cloud::Retail::V2::AnalyticsService::Client.new do |config| + # config.credentials = credentials + # end + # + # @note Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] channel_args + # Extra parameters passed to the gRPC channel. Note: this is ignored if a + # `GRPC::Core::Channel` object is provided as the credential. + # @return [::Hash] + # @!attribute [rw] interceptors + # An array of interceptors that are run before calls are executed. + # @return [::Array<::GRPC::ClientInterceptor>] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional gRPC headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "retail.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) + config_attr :interceptors, nil, ::Array, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration for the channel pool + # @return [::Gapic::ServiceStub::ChannelPool::Configuration] + # + def channel_pool + @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new + end + + ## + # Configuration RPC class for the AnalyticsService API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `export_analytics_metrics` + # @return [::Gapic::Config::Method] + # + attr_reader :export_analytics_metrics + + # @private + def initialize parent_rpcs = nil + export_analytics_metrics_config = parent_rpcs.export_analytics_metrics if parent_rpcs.respond_to? :export_analytics_metrics + @export_analytics_metrics = ::Gapic::Config::Method.new export_analytics_metrics_config + + yield self if block_given? + end + end + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/credentials.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/credentials.rb new file mode 100644 index 000000000000..89a3470cd910 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/credentials.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "googleauth" + +module Google + module Cloud + module Retail + module V2 + module AnalyticsService + # Credentials for the AnalyticsService API. + class Credentials < ::Google::Auth::Credentials + self.scope = [ + "https://www.googleapis.com/auth/cloud-platform" + ] + self.env_vars = [ + "RETAIL_CREDENTIALS", + "RETAIL_KEYFILE", + "GOOGLE_CLOUD_CREDENTIALS", + "GOOGLE_CLOUD_KEYFILE", + "GCLOUD_KEYFILE", + "RETAIL_CREDENTIALS_JSON", + "RETAIL_KEYFILE_JSON", + "GOOGLE_CLOUD_CREDENTIALS_JSON", + "GOOGLE_CLOUD_KEYFILE_JSON", + "GCLOUD_KEYFILE_JSON" + ] + self.paths = [ + "~/.config/google_cloud/application_default_credentials.json" + ] + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/operations.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/operations.rb new file mode 100644 index 000000000000..a95ff44ed70d --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/operations.rb @@ -0,0 +1,843 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/operation" +require "google/longrunning/operations_pb" + +module Google + module Cloud + module Retail + module V2 + module AnalyticsService + # Service that implements Longrunning Operations API. + class Operations + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" + + # @private + attr_reader :operations_stub + + ## + # Configuration for the AnalyticsService Operations API. + # + # @yield [config] Configure the Operations client. + # @yieldparam config [Operations::Configuration] + # + # @return [Operations::Configuration] + # + def self.configure + @configure ||= Operations::Configuration.new + yield @configure if block_given? + @configure + end + + ## + # Configure the AnalyticsService Operations instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Operations.configure}. + # + # @yield [config] Configure the Operations client. + # @yieldparam config [Operations::Configuration] + # + # @return [Operations::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @operations_stub.universe_domain + end + + ## + # Create a new Operations client object. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Operations::Configuration] + # + def initialize + # These require statements are intentionally placed here to initialize + # the gRPC module only when it's required. + # See https://github.com/googleapis/toolkit/issues/446 + require "gapic/grpc" + require "google/longrunning/operations_services_pb" + + # Create the configuration object + @config = Configuration.new Operations.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + credentials ||= Credentials.default scope: @config.scope + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @operations_stub = ::Gapic::ServiceStub.new( + ::Google::Longrunning::Operations::Stub, + credentials: credentials, + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + channel_args: @config.channel_args, + interceptors: @config.interceptors, + channel_pool_config: @config.channel_pool + ) + + # Used by an LRO wrapper for some methods of this service + @operations_client = self + end + + # Service calls + + ## + # Lists operations that match the specified filter in the request. If the + # server doesn't support this method, it returns `UNIMPLEMENTED`. + # + # @overload list_operations(request, options = nil) + # Pass arguments to `list_operations` via a request object, either of type + # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::ListOperationsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload list_operations(name: nil, filter: nil, page_size: nil, page_token: nil, return_partial_success: nil) + # Pass arguments to `list_operations` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation's parent resource. + # @param filter [::String] + # The standard list filter. + # @param page_size [::Integer] + # The standard list page size. + # @param page_token [::String] + # The standard list page token. + # @param return_partial_success [::Boolean] + # When set to `true`, operations that are reachable are returned as normal, + # and those that are unreachable are returned in the + # [ListOperationsResponse.unreachable] field. + # + # This can only be `true` when reading across collections e.g. when `parent` + # is set to `"projects/example/locations/-"`. + # + # This field is not by default supported and will result in an + # `UNIMPLEMENTED` error if set unless explicitly documented otherwise in + # service or product specific documentation. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::PagedEnumerable<::Gapic::Operation>] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::PagedEnumerable<::Gapic::Operation>] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::ListOperationsRequest.new + # + # # Call the list_operations method. + # result = client.list_operations request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Longrunning::Operation. + # p item + # end + # + def list_operations request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::ListOperationsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.list_operations.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.list_operations.timeout, + metadata: metadata, + retry_policy: @config.rpcs.list_operations.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.call_rpc :list_operations, request, options: options do |response, operation| + wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client } + response = ::Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets the latest state of a long-running operation. Clients can use this + # method to poll the operation result at intervals as recommended by the API + # service. + # + # @overload get_operation(request, options = nil) + # Pass arguments to `get_operation` via a request object, either of type + # {::Google::Longrunning::GetOperationRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::GetOperationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload get_operation(name: nil) + # Pass arguments to `get_operation` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation resource. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::GetOperationRequest.new + # + # # Call the get_operation method. + # result = client.get_operation request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def get_operation request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::GetOperationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.get_operation.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.get_operation.timeout, + metadata: metadata, + retry_policy: @config.rpcs.get_operation.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.call_rpc :get_operation, request, options: options do |response, operation| + response = ::Gapic::Operation.new response, @operations_client, options: options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Deletes a long-running operation. This method indicates that the client is + # no longer interested in the operation result. It does not cancel the + # operation. If the server doesn't support this method, it returns + # `google.rpc.Code.UNIMPLEMENTED`. + # + # @overload delete_operation(request, options = nil) + # Pass arguments to `delete_operation` via a request object, either of type + # {::Google::Longrunning::DeleteOperationRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::DeleteOperationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload delete_operation(name: nil) + # Pass arguments to `delete_operation` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation resource to be deleted. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Protobuf::Empty] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Protobuf::Empty] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::DeleteOperationRequest.new + # + # # Call the delete_operation method. + # result = client.delete_operation request + # + # # The returned object is of type Google::Protobuf::Empty. + # p result + # + def delete_operation request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::DeleteOperationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.delete_operation.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.delete_operation.timeout, + metadata: metadata, + retry_policy: @config.rpcs.delete_operation.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.call_rpc :delete_operation, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Starts asynchronous cancellation on a long-running operation. The server + # makes a best effort to cancel the operation, but success is not + # guaranteed. If the server doesn't support this method, it returns + # `google.rpc.Code.UNIMPLEMENTED`. Clients can use + # Operations.GetOperation or + # other methods to check whether the cancellation succeeded or whether the + # operation completed despite cancellation. On successful cancellation, + # the operation is not deleted; instead, it becomes an operation with + # an {::Google::Longrunning::Operation#error Operation.error} value with a + # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to + # `Code.CANCELLED`. + # + # @overload cancel_operation(request, options = nil) + # Pass arguments to `cancel_operation` via a request object, either of type + # {::Google::Longrunning::CancelOperationRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::CancelOperationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload cancel_operation(name: nil) + # Pass arguments to `cancel_operation` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation resource to be cancelled. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Protobuf::Empty] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Protobuf::Empty] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::CancelOperationRequest.new + # + # # Call the cancel_operation method. + # result = client.cancel_operation request + # + # # The returned object is of type Google::Protobuf::Empty. + # p result + # + def cancel_operation request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::CancelOperationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.cancel_operation.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.cancel_operation.timeout, + metadata: metadata, + retry_policy: @config.rpcs.cancel_operation.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Waits until the specified long-running operation is done or reaches at most + # a specified timeout, returning the latest state. If the operation is + # already done, the latest state is immediately returned. If the timeout + # specified is greater than the default HTTP/RPC timeout, the HTTP/RPC + # timeout is used. If the server does not support this method, it returns + # `google.rpc.Code.UNIMPLEMENTED`. + # Note that this method is on a best-effort basis. It may return the latest + # state before the specified timeout (including immediately), meaning even an + # immediate response is no guarantee that the operation is done. + # + # @overload wait_operation(request, options = nil) + # Pass arguments to `wait_operation` via a request object, either of type + # {::Google::Longrunning::WaitOperationRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::WaitOperationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload wait_operation(name: nil, timeout: nil) + # Pass arguments to `wait_operation` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation resource to wait on. + # @param timeout [::Google::Protobuf::Duration, ::Hash] + # The maximum duration to wait before timing out. If left blank, the wait + # will be at most the time permitted by the underlying HTTP/RPC protocol. + # If RPC context deadline is also specified, the shorter one will be used. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::WaitOperationRequest.new + # + # # Call the wait_operation method. + # result = client.wait_operation request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def wait_operation request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::WaitOperationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.wait_operation.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.wait_operation.timeout, + metadata: metadata, + retry_policy: @config.rpcs.wait_operation.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation| + response = ::Gapic::Operation.new response, @operations_client, options: options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the Operations API. + # + # This class represents the configuration for Operations, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Longrunning::Operations::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # list_operations to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Longrunning::Operations::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.list_operations.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Longrunning::Operations::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.list_operations.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`GRPC::Core::Channel`) a gRPC channel with included credentials + # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object + # * (`nil`) indicating no credentials + # + # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials + # is deprecated. Providing an unvalidated credential configuration to + # Google APIs can compromise the security of your systems and data. + # + # @example + # + # # The recommended way to provide credentials is to use the `make_creds` method + # # on the appropriate credentials class for your environment. + # + # require "googleauth" + # + # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds( + # json_key_io: ::File.open("/path/to/keyfile.json") + # ) + # + # client = ::Google::Longrunning::Operations::Client.new do |config| + # config.credentials = credentials + # end + # + # @note Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] channel_args + # Extra parameters passed to the gRPC channel. Note: this is ignored if a + # `GRPC::Core::Channel` object is provided as the credential. + # @return [::Hash] + # @!attribute [rw] interceptors + # An array of interceptors that are run before calls are executed. + # @return [::Array<::GRPC::ClientInterceptor>] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional gRPC headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "retail.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) + config_attr :interceptors, nil, ::Array, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration for the channel pool + # @return [::Gapic::ServiceStub::ChannelPool::Configuration] + # + def channel_pool + @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new + end + + ## + # Configuration RPC class for the Operations API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `list_operations` + # @return [::Gapic::Config::Method] + # + attr_reader :list_operations + ## + # RPC-specific configuration for `get_operation` + # @return [::Gapic::Config::Method] + # + attr_reader :get_operation + ## + # RPC-specific configuration for `delete_operation` + # @return [::Gapic::Config::Method] + # + attr_reader :delete_operation + ## + # RPC-specific configuration for `cancel_operation` + # @return [::Gapic::Config::Method] + # + attr_reader :cancel_operation + ## + # RPC-specific configuration for `wait_operation` + # @return [::Gapic::Config::Method] + # + attr_reader :wait_operation + + # @private + def initialize parent_rpcs = nil + list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations + @list_operations = ::Gapic::Config::Method.new list_operations_config + get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation + @get_operation = ::Gapic::Config::Method.new get_operation_config + delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation + @delete_operation = ::Gapic::Config::Method.new delete_operation_config + cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation + @cancel_operation = ::Gapic::Config::Method.new cancel_operation_config + wait_operation_config = parent_rpcs.wait_operation if parent_rpcs.respond_to? :wait_operation + @wait_operation = ::Gapic::Config::Method.new wait_operation_config + + yield self if block_given? + end + end + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/rest.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/rest.rb new file mode 100644 index 000000000000..df3ab00fece5 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/rest.rb @@ -0,0 +1,53 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/rest" +require "gapic/config" +require "gapic/config/method" + +require "google/cloud/retail/v2/version" + +require "google/cloud/retail/v2/analytics_service/credentials" +require "google/cloud/retail/v2/analytics_service/rest/operations" +require "google/cloud/retail/v2/analytics_service/rest/client" + +module Google + module Cloud + module Retail + module V2 + ## + # Service for managing & accessing retail search business metric. + # Retail recommendation business metric is currently not available. + # + # To load this service and instantiate a REST client: + # + # require "google/cloud/retail/v2/analytics_service/rest" + # client = ::Google::Cloud::Retail::V2::AnalyticsService::Rest::Client.new + # + module AnalyticsService + # Client for the REST transport + module Rest + end + end + end + end + end +end + +helper_path = ::File.join __dir__, "rest", "helpers.rb" +require "google/cloud/retail/v2/analytics_service/rest/helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/rest/client.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/rest/client.rb new file mode 100644 index 000000000000..f8af9a9f4f30 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/rest/client.rb @@ -0,0 +1,493 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/cloud/retail/v2/analytics_service_pb" +require "google/cloud/retail/v2/analytics_service/rest/service_stub" +require "google/cloud/location/rest" + +module Google + module Cloud + module Retail + module V2 + module AnalyticsService + module Rest + ## + # REST client for the AnalyticsService service. + # + # Service for managing & accessing retail search business metric. + # Retail recommendation business metric is currently not available. + # + class Client + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" + + # @private + attr_reader :analytics_service_stub + + ## + # Configure the AnalyticsService Client class. + # + # See {::Google::Cloud::Retail::V2::AnalyticsService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all AnalyticsService clients + # ::Google::Cloud::Retail::V2::AnalyticsService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "Retail", "V2"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config.rpcs.export_analytics_metrics.timeout = 60.0 + default_config.rpcs.export_analytics_metrics.retry_policy = { + initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4] + } + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the AnalyticsService Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Cloud::Retail::V2::AnalyticsService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @analytics_service_stub.universe_domain + end + + ## + # Create a new AnalyticsService REST client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::Retail::V2::AnalyticsService::Rest::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::Retail::V2::AnalyticsService::Rest::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the AnalyticsService client. + # @yieldparam config [Client::Configuration] + # + def initialize + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @operations_client = ::Google::Cloud::Retail::V2::AnalyticsService::Rest::Operations.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain + end + + @analytics_service_stub = ::Google::Cloud::Retail::V2::AnalyticsService::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials, + logger: @config.logger + ) + + @analytics_service_stub.logger(stub: true)&.info do |entry| + entry.set_system_name + entry.set_service + entry.message = "Created client for #{entry.service}" + entry.set_credentials_fields credentials + entry.set "customEndpoint", @config.endpoint if @config.endpoint + entry.set "defaultTimeout", @config.timeout if @config.timeout + entry.set "quotaProject", @quota_project_id if @quota_project_id + end + + @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @analytics_service_stub.endpoint + config.universe_domain = @analytics_service_stub.universe_domain + config.logger = @analytics_service_stub.logger if config.respond_to? :logger= + end + end + + ## + # Get the associated client for long-running operations. + # + # @return [::Google::Cloud::Retail::V2::AnalyticsService::Rest::Operations] + # + attr_reader :operations_client + + ## + # Get the associated client for mix-in of the Locations. + # + # @return [Google::Cloud::Location::Locations::Rest::Client] + # + attr_reader :location_client + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @analytics_service_stub.logger + end + + # Service calls + + ## + # Exports analytics metrics. + # + # `Operation.response` is of type `ExportAnalyticsMetricsResponse`. + # `Operation.metadata` is of type `ExportMetadata`. + # + # @overload export_analytics_metrics(request, options = nil) + # Pass arguments to `export_analytics_metrics` via a request object, either of type + # {::Google::Cloud::Retail::V2::ExportAnalyticsMetricsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::ExportAnalyticsMetricsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload export_analytics_metrics(catalog: nil, output_config: nil, filter: nil) + # Pass arguments to `export_analytics_metrics` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param catalog [::String] + # Required. Full resource name of the parent catalog. + # Expected format: `projects/*/locations/*/catalogs/*` + # @param output_config [::Google::Cloud::Retail::V2::OutputConfig, ::Hash] + # Required. The output location of the data. + # @param filter [::String] + # A filtering expression to specify restrictions on returned metrics. + # The expression is a sequence of terms. Each term applies a restriction to + # the returned metrics. Use this expression to restrict results to a + # specific time range. + # + # Currently we expect only one types of fields: + # + # * `timestamp`: This can be specified twice, once with a + # less than operator and once with a greater than operator. The + # `timestamp` restriction should result in one, contiguous, valid, + # `timestamp` range. + # + # Some examples of valid filters expressions: + # + # * Example 1: `timestamp > "2012-04-23T18:25:43.511Z" + # timestamp < "2012-04-23T18:30:43.511Z"` + # * Example 2: `timestamp > "2012-04-23T18:25:43.511Z"` + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::AnalyticsService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::ExportAnalyticsMetricsRequest.new + # + # # Call the export_analytics_metrics method. + # result = client.export_analytics_metrics request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def export_analytics_metrics request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ExportAnalyticsMetricsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.export_analytics_metrics.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.export_analytics_metrics.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.export_analytics_metrics.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @analytics_service_stub.export_analytics_metrics request, options do |result, operation| + result = ::Gapic::Operation.new result, @operations_client, options: options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the AnalyticsService REST API. + # + # This class represents the configuration for AnalyticsService REST, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::Retail::V2::AnalyticsService::Rest::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # export_analytics_metrics to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Retail::V2::AnalyticsService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.export_analytics_metrics.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Retail::V2::AnalyticsService::Rest::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.export_analytics_metrics.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`String`) The path to a service account key file in JSON format + # * (`Hash`) A service account key as a Hash + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`nil`) indicating no credentials + # + # Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "retail.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration RPC class for the AnalyticsService API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `export_analytics_metrics` + # @return [::Gapic::Config::Method] + # + attr_reader :export_analytics_metrics + + # @private + def initialize parent_rpcs = nil + export_analytics_metrics_config = parent_rpcs.export_analytics_metrics if parent_rpcs.respond_to? :export_analytics_metrics + @export_analytics_metrics = ::Gapic::Config::Method.new export_analytics_metrics_config + + yield self if block_given? + end + end + end + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/rest/operations.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/rest/operations.rb new file mode 100644 index 000000000000..637809c95842 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/rest/operations.rb @@ -0,0 +1,962 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/operation" + +module Google + module Cloud + module Retail + module V2 + module AnalyticsService + module Rest + # Service that implements Longrunning Operations API. + class Operations + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" + + # @private + attr_reader :operations_stub + + ## + # Configuration for the AnalyticsService Operations API. + # + # @yield [config] Configure the Operations client. + # @yieldparam config [Operations::Configuration] + # + # @return [Operations::Configuration] + # + def self.configure + @configure ||= Operations::Configuration.new + yield @configure if block_given? + @configure + end + + ## + # Configure the AnalyticsService Operations instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Operations.configure}. + # + # @yield [config] Configure the Operations client. + # @yieldparam config [Operations::Configuration] + # + # @return [Operations::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @operations_stub.universe_domain + end + + ## + # Create a new Operations client object. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Operations::Configuration] + # + def initialize + # Create the configuration object + @config = Configuration.new Operations.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + credentials ||= Credentials.default scope: @config.scope + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @operations_stub = OperationsServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials + ) + + # Used by an LRO wrapper for some methods of this service + @operations_client = self + end + + # Service calls + + ## + # Lists operations that match the specified filter in the request. If the + # server doesn't support this method, it returns `UNIMPLEMENTED`. + # + # @overload list_operations(request, options = nil) + # Pass arguments to `list_operations` via a request object, either of type + # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::ListOperationsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload list_operations(name: nil, filter: nil, page_size: nil, page_token: nil, return_partial_success: nil) + # Pass arguments to `list_operations` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation's parent resource. + # @param filter [::String] + # The standard list filter. + # @param page_size [::Integer] + # The standard list page size. + # @param page_token [::String] + # The standard list page token. + # @param return_partial_success [::Boolean] + # When set to `true`, operations that are reachable are returned as normal, + # and those that are unreachable are returned in the + # [ListOperationsResponse.unreachable] field. + # + # This can only be `true` when reading across collections e.g. when `parent` + # is set to `"projects/example/locations/-"`. + # + # This field is not by default supported and will result in an + # `UNIMPLEMENTED` error if set unless explicitly documented otherwise in + # service or product specific documentation. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::ListOperationsRequest.new + # + # # Call the list_operations method. + # result = client.list_operations request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Longrunning::Operation. + # p item + # end + # + def list_operations request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::ListOperationsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.list_operations.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.list_operations.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.list_operations.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.list_operations request, options do |result, operation| + result = ::Gapic::Rest::PagedEnumerable.new @operations_stub, :list_operations, "operations", request, result, options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets the latest state of a long-running operation. Clients can use this + # method to poll the operation result at intervals as recommended by the API + # service. + # + # @overload get_operation(request, options = nil) + # Pass arguments to `get_operation` via a request object, either of type + # {::Google::Longrunning::GetOperationRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::GetOperationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload get_operation(name: nil) + # Pass arguments to `get_operation` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation resource. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::GetOperationRequest.new + # + # # Call the get_operation method. + # result = client.get_operation request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def get_operation request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::GetOperationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.get_operation.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.get_operation.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.get_operation.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.get_operation request, options do |result, operation| + result = ::Gapic::Operation.new result, @operations_client, options: options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Deletes a long-running operation. This method indicates that the client is + # no longer interested in the operation result. It does not cancel the + # operation. If the server doesn't support this method, it returns + # `google.rpc.Code.UNIMPLEMENTED`. + # + # @overload delete_operation(request, options = nil) + # Pass arguments to `delete_operation` via a request object, either of type + # {::Google::Longrunning::DeleteOperationRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::DeleteOperationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload delete_operation(name: nil) + # Pass arguments to `delete_operation` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation resource to be deleted. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Protobuf::Empty] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Protobuf::Empty] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::DeleteOperationRequest.new + # + # # Call the delete_operation method. + # result = client.delete_operation request + # + # # The returned object is of type Google::Protobuf::Empty. + # p result + # + def delete_operation request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::DeleteOperationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.delete_operation.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.delete_operation.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.delete_operation.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.delete_operation request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Starts asynchronous cancellation on a long-running operation. The server + # makes a best effort to cancel the operation, but success is not + # guaranteed. If the server doesn't support this method, it returns + # `google.rpc.Code.UNIMPLEMENTED`. Clients can use + # Operations.GetOperation or + # other methods to check whether the cancellation succeeded or whether the + # operation completed despite cancellation. On successful cancellation, + # the operation is not deleted; instead, it becomes an operation with + # an {::Google::Longrunning::Operation#error Operation.error} value with a + # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to + # `Code.CANCELLED`. + # + # @overload cancel_operation(request, options = nil) + # Pass arguments to `cancel_operation` via a request object, either of type + # {::Google::Longrunning::CancelOperationRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::CancelOperationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload cancel_operation(name: nil) + # Pass arguments to `cancel_operation` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation resource to be cancelled. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Protobuf::Empty] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Protobuf::Empty] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::CancelOperationRequest.new + # + # # Call the cancel_operation method. + # result = client.cancel_operation request + # + # # The returned object is of type Google::Protobuf::Empty. + # p result + # + def cancel_operation request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::CancelOperationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.cancel_operation.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.cancel_operation.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.cancel_operation.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.cancel_operation request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the Operations REST API. + # + # This class represents the configuration for Operations REST, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Longrunning::Operations::Rest::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # list_operations to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Longrunning::Operations::Rest::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.list_operations.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Longrunning::Operations::Rest::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.list_operations.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`String`) The path to a service account key file in JSON format + # * (`Hash`) A service account key as a Hash + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`nil`) indicating no credentials + # + # Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "retail.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration RPC class for the Operations API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `list_operations` + # @return [::Gapic::Config::Method] + # + attr_reader :list_operations + ## + # RPC-specific configuration for `get_operation` + # @return [::Gapic::Config::Method] + # + attr_reader :get_operation + ## + # RPC-specific configuration for `delete_operation` + # @return [::Gapic::Config::Method] + # + attr_reader :delete_operation + ## + # RPC-specific configuration for `cancel_operation` + # @return [::Gapic::Config::Method] + # + attr_reader :cancel_operation + + # @private + def initialize parent_rpcs = nil + list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations + @list_operations = ::Gapic::Config::Method.new list_operations_config + get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation + @get_operation = ::Gapic::Config::Method.new get_operation_config + delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation + @delete_operation = ::Gapic::Config::Method.new delete_operation_config + cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation + @cancel_operation = ::Gapic::Config::Method.new cancel_operation_config + + yield self if block_given? + end + end + end + end + + ## + # @private + # REST service stub for the Longrunning Operations API. + # Service stub contains baseline method implementations + # including transcoding, making the REST call, and deserialing the response. + class OperationsServiceStub + def initialize endpoint:, endpoint_template:, universe_domain:, credentials: + # These require statements are intentionally placed here to initialize + # the REST modules only when it's required. + require "gapic/rest" + + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials + end + + ## + # Baseline implementation for the list_operations REST call + # + # @param request_pb [::Google::Longrunning::ListOperationsRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::ListOperationsResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::ListOperationsResponse] + # A result object deserialized from the server's reply + def list_operations request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = OperationsServiceStub.transcode_list_operations_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "list_operations", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::ListOperationsResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the get_operation REST call + # + # @param request_pb [::Google::Longrunning::GetOperationRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::Operation] + # A result object deserialized from the server's reply + def get_operation request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = OperationsServiceStub.transcode_get_operation_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "get_operation", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the delete_operation REST call + # + # @param request_pb [::Google::Longrunning::DeleteOperationRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Protobuf::Empty] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Protobuf::Empty] + # A result object deserialized from the server's reply + def delete_operation request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = OperationsServiceStub.transcode_delete_operation_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "delete_operation", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the cancel_operation REST call + # + # @param request_pb [::Google::Longrunning::CancelOperationRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Protobuf::Empty] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Protobuf::Empty] + # A result object deserialized from the server's reply + def cancel_operation request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = OperationsServiceStub.transcode_cancel_operation_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "cancel_operation", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # @private + # + # GRPC transcoding helper method for the list_operations REST call + # + # @param request_pb [::Google::Longrunning::ListOperationsRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_list_operations_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v2/{name}/operations", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/?$}, false] + ] + ) + .with_bindings( + uri_method: :get, + uri_template: "/v2/{name}/operations", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] + ] + ) + .with_bindings( + uri_method: :get, + uri_template: "/v2/{name}/operations", + matches: [ + ["name", %r{^projects/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the get_operation REST call + # + # @param request_pb [::Google::Longrunning::GetOperationRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_get_operation_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v2/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/operations/[^/]+/?$}, false] + ] + ) + .with_bindings( + uri_method: :get, + uri_template: "/v2/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/branches/[^/]+/operations/[^/]+/?$}, false] + ] + ) + .with_bindings( + uri_method: :get, + uri_template: "/v2/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/operations/[^/]+/?$}, false] + ] + ) + .with_bindings( + uri_method: :get, + uri_template: "/v2/{name}", + matches: [ + ["name", %r{^projects/[^/]+/operations/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the delete_operation REST call + # + # @param request_pb [::Google::Longrunning::DeleteOperationRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_delete_operation_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :delete, + uri_template: "/v1/{name}", + matches: [ + ["name", %r{^operations(?:/(?<__wildcard__>.*))?$}, true] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the cancel_operation REST call + # + # @param request_pb [::Google::Longrunning::CancelOperationRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_cancel_operation_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/{name}:cancel", + body: "*", + matches: [ + ["name", %r{^operations(?:/(?<__wildcard__>.*))?$}, true] + ] + ) + transcoder.transcode request_pb + end + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/rest/service_stub.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/rest/service_stub.rb new file mode 100644 index 000000000000..b35aff3ed4cc --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/rest/service_stub.rb @@ -0,0 +1,143 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/retail/v2/analytics_service_pb" + +module Google + module Cloud + module Retail + module V2 + module AnalyticsService + module Rest + ## + # REST service stub for the AnalyticsService service. + # Service stub contains baseline method implementations + # including transcoding, making the REST call, and deserialing the response. + # + class ServiceStub + # @private + def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger: + # These require statements are intentionally placed here to initialize + # the REST modules only when it's required. + require "gapic/rest" + + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials, + numeric_enums: true, + service_name: self.class, + raise_faraday_errors: false, + logger: logger + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @client_stub.universe_domain + end + + ## + # The effective endpoint + # + # @return [String] + # + def endpoint + @client_stub.endpoint + end + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger stub: false + stub ? @client_stub.stub_logger : @client_stub.logger + end + + ## + # Baseline implementation for the export_analytics_metrics REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::ExportAnalyticsMetricsRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::Operation] + # A result object deserialized from the server's reply + def export_analytics_metrics request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_export_analytics_metrics_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "export_analytics_metrics", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # @private + # + # GRPC transcoding helper method for the export_analytics_metrics REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::ExportAnalyticsMetricsRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_export_analytics_metrics_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v2/{catalog}:exportAnalyticsMetrics", + body: "*", + matches: [ + ["catalog", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service_pb.rb new file mode 100644 index 000000000000..8ce3ddaf6f69 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service_pb.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/retail/v2/analytics_service.proto + +require 'google/protobuf' + +require 'google/api/annotations_pb' +require 'google/api/client_pb' +require 'google/api/field_behavior_pb' +require 'google/api/resource_pb' +require 'google/cloud/retail/v2/export_config_pb' +require 'google/longrunning/operations_pb' + + +descriptor_data = "\n.google/cloud/retail/v2/analytics_service.proto\x12\x16google.cloud.retail.v2\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a*google/cloud/retail/v2/export_config.proto\x1a#google/longrunning/operations.proto2\x83\x03\n\x10\x41nalyticsService\x12\xa3\x02\n\x16\x45xportAnalyticsMetrics\x12\x35.google.cloud.retail.v2.ExportAnalyticsMetricsRequest\x1a\x1d.google.longrunning.Operation\"\xb2\x01\xca\x41^\n5google.cloud.retail.v2.ExportAnalyticsMetricsResponse\x12%google.cloud.retail.v2.ExportMetadata\x82\xd3\xe4\x93\x02K\"F/v2/{catalog=projects/*/locations/*/catalogs/*}:exportAnalyticsMetrics:\x01*\x1aI\xca\x41\x15retail.googleapis.com\xd2\x41.https://www.googleapis.com/auth/cloud-platformB\xc0\x01\n\x1a\x63om.google.cloud.retail.v2B\x15\x41nalyticsServiceProtoP\x01Z2cloud.google.com/go/retail/apiv2/retailpb;retailpb\xa2\x02\x06RETAIL\xaa\x02\x16Google.Cloud.Retail.V2\xca\x02\x16Google\\Cloud\\Retail\\V2\xea\x02\x19Google::Cloud::Retail::V2b\x06proto3" + +pool = ::Google::Protobuf::DescriptorPool.generated_pool +pool.add_serialized_file(descriptor_data) + +module Google + module Cloud + module Retail + module V2 + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service_services_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service_services_pb.rb new file mode 100644 index 000000000000..b9425168a3f7 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service_services_pb.rb @@ -0,0 +1,49 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# Source: google/cloud/retail/v2/analytics_service.proto for package 'Google.Cloud.Retail.V2' +# Original file comments: +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +require 'grpc' +require 'google/cloud/retail/v2/analytics_service_pb' + +module Google + module Cloud + module Retail + module V2 + module AnalyticsService + # Service for managing & accessing retail search business metric. + # Retail recommendation business metric is currently not available. + class Service + + include ::GRPC::GenericService + + self.marshal_class_method = :encode + self.unmarshal_class_method = :decode + self.service_name = 'google.cloud.retail.v2.AnalyticsService' + + # Exports analytics metrics. + # + # `Operation.response` is of type `ExportAnalyticsMetricsResponse`. + # `Operation.metadata` is of type `ExportMetadata`. + rpc :ExportAnalyticsMetrics, ::Google::Cloud::Retail::V2::ExportAnalyticsMetricsRequest, ::Google::Longrunning::Operation + end + + Stub = Service.rpc_stub_class + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_pb.rb new file mode 100644 index 000000000000..251f19b9f439 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_pb.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/retail/v2/catalog.proto + +require 'google/protobuf' + +require 'google/api/field_behavior_pb' +require 'google/api/resource_pb' +require 'google/cloud/retail/v2/common_pb' +require 'google/cloud/retail/v2/import_config_pb' +require 'google/protobuf/timestamp_pb' + + +descriptor_data = "\n$google/cloud/retail/v2/catalog.proto\x12\x16google.cloud.retail.v2\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a#google/cloud/retail/v2/common.proto\x1a*google/cloud/retail/v2/import_config.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"^\n\x12ProductLevelConfig\x12\x1e\n\x16ingestion_product_type\x18\x01 \x01(\t\x12(\n merchant_center_product_id_field\x18\x02 \x01(\t\"\xf7\x0f\n\x10\x43\x61talogAttribute\x12\x10\n\x03key\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x13\n\x06in_use\x18\t \x01(\x08\x42\x03\xe0\x41\x03\x12I\n\x04type\x18\n \x01(\x0e\x32\x36.google.cloud.retail.v2.CatalogAttribute.AttributeTypeB\x03\xe0\x41\x03\x12R\n\x10indexable_option\x18\x05 \x01(\x0e\x32\x38.google.cloud.retail.v2.CatalogAttribute.IndexableOption\x12\x61\n\x18\x64ynamic_facetable_option\x18\x06 \x01(\x0e\x32?.google.cloud.retail.v2.CatalogAttribute.DynamicFacetableOption\x12T\n\x11searchable_option\x18\x07 \x01(\x0e\x32\x39.google.cloud.retail.v2.CatalogAttribute.SearchableOption\x12_\n\x17\x65xact_searchable_option\x18\x0b \x01(\x0e\x32>.google.cloud.retail.v2.CatalogAttribute.ExactSearchableOption\x12V\n\x12retrievable_option\x18\x0c \x01(\x0e\x32:.google.cloud.retail.v2.CatalogAttribute.RetrievableOption\x12J\n\x0c\x66\x61\x63\x65t_config\x18\r \x01(\x0b\x32\x34.google.cloud.retail.v2.CatalogAttribute.FacetConfig\x1a\xe9\x05\n\x0b\x46\x61\x63\x65tConfig\x12\x39\n\x0f\x66\x61\x63\x65t_intervals\x18\x01 \x03(\x0b\x32 .google.cloud.retail.v2.Interval\x12\x65\n\x14ignored_facet_values\x18\x02 \x03(\x0b\x32G.google.cloud.retail.v2.CatalogAttribute.FacetConfig.IgnoredFacetValues\x12\x62\n\x13merged_facet_values\x18\x03 \x03(\x0b\x32\x45.google.cloud.retail.v2.CatalogAttribute.FacetConfig.MergedFacetValue\x12V\n\x0cmerged_facet\x18\x04 \x01(\x0b\x32@.google.cloud.retail.v2.CatalogAttribute.FacetConfig.MergedFacet\x12X\n\rrerank_config\x18\x05 \x01(\x0b\x32\x41.google.cloud.retail.v2.CatalogAttribute.FacetConfig.RerankConfig\x1a\x82\x01\n\x12IgnoredFacetValues\x12\x0e\n\x06values\x18\x01 \x03(\t\x12.\n\nstart_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12,\n\x08\x65nd_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x1a\x38\n\x10MergedFacetValue\x12\x0e\n\x06values\x18\x01 \x03(\t\x12\x14\n\x0cmerged_value\x18\x02 \x01(\t\x1a\'\n\x0bMergedFacet\x12\x18\n\x10merged_facet_key\x18\x01 \x01(\t\x1a:\n\x0cRerankConfig\x12\x14\n\x0crerank_facet\x18\x01 \x01(\x08\x12\x14\n\x0c\x66\x61\x63\x65t_values\x18\x02 \x03(\t\"8\n\rAttributeType\x12\x0b\n\x07UNKNOWN\x10\x00\x12\x0b\n\x07TEXTUAL\x10\x01\x12\r\n\tNUMERICAL\x10\x02\"b\n\x0fIndexableOption\x12 \n\x1cINDEXABLE_OPTION_UNSPECIFIED\x10\x00\x12\x15\n\x11INDEXABLE_ENABLED\x10\x01\x12\x16\n\x12INDEXABLE_DISABLED\x10\x02\"\x81\x01\n\x16\x44ynamicFacetableOption\x12(\n$DYNAMIC_FACETABLE_OPTION_UNSPECIFIED\x10\x00\x12\x1d\n\x19\x44YNAMIC_FACETABLE_ENABLED\x10\x01\x12\x1e\n\x1a\x44YNAMIC_FACETABLE_DISABLED\x10\x02\"f\n\x10SearchableOption\x12!\n\x1dSEARCHABLE_OPTION_UNSPECIFIED\x10\x00\x12\x16\n\x12SEARCHABLE_ENABLED\x10\x01\x12\x17\n\x13SEARCHABLE_DISABLED\x10\x02\"}\n\x15\x45xactSearchableOption\x12\'\n#EXACT_SEARCHABLE_OPTION_UNSPECIFIED\x10\x00\x12\x1c\n\x18\x45XACT_SEARCHABLE_ENABLED\x10\x01\x12\x1d\n\x19\x45XACT_SEARCHABLE_DISABLED\x10\x02\"j\n\x11RetrievableOption\x12\"\n\x1eRETRIEVABLE_OPTION_UNSPECIFIED\x10\x00\x12\x17\n\x13RETRIEVABLE_ENABLED\x10\x01\x12\x18\n\x14RETRIEVABLE_DISABLED\x10\x02\"\xb6\x03\n\x10\x41ttributesConfig\x12\x14\n\x04name\x18\x01 \x01(\tB\x06\xe0\x41\x02\xe0\x41\x05\x12[\n\x12\x63\x61talog_attributes\x18\x02 \x03(\x0b\x32?.google.cloud.retail.v2.AttributesConfig.CatalogAttributesEntry\x12Q\n\x16\x61ttribute_config_level\x18\x03 \x01(\x0e\x32,.google.cloud.retail.v2.AttributeConfigLevelB\x03\xe0\x41\x03\x1a\x62\n\x16\x43\x61talogAttributesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x37\n\x05value\x18\x02 \x01(\x0b\x32(.google.cloud.retail.v2.CatalogAttribute:\x02\x38\x01:x\xea\x41u\n&retail.googleapis.com/AttributesConfig\x12Kprojects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig\"\x99\x05\n\x10\x43ompletionConfig\x12\x14\n\x04name\x18\x01 \x01(\tB\x06\xe0\x41\x02\xe0\x41\x05\x12\x16\n\x0ematching_order\x18\x02 \x01(\t\x12\x17\n\x0fmax_suggestions\x18\x03 \x01(\x05\x12\x19\n\x11min_prefix_length\x18\x04 \x01(\x05\x12\x15\n\rauto_learning\x18\x0b \x01(\x08\x12X\n\x18suggestions_input_config\x18\x05 \x01(\x0b\x32\x31.google.cloud.retail.v2.CompletionDataInputConfigB\x03\xe0\x41\x03\x12.\n!last_suggestions_import_operation\x18\x06 \x01(\tB\x03\xe0\x41\x03\x12U\n\x15\x64\x65nylist_input_config\x18\x07 \x01(\x0b\x32\x31.google.cloud.retail.v2.CompletionDataInputConfigB\x03\xe0\x41\x03\x12+\n\x1elast_denylist_import_operation\x18\x08 \x01(\tB\x03\xe0\x41\x03\x12V\n\x16\x61llowlist_input_config\x18\t \x01(\x0b\x32\x31.google.cloud.retail.v2.CompletionDataInputConfigB\x03\xe0\x41\x03\x12,\n\x1flast_allowlist_import_operation\x18\n \x01(\tB\x03\xe0\x41\x03:x\xea\x41u\n&retail.googleapis.com/CompletionConfig\x12Kprojects/{project}/locations/{location}/catalogs/{catalog}/completionConfig\"\xec\x01\n\x07\x43\x61talog\x12\x14\n\x04name\x18\x01 \x01(\tB\x06\xe0\x41\x02\xe0\x41\x05\x12\x1c\n\x0c\x64isplay_name\x18\x02 \x01(\tB\x06\xe0\x41\x02\xe0\x41\x05\x12M\n\x14product_level_config\x18\x04 \x01(\x0b\x32*.google.cloud.retail.v2.ProductLevelConfigB\x03\xe0\x41\x02:^\xea\x41[\n\x1dretail.googleapis.com/Catalog\x12:projects/{project}/locations/{location}/catalogs/{catalog}B\xb7\x01\n\x1a\x63om.google.cloud.retail.v2B\x0c\x43\x61talogProtoP\x01Z2cloud.google.com/go/retail/apiv2/retailpb;retailpb\xa2\x02\x06RETAIL\xaa\x02\x16Google.Cloud.Retail.V2\xca\x02\x16Google\\Cloud\\Retail\\V2\xea\x02\x19Google::Cloud::Retail::V2b\x06proto3" + +pool = ::Google::Protobuf::DescriptorPool.generated_pool +pool.add_serialized_file(descriptor_data) + +module Google + module Cloud + module Retail + module V2 + ProductLevelConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ProductLevelConfig").msgclass + CatalogAttribute = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CatalogAttribute").msgclass + CatalogAttribute::FacetConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CatalogAttribute.FacetConfig").msgclass + CatalogAttribute::FacetConfig::IgnoredFacetValues = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CatalogAttribute.FacetConfig.IgnoredFacetValues").msgclass + CatalogAttribute::FacetConfig::MergedFacetValue = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CatalogAttribute.FacetConfig.MergedFacetValue").msgclass + CatalogAttribute::FacetConfig::MergedFacet = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CatalogAttribute.FacetConfig.MergedFacet").msgclass + CatalogAttribute::FacetConfig::RerankConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CatalogAttribute.FacetConfig.RerankConfig").msgclass + CatalogAttribute::AttributeType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CatalogAttribute.AttributeType").enummodule + CatalogAttribute::IndexableOption = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CatalogAttribute.IndexableOption").enummodule + CatalogAttribute::DynamicFacetableOption = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CatalogAttribute.DynamicFacetableOption").enummodule + CatalogAttribute::SearchableOption = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CatalogAttribute.SearchableOption").enummodule + CatalogAttribute::ExactSearchableOption = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CatalogAttribute.ExactSearchableOption").enummodule + CatalogAttribute::RetrievableOption = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CatalogAttribute.RetrievableOption").enummodule + AttributesConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.AttributesConfig").msgclass + CompletionConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CompletionConfig").msgclass + Catalog = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Catalog").msgclass + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service.rb new file mode 100644 index 000000000000..a11f97aecb81 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service.rb @@ -0,0 +1,55 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/common" +require "gapic/config" +require "gapic/config/method" + +require "google/cloud/retail/v2/version" + +require "google/cloud/retail/v2/catalog_service/credentials" +require "google/cloud/retail/v2/catalog_service/paths" +require "google/cloud/retail/v2/catalog_service/client" +require "google/cloud/retail/v2/catalog_service/rest" + +module Google + module Cloud + module Retail + module V2 + ## + # Service for managing catalog configuration. + # + # @example Load this service and instantiate a gRPC client + # + # require "google/cloud/retail/v2/catalog_service" + # client = ::Google::Cloud::Retail::V2::CatalogService::Client.new + # + # @example Load this service and instantiate a REST client + # + # require "google/cloud/retail/v2/catalog_service/rest" + # client = ::Google::Cloud::Retail::V2::CatalogService::Rest::Client.new + # + module CatalogService + end + end + end + end +end + +helper_path = ::File.join __dir__, "catalog_service", "helpers.rb" +require "google/cloud/retail/v2/catalog_service/helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/client.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/client.rb new file mode 100644 index 000000000000..47fce9e01293 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/client.rb @@ -0,0 +1,1590 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/cloud/retail/v2/catalog_service_pb" +require "google/cloud/location" + +module Google + module Cloud + module Retail + module V2 + module CatalogService + ## + # Client for the CatalogService service. + # + # Service for managing catalog configuration. + # + class Client + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" + + include Paths + + # @private + attr_reader :catalog_service_stub + + ## + # Configure the CatalogService Client class. + # + # See {::Google::Cloud::Retail::V2::CatalogService::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all CatalogService clients + # ::Google::Cloud::Retail::V2::CatalogService::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "Retail", "V2"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config.timeout = 5.0 + default_config.retry_policy = { + initial_delay: 0.1, max_delay: 5.0, multiplier: 1.3, retry_codes: [14, 4] + } + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the CatalogService Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Cloud::Retail::V2::CatalogService::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @catalog_service_stub.universe_domain + end + + ## + # Create a new CatalogService client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::Retail::V2::CatalogService::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::Retail::V2::CatalogService::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the CatalogService client. + # @yieldparam config [Client::Configuration] + # + def initialize + # These require statements are intentionally placed here to initialize + # the gRPC module only when it's required. + # See https://github.com/googleapis/toolkit/issues/446 + require "gapic/grpc" + require "google/cloud/retail/v2/catalog_service_services_pb" + + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @catalog_service_stub = ::Gapic::ServiceStub.new( + ::Google::Cloud::Retail::V2::CatalogService::Stub, + credentials: credentials, + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + channel_args: @config.channel_args, + interceptors: @config.interceptors, + channel_pool_config: @config.channel_pool, + logger: @config.logger + ) + + @catalog_service_stub.stub_logger&.info do |entry| + entry.set_system_name + entry.set_service + entry.message = "Created client for #{entry.service}" + entry.set_credentials_fields credentials + entry.set "customEndpoint", @config.endpoint if @config.endpoint + entry.set "defaultTimeout", @config.timeout if @config.timeout + entry.set "quotaProject", @quota_project_id if @quota_project_id + end + + @location_client = Google::Cloud::Location::Locations::Client.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @catalog_service_stub.endpoint + config.universe_domain = @catalog_service_stub.universe_domain + config.logger = @catalog_service_stub.logger if config.respond_to? :logger= + end + end + + ## + # Get the associated client for mix-in of the Locations. + # + # @return [Google::Cloud::Location::Locations::Client] + # + attr_reader :location_client + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @catalog_service_stub.logger + end + + # Service calls + + ## + # Lists all the {::Google::Cloud::Retail::V2::Catalog Catalog}s associated with + # the project. + # + # @overload list_catalogs(request, options = nil) + # Pass arguments to `list_catalogs` via a request object, either of type + # {::Google::Cloud::Retail::V2::ListCatalogsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::ListCatalogsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload list_catalogs(parent: nil, page_size: nil, page_token: nil) + # Pass arguments to `list_catalogs` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. The account resource name with an associated location. + # + # If the caller does not have permission to list + # {::Google::Cloud::Retail::V2::Catalog Catalog}s under this location, regardless + # of whether or not this location exists, a PERMISSION_DENIED error is + # returned. + # @param page_size [::Integer] + # Maximum number of {::Google::Cloud::Retail::V2::Catalog Catalog}s to return. If + # unspecified, defaults to 50. The maximum allowed value is 1000. Values + # above 1000 will be coerced to 1000. + # + # If this field is negative, an INVALID_ARGUMENT is returned. + # @param page_token [::String] + # A page token + # {::Google::Cloud::Retail::V2::ListCatalogsResponse#next_page_token ListCatalogsResponse.next_page_token}, + # received from a previous + # {::Google::Cloud::Retail::V2::CatalogService::Client#list_catalogs CatalogService.ListCatalogs} + # call. Provide this to retrieve the subsequent page. + # + # When paginating, all other parameters provided to + # {::Google::Cloud::Retail::V2::CatalogService::Client#list_catalogs CatalogService.ListCatalogs} + # must match the call that provided the page token. Otherwise, an + # INVALID_ARGUMENT error is returned. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Retail::V2::Catalog>] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::PagedEnumerable<::Google::Cloud::Retail::V2::Catalog>] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::CatalogService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::ListCatalogsRequest.new + # + # # Call the list_catalogs method. + # result = client.list_catalogs request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Cloud::Retail::V2::Catalog. + # p item + # end + # + def list_catalogs request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ListCatalogsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.list_catalogs.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.list_catalogs.timeout, + metadata: metadata, + retry_policy: @config.rpcs.list_catalogs.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @catalog_service_stub.call_rpc :list_catalogs, request, options: options do |response, operation| + response = ::Gapic::PagedEnumerable.new @catalog_service_stub, :list_catalogs, request, response, operation, options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Updates the {::Google::Cloud::Retail::V2::Catalog Catalog}s. + # + # @overload update_catalog(request, options = nil) + # Pass arguments to `update_catalog` via a request object, either of type + # {::Google::Cloud::Retail::V2::UpdateCatalogRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::UpdateCatalogRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload update_catalog(catalog: nil, update_mask: nil) + # Pass arguments to `update_catalog` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param catalog [::Google::Cloud::Retail::V2::Catalog, ::Hash] + # Required. The {::Google::Cloud::Retail::V2::Catalog Catalog} to update. + # + # If the caller does not have permission to update the + # {::Google::Cloud::Retail::V2::Catalog Catalog}, regardless of whether or not it + # exists, a PERMISSION_DENIED error is returned. + # + # If the {::Google::Cloud::Retail::V2::Catalog Catalog} to update does not exist, + # a NOT_FOUND error is returned. + # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] + # Indicates which fields in the provided + # {::Google::Cloud::Retail::V2::Catalog Catalog} to update. + # + # If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + # is returned. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Retail::V2::Catalog] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Retail::V2::Catalog] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::CatalogService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::UpdateCatalogRequest.new + # + # # Call the update_catalog method. + # result = client.update_catalog request + # + # # The returned object is of type Google::Cloud::Retail::V2::Catalog. + # p result + # + def update_catalog request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::UpdateCatalogRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.update_catalog.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.catalog&.name + header_params["catalog.name"] = request.catalog.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.update_catalog.timeout, + metadata: metadata, + retry_policy: @config.rpcs.update_catalog.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @catalog_service_stub.call_rpc :update_catalog, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Set a specified branch id as default branch. API methods such as + # {::Google::Cloud::Retail::V2::SearchService::Client#search SearchService.Search}, + # {::Google::Cloud::Retail::V2::ProductService::Client#get_product ProductService.GetProduct}, + # {::Google::Cloud::Retail::V2::ProductService::Client#list_products ProductService.ListProducts} + # will treat requests using "default_branch" to the actual branch id set as + # default. + # + # For example, if `projects/*/locations/*/catalogs/*/branches/1` is set as + # default, setting + # {::Google::Cloud::Retail::V2::SearchRequest#branch SearchRequest.branch} to + # `projects/*/locations/*/catalogs/*/branches/default_branch` is equivalent + # to setting + # {::Google::Cloud::Retail::V2::SearchRequest#branch SearchRequest.branch} to + # `projects/*/locations/*/catalogs/*/branches/1`. + # + # Using multiple branches can be useful when developers would like + # to have a staging branch to test and verify for future usage. When it + # becomes ready, developers switch on the staging branch using this API + # while keeping using + # `projects/*/locations/*/catalogs/*/branches/default_branch` as + # {::Google::Cloud::Retail::V2::SearchRequest#branch SearchRequest.branch} to + # route the traffic to this staging branch. + # + # CAUTION: If you have live predict/search traffic, switching the default + # branch could potentially cause outages if the ID space of the new branch + # is very different from the old one. + # + # More specifically: + # + # * PredictionService will only return product IDs from branch \\{newBranch}. + # * SearchService will only return product IDs from branch \\{newBranch} + # (if branch is not explicitly set). + # * UserEventService will only join events with products from branch + # \\{newBranch}. + # + # @overload set_default_branch(request, options = nil) + # Pass arguments to `set_default_branch` via a request object, either of type + # {::Google::Cloud::Retail::V2::SetDefaultBranchRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::SetDefaultBranchRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload set_default_branch(catalog: nil, branch_id: nil, note: nil, force: nil) + # Pass arguments to `set_default_branch` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param catalog [::String] + # Full resource name of the catalog, such as + # `projects/*/locations/global/catalogs/default_catalog`. + # @param branch_id [::String] + # The final component of the resource name of a branch. + # + # This field must be one of "0", "1" or "2". Otherwise, an INVALID_ARGUMENT + # error is returned. + # + # If there are no sufficient active products in the targeted branch and + # {::Google::Cloud::Retail::V2::SetDefaultBranchRequest#force force} is not set, a + # FAILED_PRECONDITION error is returned. + # @param note [::String] + # Some note on this request, this can be retrieved by + # {::Google::Cloud::Retail::V2::CatalogService::Client#get_default_branch CatalogService.GetDefaultBranch} + # before next valid default branch set occurs. + # + # This field must be a UTF-8 encoded string with a length limit of 1,000 + # characters. Otherwise, an INVALID_ARGUMENT error is returned. + # @param force [::Boolean] + # If set to true, it permits switching to a branch with + # {::Google::Cloud::Retail::V2::SetDefaultBranchRequest#branch_id branch_id} even + # if it has no sufficient active products. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Protobuf::Empty] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Protobuf::Empty] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::CatalogService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::SetDefaultBranchRequest.new + # + # # Call the set_default_branch method. + # result = client.set_default_branch request + # + # # The returned object is of type Google::Protobuf::Empty. + # p result + # + def set_default_branch request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::SetDefaultBranchRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.set_default_branch.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.catalog + header_params["catalog"] = request.catalog + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.set_default_branch.timeout, + metadata: metadata, + retry_policy: @config.rpcs.set_default_branch.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @catalog_service_stub.call_rpc :set_default_branch, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Get which branch is currently default branch set by + # {::Google::Cloud::Retail::V2::CatalogService::Client#set_default_branch CatalogService.SetDefaultBranch} + # method under a specified parent catalog. + # + # @overload get_default_branch(request, options = nil) + # Pass arguments to `get_default_branch` via a request object, either of type + # {::Google::Cloud::Retail::V2::GetDefaultBranchRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::GetDefaultBranchRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload get_default_branch(catalog: nil) + # Pass arguments to `get_default_branch` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param catalog [::String] + # The parent catalog resource name, such as + # `projects/*/locations/global/catalogs/default_catalog`. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Retail::V2::GetDefaultBranchResponse] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Retail::V2::GetDefaultBranchResponse] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::CatalogService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::GetDefaultBranchRequest.new + # + # # Call the get_default_branch method. + # result = client.get_default_branch request + # + # # The returned object is of type Google::Cloud::Retail::V2::GetDefaultBranchResponse. + # p result + # + def get_default_branch request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::GetDefaultBranchRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.get_default_branch.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.catalog + header_params["catalog"] = request.catalog + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.get_default_branch.timeout, + metadata: metadata, + retry_policy: @config.rpcs.get_default_branch.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @catalog_service_stub.call_rpc :get_default_branch, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets a {::Google::Cloud::Retail::V2::CompletionConfig CompletionConfig}. + # + # @overload get_completion_config(request, options = nil) + # Pass arguments to `get_completion_config` via a request object, either of type + # {::Google::Cloud::Retail::V2::GetCompletionConfigRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::GetCompletionConfigRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload get_completion_config(name: nil) + # Pass arguments to `get_completion_config` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. Full CompletionConfig resource name. Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig` + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Retail::V2::CompletionConfig] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Retail::V2::CompletionConfig] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::CatalogService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::GetCompletionConfigRequest.new + # + # # Call the get_completion_config method. + # result = client.get_completion_config request + # + # # The returned object is of type Google::Cloud::Retail::V2::CompletionConfig. + # p result + # + def get_completion_config request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::GetCompletionConfigRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.get_completion_config.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.get_completion_config.timeout, + metadata: metadata, + retry_policy: @config.rpcs.get_completion_config.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @catalog_service_stub.call_rpc :get_completion_config, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Updates the {::Google::Cloud::Retail::V2::CompletionConfig CompletionConfig}s. + # + # @overload update_completion_config(request, options = nil) + # Pass arguments to `update_completion_config` via a request object, either of type + # {::Google::Cloud::Retail::V2::UpdateCompletionConfigRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::UpdateCompletionConfigRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload update_completion_config(completion_config: nil, update_mask: nil) + # Pass arguments to `update_completion_config` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param completion_config [::Google::Cloud::Retail::V2::CompletionConfig, ::Hash] + # Required. The {::Google::Cloud::Retail::V2::CompletionConfig CompletionConfig} + # to update. + # + # If the caller does not have permission to update the + # {::Google::Cloud::Retail::V2::CompletionConfig CompletionConfig}, then a + # PERMISSION_DENIED error is returned. + # + # If the {::Google::Cloud::Retail::V2::CompletionConfig CompletionConfig} to + # update does not exist, a NOT_FOUND error is returned. + # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] + # Indicates which fields in the provided + # {::Google::Cloud::Retail::V2::CompletionConfig CompletionConfig} to update. The + # following are the only supported fields: + # + # * {::Google::Cloud::Retail::V2::CompletionConfig#matching_order CompletionConfig.matching_order} + # * {::Google::Cloud::Retail::V2::CompletionConfig#max_suggestions CompletionConfig.max_suggestions} + # * {::Google::Cloud::Retail::V2::CompletionConfig#min_prefix_length CompletionConfig.min_prefix_length} + # * {::Google::Cloud::Retail::V2::CompletionConfig#auto_learning CompletionConfig.auto_learning} + # + # If not set, all supported fields are updated. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Retail::V2::CompletionConfig] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Retail::V2::CompletionConfig] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::CatalogService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::UpdateCompletionConfigRequest.new + # + # # Call the update_completion_config method. + # result = client.update_completion_config request + # + # # The returned object is of type Google::Cloud::Retail::V2::CompletionConfig. + # p result + # + def update_completion_config request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::UpdateCompletionConfigRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.update_completion_config.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.completion_config&.name + header_params["completion_config.name"] = request.completion_config.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.update_completion_config.timeout, + metadata: metadata, + retry_policy: @config.rpcs.update_completion_config.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @catalog_service_stub.call_rpc :update_completion_config, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets an {::Google::Cloud::Retail::V2::AttributesConfig AttributesConfig}. + # + # @overload get_attributes_config(request, options = nil) + # Pass arguments to `get_attributes_config` via a request object, either of type + # {::Google::Cloud::Retail::V2::GetAttributesConfigRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::GetAttributesConfigRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload get_attributes_config(name: nil) + # Pass arguments to `get_attributes_config` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. Full AttributesConfig resource name. Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Retail::V2::AttributesConfig] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Retail::V2::AttributesConfig] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::CatalogService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::GetAttributesConfigRequest.new + # + # # Call the get_attributes_config method. + # result = client.get_attributes_config request + # + # # The returned object is of type Google::Cloud::Retail::V2::AttributesConfig. + # p result + # + def get_attributes_config request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::GetAttributesConfigRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.get_attributes_config.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.get_attributes_config.timeout, + metadata: metadata, + retry_policy: @config.rpcs.get_attributes_config.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @catalog_service_stub.call_rpc :get_attributes_config, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Updates the {::Google::Cloud::Retail::V2::AttributesConfig AttributesConfig}. + # + # The catalog attributes in the request will be updated in the catalog, or + # inserted if they do not exist. Existing catalog attributes not included in + # the request will remain unchanged. Attributes that are assigned to + # products, but do not exist at the catalog level, are always included in the + # response. The product attribute is assigned default values for missing + # catalog attribute fields, e.g., searchable and dynamic facetable options. + # + # @overload update_attributes_config(request, options = nil) + # Pass arguments to `update_attributes_config` via a request object, either of type + # {::Google::Cloud::Retail::V2::UpdateAttributesConfigRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::UpdateAttributesConfigRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload update_attributes_config(attributes_config: nil, update_mask: nil) + # Pass arguments to `update_attributes_config` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param attributes_config [::Google::Cloud::Retail::V2::AttributesConfig, ::Hash] + # Required. The {::Google::Cloud::Retail::V2::AttributesConfig AttributesConfig} + # to update. + # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] + # Indicates which fields in the provided + # {::Google::Cloud::Retail::V2::AttributesConfig AttributesConfig} to update. The + # following is the only supported field: + # + # * {::Google::Cloud::Retail::V2::AttributesConfig#catalog_attributes AttributesConfig.catalog_attributes} + # + # If not set, all supported fields are updated. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Retail::V2::AttributesConfig] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Retail::V2::AttributesConfig] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::CatalogService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::UpdateAttributesConfigRequest.new + # + # # Call the update_attributes_config method. + # result = client.update_attributes_config request + # + # # The returned object is of type Google::Cloud::Retail::V2::AttributesConfig. + # p result + # + def update_attributes_config request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::UpdateAttributesConfigRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.update_attributes_config.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.attributes_config&.name + header_params["attributes_config.name"] = request.attributes_config.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.update_attributes_config.timeout, + metadata: metadata, + retry_policy: @config.rpcs.update_attributes_config.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @catalog_service_stub.call_rpc :update_attributes_config, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Adds the specified + # {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} to the + # {::Google::Cloud::Retail::V2::AttributesConfig AttributesConfig}. + # + # If the {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} to add + # already exists, an ALREADY_EXISTS error is returned. + # + # @overload add_catalog_attribute(request, options = nil) + # Pass arguments to `add_catalog_attribute` via a request object, either of type + # {::Google::Cloud::Retail::V2::AddCatalogAttributeRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::AddCatalogAttributeRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload add_catalog_attribute(attributes_config: nil, catalog_attribute: nil) + # Pass arguments to `add_catalog_attribute` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param attributes_config [::String] + # Required. Full AttributesConfig resource name. Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` + # @param catalog_attribute [::Google::Cloud::Retail::V2::CatalogAttribute, ::Hash] + # Required. The {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} + # to add. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Retail::V2::AttributesConfig] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Retail::V2::AttributesConfig] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::CatalogService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::AddCatalogAttributeRequest.new + # + # # Call the add_catalog_attribute method. + # result = client.add_catalog_attribute request + # + # # The returned object is of type Google::Cloud::Retail::V2::AttributesConfig. + # p result + # + def add_catalog_attribute request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::AddCatalogAttributeRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.add_catalog_attribute.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.attributes_config + header_params["attributes_config"] = request.attributes_config + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.add_catalog_attribute.timeout, + metadata: metadata, + retry_policy: @config.rpcs.add_catalog_attribute.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @catalog_service_stub.call_rpc :add_catalog_attribute, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Removes the specified + # {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} from the + # {::Google::Cloud::Retail::V2::AttributesConfig AttributesConfig}. + # + # If the {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} to + # remove does not exist, a NOT_FOUND error is returned. + # + # @overload remove_catalog_attribute(request, options = nil) + # Pass arguments to `remove_catalog_attribute` via a request object, either of type + # {::Google::Cloud::Retail::V2::RemoveCatalogAttributeRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::RemoveCatalogAttributeRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload remove_catalog_attribute(attributes_config: nil, key: nil) + # Pass arguments to `remove_catalog_attribute` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param attributes_config [::String] + # Required. Full AttributesConfig resource name. Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` + # @param key [::String] + # Required. The attribute name key of the + # {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} to remove. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Retail::V2::AttributesConfig] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Retail::V2::AttributesConfig] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::CatalogService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::RemoveCatalogAttributeRequest.new + # + # # Call the remove_catalog_attribute method. + # result = client.remove_catalog_attribute request + # + # # The returned object is of type Google::Cloud::Retail::V2::AttributesConfig. + # p result + # + def remove_catalog_attribute request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::RemoveCatalogAttributeRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.remove_catalog_attribute.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.attributes_config + header_params["attributes_config"] = request.attributes_config + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.remove_catalog_attribute.timeout, + metadata: metadata, + retry_policy: @config.rpcs.remove_catalog_attribute.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @catalog_service_stub.call_rpc :remove_catalog_attribute, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Replaces the specified + # {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} in the + # {::Google::Cloud::Retail::V2::AttributesConfig AttributesConfig} by updating the + # catalog attribute with the same + # {::Google::Cloud::Retail::V2::CatalogAttribute#key CatalogAttribute.key}. + # + # If the {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} to + # replace does not exist, a NOT_FOUND error is returned. + # + # @overload replace_catalog_attribute(request, options = nil) + # Pass arguments to `replace_catalog_attribute` via a request object, either of type + # {::Google::Cloud::Retail::V2::ReplaceCatalogAttributeRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::ReplaceCatalogAttributeRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload replace_catalog_attribute(attributes_config: nil, catalog_attribute: nil, update_mask: nil) + # Pass arguments to `replace_catalog_attribute` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param attributes_config [::String] + # Required. Full AttributesConfig resource name. Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` + # @param catalog_attribute [::Google::Cloud::Retail::V2::CatalogAttribute, ::Hash] + # Required. The updated + # {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute}. + # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] + # Indicates which fields in the provided + # {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} to update. The + # following are NOT supported: + # + # * {::Google::Cloud::Retail::V2::CatalogAttribute#key CatalogAttribute.key} + # + # If not set, all supported fields are updated. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Retail::V2::AttributesConfig] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Retail::V2::AttributesConfig] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::CatalogService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::ReplaceCatalogAttributeRequest.new + # + # # Call the replace_catalog_attribute method. + # result = client.replace_catalog_attribute request + # + # # The returned object is of type Google::Cloud::Retail::V2::AttributesConfig. + # p result + # + def replace_catalog_attribute request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ReplaceCatalogAttributeRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.replace_catalog_attribute.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.attributes_config + header_params["attributes_config"] = request.attributes_config + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.replace_catalog_attribute.timeout, + metadata: metadata, + retry_policy: @config.rpcs.replace_catalog_attribute.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @catalog_service_stub.call_rpc :replace_catalog_attribute, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the CatalogService API. + # + # This class represents the configuration for CatalogService, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::Retail::V2::CatalogService::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # list_catalogs to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Retail::V2::CatalogService::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.list_catalogs.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Retail::V2::CatalogService::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.list_catalogs.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`GRPC::Core::Channel`) a gRPC channel with included credentials + # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object + # * (`nil`) indicating no credentials + # + # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials + # is deprecated. Providing an unvalidated credential configuration to + # Google APIs can compromise the security of your systems and data. + # + # @example + # + # # The recommended way to provide credentials is to use the `make_creds` method + # # on the appropriate credentials class for your environment. + # + # require "googleauth" + # + # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds( + # json_key_io: ::File.open("/path/to/keyfile.json") + # ) + # + # client = ::Google::Cloud::Retail::V2::CatalogService::Client.new do |config| + # config.credentials = credentials + # end + # + # @note Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] channel_args + # Extra parameters passed to the gRPC channel. Note: this is ignored if a + # `GRPC::Core::Channel` object is provided as the credential. + # @return [::Hash] + # @!attribute [rw] interceptors + # An array of interceptors that are run before calls are executed. + # @return [::Array<::GRPC::ClientInterceptor>] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional gRPC headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "retail.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) + config_attr :interceptors, nil, ::Array, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration for the channel pool + # @return [::Gapic::ServiceStub::ChannelPool::Configuration] + # + def channel_pool + @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new + end + + ## + # Configuration RPC class for the CatalogService API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `list_catalogs` + # @return [::Gapic::Config::Method] + # + attr_reader :list_catalogs + ## + # RPC-specific configuration for `update_catalog` + # @return [::Gapic::Config::Method] + # + attr_reader :update_catalog + ## + # RPC-specific configuration for `set_default_branch` + # @return [::Gapic::Config::Method] + # + attr_reader :set_default_branch + ## + # RPC-specific configuration for `get_default_branch` + # @return [::Gapic::Config::Method] + # + attr_reader :get_default_branch + ## + # RPC-specific configuration for `get_completion_config` + # @return [::Gapic::Config::Method] + # + attr_reader :get_completion_config + ## + # RPC-specific configuration for `update_completion_config` + # @return [::Gapic::Config::Method] + # + attr_reader :update_completion_config + ## + # RPC-specific configuration for `get_attributes_config` + # @return [::Gapic::Config::Method] + # + attr_reader :get_attributes_config + ## + # RPC-specific configuration for `update_attributes_config` + # @return [::Gapic::Config::Method] + # + attr_reader :update_attributes_config + ## + # RPC-specific configuration for `add_catalog_attribute` + # @return [::Gapic::Config::Method] + # + attr_reader :add_catalog_attribute + ## + # RPC-specific configuration for `remove_catalog_attribute` + # @return [::Gapic::Config::Method] + # + attr_reader :remove_catalog_attribute + ## + # RPC-specific configuration for `replace_catalog_attribute` + # @return [::Gapic::Config::Method] + # + attr_reader :replace_catalog_attribute + + # @private + def initialize parent_rpcs = nil + list_catalogs_config = parent_rpcs.list_catalogs if parent_rpcs.respond_to? :list_catalogs + @list_catalogs = ::Gapic::Config::Method.new list_catalogs_config + update_catalog_config = parent_rpcs.update_catalog if parent_rpcs.respond_to? :update_catalog + @update_catalog = ::Gapic::Config::Method.new update_catalog_config + set_default_branch_config = parent_rpcs.set_default_branch if parent_rpcs.respond_to? :set_default_branch + @set_default_branch = ::Gapic::Config::Method.new set_default_branch_config + get_default_branch_config = parent_rpcs.get_default_branch if parent_rpcs.respond_to? :get_default_branch + @get_default_branch = ::Gapic::Config::Method.new get_default_branch_config + get_completion_config_config = parent_rpcs.get_completion_config if parent_rpcs.respond_to? :get_completion_config + @get_completion_config = ::Gapic::Config::Method.new get_completion_config_config + update_completion_config_config = parent_rpcs.update_completion_config if parent_rpcs.respond_to? :update_completion_config + @update_completion_config = ::Gapic::Config::Method.new update_completion_config_config + get_attributes_config_config = parent_rpcs.get_attributes_config if parent_rpcs.respond_to? :get_attributes_config + @get_attributes_config = ::Gapic::Config::Method.new get_attributes_config_config + update_attributes_config_config = parent_rpcs.update_attributes_config if parent_rpcs.respond_to? :update_attributes_config + @update_attributes_config = ::Gapic::Config::Method.new update_attributes_config_config + add_catalog_attribute_config = parent_rpcs.add_catalog_attribute if parent_rpcs.respond_to? :add_catalog_attribute + @add_catalog_attribute = ::Gapic::Config::Method.new add_catalog_attribute_config + remove_catalog_attribute_config = parent_rpcs.remove_catalog_attribute if parent_rpcs.respond_to? :remove_catalog_attribute + @remove_catalog_attribute = ::Gapic::Config::Method.new remove_catalog_attribute_config + replace_catalog_attribute_config = parent_rpcs.replace_catalog_attribute if parent_rpcs.respond_to? :replace_catalog_attribute + @replace_catalog_attribute = ::Gapic::Config::Method.new replace_catalog_attribute_config + + yield self if block_given? + end + end + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/credentials.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/credentials.rb new file mode 100644 index 000000000000..181a310393b3 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/credentials.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "googleauth" + +module Google + module Cloud + module Retail + module V2 + module CatalogService + # Credentials for the CatalogService API. + class Credentials < ::Google::Auth::Credentials + self.scope = [ + "https://www.googleapis.com/auth/cloud-platform" + ] + self.env_vars = [ + "RETAIL_CREDENTIALS", + "RETAIL_KEYFILE", + "GOOGLE_CLOUD_CREDENTIALS", + "GOOGLE_CLOUD_KEYFILE", + "GCLOUD_KEYFILE", + "RETAIL_CREDENTIALS_JSON", + "RETAIL_KEYFILE_JSON", + "GOOGLE_CLOUD_CREDENTIALS_JSON", + "GOOGLE_CLOUD_KEYFILE_JSON", + "GCLOUD_KEYFILE_JSON" + ] + self.paths = [ + "~/.config/google_cloud/application_default_credentials.json" + ] + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/paths.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/paths.rb new file mode 100644 index 000000000000..19287ee026f3 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/paths.rb @@ -0,0 +1,128 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Retail + module V2 + module CatalogService + # Path helper methods for the CatalogService API. + module Paths + ## + # Create a fully-qualified AttributesConfig resource string. + # + # The resource will be in the following format: + # + # `projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig` + # + # @param project [String] + # @param location [String] + # @param catalog [String] + # + # @return [::String] + def attributes_config_path project:, location:, catalog: + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" + + "projects/#{project}/locations/#{location}/catalogs/#{catalog}/attributesConfig" + end + + ## + # Create a fully-qualified Branch resource string. + # + # The resource will be in the following format: + # + # `projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}` + # + # @param project [String] + # @param location [String] + # @param catalog [String] + # @param branch [String] + # + # @return [::String] + def branch_path project:, location:, catalog:, branch: + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" + raise ::ArgumentError, "catalog cannot contain /" if catalog.to_s.include? "/" + + "projects/#{project}/locations/#{location}/catalogs/#{catalog}/branches/#{branch}" + end + + ## + # Create a fully-qualified Catalog resource string. + # + # The resource will be in the following format: + # + # `projects/{project}/locations/{location}/catalogs/{catalog}` + # + # @param project [String] + # @param location [String] + # @param catalog [String] + # + # @return [::String] + def catalog_path project:, location:, catalog: + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" + + "projects/#{project}/locations/#{location}/catalogs/#{catalog}" + end + + ## + # Create a fully-qualified CompletionConfig resource string. + # + # The resource will be in the following format: + # + # `projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig` + # + # @param project [String] + # @param location [String] + # @param catalog [String] + # + # @return [::String] + def completion_config_path project:, location:, catalog: + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" + + "projects/#{project}/locations/#{location}/catalogs/#{catalog}/completionConfig" + end + + ## + # Create a fully-qualified Location resource string. + # + # The resource will be in the following format: + # + # `projects/{project}/locations/{location}` + # + # @param project [String] + # @param location [String] + # + # @return [::String] + def location_path project:, location: + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + + "projects/#{project}/locations/#{location}" + end + + extend self + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/rest.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/rest.rb new file mode 100644 index 000000000000..ea2c8cf3fcef --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/rest.rb @@ -0,0 +1,52 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/rest" +require "gapic/config" +require "gapic/config/method" + +require "google/cloud/retail/v2/version" + +require "google/cloud/retail/v2/catalog_service/credentials" +require "google/cloud/retail/v2/catalog_service/paths" +require "google/cloud/retail/v2/catalog_service/rest/client" + +module Google + module Cloud + module Retail + module V2 + ## + # Service for managing catalog configuration. + # + # To load this service and instantiate a REST client: + # + # require "google/cloud/retail/v2/catalog_service/rest" + # client = ::Google::Cloud::Retail::V2::CatalogService::Rest::Client.new + # + module CatalogService + # Client for the REST transport + module Rest + end + end + end + end + end +end + +helper_path = ::File.join __dir__, "rest", "helpers.rb" +require "google/cloud/retail/v2/catalog_service/rest/helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/rest/client.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/rest/client.rb new file mode 100644 index 000000000000..7627e97bdcbd --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/rest/client.rb @@ -0,0 +1,1470 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/cloud/retail/v2/catalog_service_pb" +require "google/cloud/retail/v2/catalog_service/rest/service_stub" +require "google/cloud/location/rest" + +module Google + module Cloud + module Retail + module V2 + module CatalogService + module Rest + ## + # REST client for the CatalogService service. + # + # Service for managing catalog configuration. + # + class Client + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" + + include Paths + + # @private + attr_reader :catalog_service_stub + + ## + # Configure the CatalogService Client class. + # + # See {::Google::Cloud::Retail::V2::CatalogService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all CatalogService clients + # ::Google::Cloud::Retail::V2::CatalogService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "Retail", "V2"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config.timeout = 5.0 + default_config.retry_policy = { + initial_delay: 0.1, max_delay: 5.0, multiplier: 1.3, retry_codes: [14, 4] + } + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the CatalogService Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Cloud::Retail::V2::CatalogService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @catalog_service_stub.universe_domain + end + + ## + # Create a new CatalogService REST client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::Retail::V2::CatalogService::Rest::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::Retail::V2::CatalogService::Rest::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the CatalogService client. + # @yieldparam config [Client::Configuration] + # + def initialize + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @catalog_service_stub = ::Google::Cloud::Retail::V2::CatalogService::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials, + logger: @config.logger + ) + + @catalog_service_stub.logger(stub: true)&.info do |entry| + entry.set_system_name + entry.set_service + entry.message = "Created client for #{entry.service}" + entry.set_credentials_fields credentials + entry.set "customEndpoint", @config.endpoint if @config.endpoint + entry.set "defaultTimeout", @config.timeout if @config.timeout + entry.set "quotaProject", @quota_project_id if @quota_project_id + end + + @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @catalog_service_stub.endpoint + config.universe_domain = @catalog_service_stub.universe_domain + config.logger = @catalog_service_stub.logger if config.respond_to? :logger= + end + end + + ## + # Get the associated client for mix-in of the Locations. + # + # @return [Google::Cloud::Location::Locations::Rest::Client] + # + attr_reader :location_client + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @catalog_service_stub.logger + end + + # Service calls + + ## + # Lists all the {::Google::Cloud::Retail::V2::Catalog Catalog}s associated with + # the project. + # + # @overload list_catalogs(request, options = nil) + # Pass arguments to `list_catalogs` via a request object, either of type + # {::Google::Cloud::Retail::V2::ListCatalogsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::ListCatalogsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload list_catalogs(parent: nil, page_size: nil, page_token: nil) + # Pass arguments to `list_catalogs` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. The account resource name with an associated location. + # + # If the caller does not have permission to list + # {::Google::Cloud::Retail::V2::Catalog Catalog}s under this location, regardless + # of whether or not this location exists, a PERMISSION_DENIED error is + # returned. + # @param page_size [::Integer] + # Maximum number of {::Google::Cloud::Retail::V2::Catalog Catalog}s to return. If + # unspecified, defaults to 50. The maximum allowed value is 1000. Values + # above 1000 will be coerced to 1000. + # + # If this field is negative, an INVALID_ARGUMENT is returned. + # @param page_token [::String] + # A page token + # {::Google::Cloud::Retail::V2::ListCatalogsResponse#next_page_token ListCatalogsResponse.next_page_token}, + # received from a previous + # {::Google::Cloud::Retail::V2::CatalogService::Rest::Client#list_catalogs CatalogService.ListCatalogs} + # call. Provide this to retrieve the subsequent page. + # + # When paginating, all other parameters provided to + # {::Google::Cloud::Retail::V2::CatalogService::Rest::Client#list_catalogs CatalogService.ListCatalogs} + # must match the call that provided the page token. Otherwise, an + # INVALID_ARGUMENT error is returned. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Retail::V2::Catalog>] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Retail::V2::Catalog>] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::CatalogService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::ListCatalogsRequest.new + # + # # Call the list_catalogs method. + # result = client.list_catalogs request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Cloud::Retail::V2::Catalog. + # p item + # end + # + def list_catalogs request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ListCatalogsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.list_catalogs.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.list_catalogs.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.list_catalogs.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @catalog_service_stub.list_catalogs request, options do |result, operation| + result = ::Gapic::Rest::PagedEnumerable.new @catalog_service_stub, :list_catalogs, "catalogs", request, result, options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Updates the {::Google::Cloud::Retail::V2::Catalog Catalog}s. + # + # @overload update_catalog(request, options = nil) + # Pass arguments to `update_catalog` via a request object, either of type + # {::Google::Cloud::Retail::V2::UpdateCatalogRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::UpdateCatalogRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload update_catalog(catalog: nil, update_mask: nil) + # Pass arguments to `update_catalog` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param catalog [::Google::Cloud::Retail::V2::Catalog, ::Hash] + # Required. The {::Google::Cloud::Retail::V2::Catalog Catalog} to update. + # + # If the caller does not have permission to update the + # {::Google::Cloud::Retail::V2::Catalog Catalog}, regardless of whether or not it + # exists, a PERMISSION_DENIED error is returned. + # + # If the {::Google::Cloud::Retail::V2::Catalog Catalog} to update does not exist, + # a NOT_FOUND error is returned. + # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] + # Indicates which fields in the provided + # {::Google::Cloud::Retail::V2::Catalog Catalog} to update. + # + # If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + # is returned. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::Catalog] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::Catalog] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::CatalogService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::UpdateCatalogRequest.new + # + # # Call the update_catalog method. + # result = client.update_catalog request + # + # # The returned object is of type Google::Cloud::Retail::V2::Catalog. + # p result + # + def update_catalog request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::UpdateCatalogRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.update_catalog.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.update_catalog.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.update_catalog.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @catalog_service_stub.update_catalog request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Set a specified branch id as default branch. API methods such as + # {::Google::Cloud::Retail::V2::SearchService::Rest::Client#search SearchService.Search}, + # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#get_product ProductService.GetProduct}, + # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#list_products ProductService.ListProducts} + # will treat requests using "default_branch" to the actual branch id set as + # default. + # + # For example, if `projects/*/locations/*/catalogs/*/branches/1` is set as + # default, setting + # {::Google::Cloud::Retail::V2::SearchRequest#branch SearchRequest.branch} to + # `projects/*/locations/*/catalogs/*/branches/default_branch` is equivalent + # to setting + # {::Google::Cloud::Retail::V2::SearchRequest#branch SearchRequest.branch} to + # `projects/*/locations/*/catalogs/*/branches/1`. + # + # Using multiple branches can be useful when developers would like + # to have a staging branch to test and verify for future usage. When it + # becomes ready, developers switch on the staging branch using this API + # while keeping using + # `projects/*/locations/*/catalogs/*/branches/default_branch` as + # {::Google::Cloud::Retail::V2::SearchRequest#branch SearchRequest.branch} to + # route the traffic to this staging branch. + # + # CAUTION: If you have live predict/search traffic, switching the default + # branch could potentially cause outages if the ID space of the new branch + # is very different from the old one. + # + # More specifically: + # + # * PredictionService will only return product IDs from branch \\{newBranch}. + # * SearchService will only return product IDs from branch \\{newBranch} + # (if branch is not explicitly set). + # * UserEventService will only join events with products from branch + # \\{newBranch}. + # + # @overload set_default_branch(request, options = nil) + # Pass arguments to `set_default_branch` via a request object, either of type + # {::Google::Cloud::Retail::V2::SetDefaultBranchRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::SetDefaultBranchRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload set_default_branch(catalog: nil, branch_id: nil, note: nil, force: nil) + # Pass arguments to `set_default_branch` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param catalog [::String] + # Full resource name of the catalog, such as + # `projects/*/locations/global/catalogs/default_catalog`. + # @param branch_id [::String] + # The final component of the resource name of a branch. + # + # This field must be one of "0", "1" or "2". Otherwise, an INVALID_ARGUMENT + # error is returned. + # + # If there are no sufficient active products in the targeted branch and + # {::Google::Cloud::Retail::V2::SetDefaultBranchRequest#force force} is not set, a + # FAILED_PRECONDITION error is returned. + # @param note [::String] + # Some note on this request, this can be retrieved by + # {::Google::Cloud::Retail::V2::CatalogService::Rest::Client#get_default_branch CatalogService.GetDefaultBranch} + # before next valid default branch set occurs. + # + # This field must be a UTF-8 encoded string with a length limit of 1,000 + # characters. Otherwise, an INVALID_ARGUMENT error is returned. + # @param force [::Boolean] + # If set to true, it permits switching to a branch with + # {::Google::Cloud::Retail::V2::SetDefaultBranchRequest#branch_id branch_id} even + # if it has no sufficient active products. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Protobuf::Empty] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Protobuf::Empty] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::CatalogService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::SetDefaultBranchRequest.new + # + # # Call the set_default_branch method. + # result = client.set_default_branch request + # + # # The returned object is of type Google::Protobuf::Empty. + # p result + # + def set_default_branch request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::SetDefaultBranchRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.set_default_branch.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.set_default_branch.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.set_default_branch.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @catalog_service_stub.set_default_branch request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Get which branch is currently default branch set by + # {::Google::Cloud::Retail::V2::CatalogService::Rest::Client#set_default_branch CatalogService.SetDefaultBranch} + # method under a specified parent catalog. + # + # @overload get_default_branch(request, options = nil) + # Pass arguments to `get_default_branch` via a request object, either of type + # {::Google::Cloud::Retail::V2::GetDefaultBranchRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::GetDefaultBranchRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload get_default_branch(catalog: nil) + # Pass arguments to `get_default_branch` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param catalog [::String] + # The parent catalog resource name, such as + # `projects/*/locations/global/catalogs/default_catalog`. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::GetDefaultBranchResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::GetDefaultBranchResponse] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::CatalogService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::GetDefaultBranchRequest.new + # + # # Call the get_default_branch method. + # result = client.get_default_branch request + # + # # The returned object is of type Google::Cloud::Retail::V2::GetDefaultBranchResponse. + # p result + # + def get_default_branch request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::GetDefaultBranchRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.get_default_branch.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.get_default_branch.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.get_default_branch.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @catalog_service_stub.get_default_branch request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets a {::Google::Cloud::Retail::V2::CompletionConfig CompletionConfig}. + # + # @overload get_completion_config(request, options = nil) + # Pass arguments to `get_completion_config` via a request object, either of type + # {::Google::Cloud::Retail::V2::GetCompletionConfigRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::GetCompletionConfigRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload get_completion_config(name: nil) + # Pass arguments to `get_completion_config` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. Full CompletionConfig resource name. Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig` + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::CompletionConfig] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::CompletionConfig] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::CatalogService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::GetCompletionConfigRequest.new + # + # # Call the get_completion_config method. + # result = client.get_completion_config request + # + # # The returned object is of type Google::Cloud::Retail::V2::CompletionConfig. + # p result + # + def get_completion_config request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::GetCompletionConfigRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.get_completion_config.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.get_completion_config.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.get_completion_config.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @catalog_service_stub.get_completion_config request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Updates the {::Google::Cloud::Retail::V2::CompletionConfig CompletionConfig}s. + # + # @overload update_completion_config(request, options = nil) + # Pass arguments to `update_completion_config` via a request object, either of type + # {::Google::Cloud::Retail::V2::UpdateCompletionConfigRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::UpdateCompletionConfigRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload update_completion_config(completion_config: nil, update_mask: nil) + # Pass arguments to `update_completion_config` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param completion_config [::Google::Cloud::Retail::V2::CompletionConfig, ::Hash] + # Required. The {::Google::Cloud::Retail::V2::CompletionConfig CompletionConfig} + # to update. + # + # If the caller does not have permission to update the + # {::Google::Cloud::Retail::V2::CompletionConfig CompletionConfig}, then a + # PERMISSION_DENIED error is returned. + # + # If the {::Google::Cloud::Retail::V2::CompletionConfig CompletionConfig} to + # update does not exist, a NOT_FOUND error is returned. + # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] + # Indicates which fields in the provided + # {::Google::Cloud::Retail::V2::CompletionConfig CompletionConfig} to update. The + # following are the only supported fields: + # + # * {::Google::Cloud::Retail::V2::CompletionConfig#matching_order CompletionConfig.matching_order} + # * {::Google::Cloud::Retail::V2::CompletionConfig#max_suggestions CompletionConfig.max_suggestions} + # * {::Google::Cloud::Retail::V2::CompletionConfig#min_prefix_length CompletionConfig.min_prefix_length} + # * {::Google::Cloud::Retail::V2::CompletionConfig#auto_learning CompletionConfig.auto_learning} + # + # If not set, all supported fields are updated. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::CompletionConfig] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::CompletionConfig] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::CatalogService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::UpdateCompletionConfigRequest.new + # + # # Call the update_completion_config method. + # result = client.update_completion_config request + # + # # The returned object is of type Google::Cloud::Retail::V2::CompletionConfig. + # p result + # + def update_completion_config request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::UpdateCompletionConfigRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.update_completion_config.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.update_completion_config.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.update_completion_config.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @catalog_service_stub.update_completion_config request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets an {::Google::Cloud::Retail::V2::AttributesConfig AttributesConfig}. + # + # @overload get_attributes_config(request, options = nil) + # Pass arguments to `get_attributes_config` via a request object, either of type + # {::Google::Cloud::Retail::V2::GetAttributesConfigRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::GetAttributesConfigRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload get_attributes_config(name: nil) + # Pass arguments to `get_attributes_config` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. Full AttributesConfig resource name. Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::AttributesConfig] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::AttributesConfig] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::CatalogService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::GetAttributesConfigRequest.new + # + # # Call the get_attributes_config method. + # result = client.get_attributes_config request + # + # # The returned object is of type Google::Cloud::Retail::V2::AttributesConfig. + # p result + # + def get_attributes_config request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::GetAttributesConfigRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.get_attributes_config.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.get_attributes_config.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.get_attributes_config.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @catalog_service_stub.get_attributes_config request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Updates the {::Google::Cloud::Retail::V2::AttributesConfig AttributesConfig}. + # + # The catalog attributes in the request will be updated in the catalog, or + # inserted if they do not exist. Existing catalog attributes not included in + # the request will remain unchanged. Attributes that are assigned to + # products, but do not exist at the catalog level, are always included in the + # response. The product attribute is assigned default values for missing + # catalog attribute fields, e.g., searchable and dynamic facetable options. + # + # @overload update_attributes_config(request, options = nil) + # Pass arguments to `update_attributes_config` via a request object, either of type + # {::Google::Cloud::Retail::V2::UpdateAttributesConfigRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::UpdateAttributesConfigRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload update_attributes_config(attributes_config: nil, update_mask: nil) + # Pass arguments to `update_attributes_config` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param attributes_config [::Google::Cloud::Retail::V2::AttributesConfig, ::Hash] + # Required. The {::Google::Cloud::Retail::V2::AttributesConfig AttributesConfig} + # to update. + # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] + # Indicates which fields in the provided + # {::Google::Cloud::Retail::V2::AttributesConfig AttributesConfig} to update. The + # following is the only supported field: + # + # * {::Google::Cloud::Retail::V2::AttributesConfig#catalog_attributes AttributesConfig.catalog_attributes} + # + # If not set, all supported fields are updated. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::AttributesConfig] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::AttributesConfig] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::CatalogService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::UpdateAttributesConfigRequest.new + # + # # Call the update_attributes_config method. + # result = client.update_attributes_config request + # + # # The returned object is of type Google::Cloud::Retail::V2::AttributesConfig. + # p result + # + def update_attributes_config request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::UpdateAttributesConfigRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.update_attributes_config.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.update_attributes_config.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.update_attributes_config.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @catalog_service_stub.update_attributes_config request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Adds the specified + # {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} to the + # {::Google::Cloud::Retail::V2::AttributesConfig AttributesConfig}. + # + # If the {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} to add + # already exists, an ALREADY_EXISTS error is returned. + # + # @overload add_catalog_attribute(request, options = nil) + # Pass arguments to `add_catalog_attribute` via a request object, either of type + # {::Google::Cloud::Retail::V2::AddCatalogAttributeRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::AddCatalogAttributeRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload add_catalog_attribute(attributes_config: nil, catalog_attribute: nil) + # Pass arguments to `add_catalog_attribute` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param attributes_config [::String] + # Required. Full AttributesConfig resource name. Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` + # @param catalog_attribute [::Google::Cloud::Retail::V2::CatalogAttribute, ::Hash] + # Required. The {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} + # to add. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::AttributesConfig] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::AttributesConfig] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::CatalogService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::AddCatalogAttributeRequest.new + # + # # Call the add_catalog_attribute method. + # result = client.add_catalog_attribute request + # + # # The returned object is of type Google::Cloud::Retail::V2::AttributesConfig. + # p result + # + def add_catalog_attribute request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::AddCatalogAttributeRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.add_catalog_attribute.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.add_catalog_attribute.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.add_catalog_attribute.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @catalog_service_stub.add_catalog_attribute request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Removes the specified + # {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} from the + # {::Google::Cloud::Retail::V2::AttributesConfig AttributesConfig}. + # + # If the {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} to + # remove does not exist, a NOT_FOUND error is returned. + # + # @overload remove_catalog_attribute(request, options = nil) + # Pass arguments to `remove_catalog_attribute` via a request object, either of type + # {::Google::Cloud::Retail::V2::RemoveCatalogAttributeRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::RemoveCatalogAttributeRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload remove_catalog_attribute(attributes_config: nil, key: nil) + # Pass arguments to `remove_catalog_attribute` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param attributes_config [::String] + # Required. Full AttributesConfig resource name. Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` + # @param key [::String] + # Required. The attribute name key of the + # {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} to remove. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::AttributesConfig] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::AttributesConfig] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::CatalogService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::RemoveCatalogAttributeRequest.new + # + # # Call the remove_catalog_attribute method. + # result = client.remove_catalog_attribute request + # + # # The returned object is of type Google::Cloud::Retail::V2::AttributesConfig. + # p result + # + def remove_catalog_attribute request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::RemoveCatalogAttributeRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.remove_catalog_attribute.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.remove_catalog_attribute.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.remove_catalog_attribute.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @catalog_service_stub.remove_catalog_attribute request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Replaces the specified + # {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} in the + # {::Google::Cloud::Retail::V2::AttributesConfig AttributesConfig} by updating the + # catalog attribute with the same + # {::Google::Cloud::Retail::V2::CatalogAttribute#key CatalogAttribute.key}. + # + # If the {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} to + # replace does not exist, a NOT_FOUND error is returned. + # + # @overload replace_catalog_attribute(request, options = nil) + # Pass arguments to `replace_catalog_attribute` via a request object, either of type + # {::Google::Cloud::Retail::V2::ReplaceCatalogAttributeRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::ReplaceCatalogAttributeRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload replace_catalog_attribute(attributes_config: nil, catalog_attribute: nil, update_mask: nil) + # Pass arguments to `replace_catalog_attribute` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param attributes_config [::String] + # Required. Full AttributesConfig resource name. Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` + # @param catalog_attribute [::Google::Cloud::Retail::V2::CatalogAttribute, ::Hash] + # Required. The updated + # {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute}. + # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] + # Indicates which fields in the provided + # {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} to update. The + # following are NOT supported: + # + # * {::Google::Cloud::Retail::V2::CatalogAttribute#key CatalogAttribute.key} + # + # If not set, all supported fields are updated. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::AttributesConfig] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::AttributesConfig] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::CatalogService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::ReplaceCatalogAttributeRequest.new + # + # # Call the replace_catalog_attribute method. + # result = client.replace_catalog_attribute request + # + # # The returned object is of type Google::Cloud::Retail::V2::AttributesConfig. + # p result + # + def replace_catalog_attribute request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ReplaceCatalogAttributeRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.replace_catalog_attribute.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.replace_catalog_attribute.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.replace_catalog_attribute.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @catalog_service_stub.replace_catalog_attribute request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the CatalogService REST API. + # + # This class represents the configuration for CatalogService REST, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::Retail::V2::CatalogService::Rest::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # list_catalogs to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Retail::V2::CatalogService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.list_catalogs.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Retail::V2::CatalogService::Rest::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.list_catalogs.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`String`) The path to a service account key file in JSON format + # * (`Hash`) A service account key as a Hash + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`nil`) indicating no credentials + # + # Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "retail.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration RPC class for the CatalogService API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `list_catalogs` + # @return [::Gapic::Config::Method] + # + attr_reader :list_catalogs + ## + # RPC-specific configuration for `update_catalog` + # @return [::Gapic::Config::Method] + # + attr_reader :update_catalog + ## + # RPC-specific configuration for `set_default_branch` + # @return [::Gapic::Config::Method] + # + attr_reader :set_default_branch + ## + # RPC-specific configuration for `get_default_branch` + # @return [::Gapic::Config::Method] + # + attr_reader :get_default_branch + ## + # RPC-specific configuration for `get_completion_config` + # @return [::Gapic::Config::Method] + # + attr_reader :get_completion_config + ## + # RPC-specific configuration for `update_completion_config` + # @return [::Gapic::Config::Method] + # + attr_reader :update_completion_config + ## + # RPC-specific configuration for `get_attributes_config` + # @return [::Gapic::Config::Method] + # + attr_reader :get_attributes_config + ## + # RPC-specific configuration for `update_attributes_config` + # @return [::Gapic::Config::Method] + # + attr_reader :update_attributes_config + ## + # RPC-specific configuration for `add_catalog_attribute` + # @return [::Gapic::Config::Method] + # + attr_reader :add_catalog_attribute + ## + # RPC-specific configuration for `remove_catalog_attribute` + # @return [::Gapic::Config::Method] + # + attr_reader :remove_catalog_attribute + ## + # RPC-specific configuration for `replace_catalog_attribute` + # @return [::Gapic::Config::Method] + # + attr_reader :replace_catalog_attribute + + # @private + def initialize parent_rpcs = nil + list_catalogs_config = parent_rpcs.list_catalogs if parent_rpcs.respond_to? :list_catalogs + @list_catalogs = ::Gapic::Config::Method.new list_catalogs_config + update_catalog_config = parent_rpcs.update_catalog if parent_rpcs.respond_to? :update_catalog + @update_catalog = ::Gapic::Config::Method.new update_catalog_config + set_default_branch_config = parent_rpcs.set_default_branch if parent_rpcs.respond_to? :set_default_branch + @set_default_branch = ::Gapic::Config::Method.new set_default_branch_config + get_default_branch_config = parent_rpcs.get_default_branch if parent_rpcs.respond_to? :get_default_branch + @get_default_branch = ::Gapic::Config::Method.new get_default_branch_config + get_completion_config_config = parent_rpcs.get_completion_config if parent_rpcs.respond_to? :get_completion_config + @get_completion_config = ::Gapic::Config::Method.new get_completion_config_config + update_completion_config_config = parent_rpcs.update_completion_config if parent_rpcs.respond_to? :update_completion_config + @update_completion_config = ::Gapic::Config::Method.new update_completion_config_config + get_attributes_config_config = parent_rpcs.get_attributes_config if parent_rpcs.respond_to? :get_attributes_config + @get_attributes_config = ::Gapic::Config::Method.new get_attributes_config_config + update_attributes_config_config = parent_rpcs.update_attributes_config if parent_rpcs.respond_to? :update_attributes_config + @update_attributes_config = ::Gapic::Config::Method.new update_attributes_config_config + add_catalog_attribute_config = parent_rpcs.add_catalog_attribute if parent_rpcs.respond_to? :add_catalog_attribute + @add_catalog_attribute = ::Gapic::Config::Method.new add_catalog_attribute_config + remove_catalog_attribute_config = parent_rpcs.remove_catalog_attribute if parent_rpcs.respond_to? :remove_catalog_attribute + @remove_catalog_attribute = ::Gapic::Config::Method.new remove_catalog_attribute_config + replace_catalog_attribute_config = parent_rpcs.replace_catalog_attribute if parent_rpcs.respond_to? :replace_catalog_attribute + @replace_catalog_attribute = ::Gapic::Config::Method.new replace_catalog_attribute_config + + yield self if block_given? + end + end + end + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/rest/service_stub.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/rest/service_stub.rb new file mode 100644 index 000000000000..aba96c79d1c5 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/rest/service_stub.rb @@ -0,0 +1,759 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/retail/v2/catalog_service_pb" + +module Google + module Cloud + module Retail + module V2 + module CatalogService + module Rest + ## + # REST service stub for the CatalogService service. + # Service stub contains baseline method implementations + # including transcoding, making the REST call, and deserialing the response. + # + class ServiceStub + # @private + def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger: + # These require statements are intentionally placed here to initialize + # the REST modules only when it's required. + require "gapic/rest" + + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials, + numeric_enums: true, + service_name: self.class, + raise_faraday_errors: false, + logger: logger + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @client_stub.universe_domain + end + + ## + # The effective endpoint + # + # @return [String] + # + def endpoint + @client_stub.endpoint + end + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger stub: false + stub ? @client_stub.stub_logger : @client_stub.logger + end + + ## + # Baseline implementation for the list_catalogs REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::ListCatalogsRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::ListCatalogsResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::ListCatalogsResponse] + # A result object deserialized from the server's reply + def list_catalogs request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_list_catalogs_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "list_catalogs", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Retail::V2::ListCatalogsResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the update_catalog REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::UpdateCatalogRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::Catalog] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::Catalog] + # A result object deserialized from the server's reply + def update_catalog request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_update_catalog_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "update_catalog", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Retail::V2::Catalog.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the set_default_branch REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::SetDefaultBranchRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Protobuf::Empty] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Protobuf::Empty] + # A result object deserialized from the server's reply + def set_default_branch request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_set_default_branch_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "set_default_branch", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the get_default_branch REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::GetDefaultBranchRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::GetDefaultBranchResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::GetDefaultBranchResponse] + # A result object deserialized from the server's reply + def get_default_branch request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_get_default_branch_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "get_default_branch", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Retail::V2::GetDefaultBranchResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the get_completion_config REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::GetCompletionConfigRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::CompletionConfig] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::CompletionConfig] + # A result object deserialized from the server's reply + def get_completion_config request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_get_completion_config_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "get_completion_config", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Retail::V2::CompletionConfig.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the update_completion_config REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::UpdateCompletionConfigRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::CompletionConfig] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::CompletionConfig] + # A result object deserialized from the server's reply + def update_completion_config request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_update_completion_config_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "update_completion_config", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Retail::V2::CompletionConfig.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the get_attributes_config REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::GetAttributesConfigRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::AttributesConfig] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::AttributesConfig] + # A result object deserialized from the server's reply + def get_attributes_config request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_get_attributes_config_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "get_attributes_config", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Retail::V2::AttributesConfig.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the update_attributes_config REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::UpdateAttributesConfigRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::AttributesConfig] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::AttributesConfig] + # A result object deserialized from the server's reply + def update_attributes_config request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_update_attributes_config_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "update_attributes_config", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Retail::V2::AttributesConfig.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the add_catalog_attribute REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::AddCatalogAttributeRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::AttributesConfig] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::AttributesConfig] + # A result object deserialized from the server's reply + def add_catalog_attribute request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_add_catalog_attribute_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "add_catalog_attribute", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Retail::V2::AttributesConfig.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the remove_catalog_attribute REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::RemoveCatalogAttributeRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::AttributesConfig] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::AttributesConfig] + # A result object deserialized from the server's reply + def remove_catalog_attribute request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_remove_catalog_attribute_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "remove_catalog_attribute", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Retail::V2::AttributesConfig.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the replace_catalog_attribute REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::ReplaceCatalogAttributeRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::AttributesConfig] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::AttributesConfig] + # A result object deserialized from the server's reply + def replace_catalog_attribute request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_replace_catalog_attribute_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "replace_catalog_attribute", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Retail::V2::AttributesConfig.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # @private + # + # GRPC transcoding helper method for the list_catalogs REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::ListCatalogsRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_list_catalogs_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v2/{parent}/catalogs", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the update_catalog REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::UpdateCatalogRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_update_catalog_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :patch, + uri_template: "/v2/{catalog.name}", + body: "catalog", + matches: [ + ["catalog.name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the set_default_branch REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::SetDefaultBranchRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_set_default_branch_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v2/{catalog}:setDefaultBranch", + body: "*", + matches: [ + ["catalog", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the get_default_branch REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::GetDefaultBranchRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_get_default_branch_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v2/{catalog}:getDefaultBranch", + matches: [ + ["catalog", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the get_completion_config REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::GetCompletionConfigRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_get_completion_config_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v2/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/completionConfig/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the update_completion_config REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::UpdateCompletionConfigRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_update_completion_config_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :patch, + uri_template: "/v2/{completion_config.name}", + body: "completion_config", + matches: [ + ["completion_config.name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/completionConfig/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the get_attributes_config REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::GetAttributesConfigRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_get_attributes_config_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v2/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/attributesConfig/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the update_attributes_config REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::UpdateAttributesConfigRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_update_attributes_config_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :patch, + uri_template: "/v2/{attributes_config.name}", + body: "attributes_config", + matches: [ + ["attributes_config.name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/attributesConfig/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the add_catalog_attribute REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::AddCatalogAttributeRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_add_catalog_attribute_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v2/{attributes_config}:addCatalogAttribute", + body: "*", + matches: [ + ["attributes_config", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/attributesConfig/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the remove_catalog_attribute REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::RemoveCatalogAttributeRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_remove_catalog_attribute_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v2/{attributes_config}:removeCatalogAttribute", + body: "*", + matches: [ + ["attributes_config", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/attributesConfig/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the replace_catalog_attribute REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::ReplaceCatalogAttributeRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_replace_catalog_attribute_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v2/{attributes_config}:replaceCatalogAttribute", + body: "*", + matches: [ + ["attributes_config", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/attributesConfig/?$}, false] + ] + ) + transcoder.transcode request_pb + end + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service_pb.rb new file mode 100644 index 000000000000..13226293301e --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service_pb.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/retail/v2/catalog_service.proto + +require 'google/protobuf' + +require 'google/api/annotations_pb' +require 'google/api/client_pb' +require 'google/api/field_behavior_pb' +require 'google/api/resource_pb' +require 'google/cloud/retail/v2/catalog_pb' +require 'google/protobuf/empty_pb' +require 'google/protobuf/field_mask_pb' +require 'google/protobuf/timestamp_pb' + + +descriptor_data = "\n,google/cloud/retail/v2/catalog_service.proto\x12\x16google.cloud.retail.v2\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a$google/cloud/retail/v2/catalog.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"w\n\x13ListCatalogsRequest\x12\x39\n\x06parent\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\x12\x11\n\tpage_size\x18\x02 \x01(\x05\x12\x12\n\npage_token\x18\x03 \x01(\t\"b\n\x14ListCatalogsResponse\x12\x31\n\x08\x63\x61talogs\x18\x01 \x03(\x0b\x32\x1f.google.cloud.retail.v2.Catalog\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t\"~\n\x14UpdateCatalogRequest\x12\x35\n\x07\x63\x61talog\x18\x01 \x01(\x0b\x32\x1f.google.cloud.retail.v2.CatalogB\x03\xe0\x41\x02\x12/\n\x0bupdate_mask\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMask\"\xa1\x01\n\x17SetDefaultBranchRequest\x12\x33\n\x07\x63\x61talog\x18\x01 \x01(\tB\"\xfa\x41\x1f\n\x1dretail.googleapis.com/Catalog\x12\x34\n\tbranch_id\x18\x02 \x01(\tB!\xfa\x41\x1e\n\x1cretail.googleapis.com/Branch\x12\x0c\n\x04note\x18\x03 \x01(\t\x12\r\n\x05\x66orce\x18\x04 \x01(\x08\"N\n\x17GetDefaultBranchRequest\x12\x33\n\x07\x63\x61talog\x18\x01 \x01(\tB\"\xfa\x41\x1f\n\x1dretail.googleapis.com/Catalog\"\x89\x01\n\x18GetDefaultBranchResponse\x12\x31\n\x06\x62ranch\x18\x01 \x01(\tB!\xfa\x41\x1e\n\x1cretail.googleapis.com/Branch\x12,\n\x08set_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x0c\n\x04note\x18\x03 \x01(\t\"Z\n\x1aGetCompletionConfigRequest\x12<\n\x04name\x18\x01 \x01(\tB.\xe0\x41\x02\xfa\x41(\n&retail.googleapis.com/CompletionConfig\"\x9a\x01\n\x1dUpdateCompletionConfigRequest\x12H\n\x11\x63ompletion_config\x18\x01 \x01(\x0b\x32(.google.cloud.retail.v2.CompletionConfigB\x03\xe0\x41\x02\x12/\n\x0bupdate_mask\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMask\"Z\n\x1aGetAttributesConfigRequest\x12<\n\x04name\x18\x01 \x01(\tB.\xe0\x41\x02\xfa\x41(\n&retail.googleapis.com/AttributesConfig\"\x9a\x01\n\x1dUpdateAttributesConfigRequest\x12H\n\x11\x61ttributes_config\x18\x01 \x01(\x0b\x32(.google.cloud.retail.v2.AttributesConfigB\x03\xe0\x41\x02\x12/\n\x0bupdate_mask\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMask\"\xb1\x01\n\x1a\x41\x64\x64\x43\x61talogAttributeRequest\x12I\n\x11\x61ttributes_config\x18\x01 \x01(\tB.\xe0\x41\x02\xfa\x41(\n&retail.googleapis.com/AttributesConfig\x12H\n\x11\x63\x61talog_attribute\x18\x02 \x01(\x0b\x32(.google.cloud.retail.v2.CatalogAttributeB\x03\xe0\x41\x02\"|\n\x1dRemoveCatalogAttributeRequest\x12I\n\x11\x61ttributes_config\x18\x01 \x01(\tB.\xe0\x41\x02\xfa\x41(\n&retail.googleapis.com/AttributesConfig\x12\x10\n\x03key\x18\x02 \x01(\tB\x03\xe0\x41\x02\"\xe6\x01\n\x1eReplaceCatalogAttributeRequest\x12I\n\x11\x61ttributes_config\x18\x01 \x01(\tB.\xe0\x41\x02\xfa\x41(\n&retail.googleapis.com/AttributesConfig\x12H\n\x11\x63\x61talog_attribute\x18\x02 \x01(\x0b\x32(.google.cloud.retail.v2.CatalogAttributeB\x03\xe0\x41\x02\x12/\n\x0bupdate_mask\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.FieldMask2\x97\x13\n\x0e\x43\x61talogService\x12\xa8\x01\n\x0cListCatalogs\x12+.google.cloud.retail.v2.ListCatalogsRequest\x1a,.google.cloud.retail.v2.ListCatalogsResponse\"=\xda\x41\x06parent\x82\xd3\xe4\x93\x02.\x12,/v2/{parent=projects/*/locations/*}/catalogs\x12\xbb\x01\n\rUpdateCatalog\x12,.google.cloud.retail.v2.UpdateCatalogRequest\x1a\x1f.google.cloud.retail.v2.Catalog\"[\xda\x41\x13\x63\x61talog,update_mask\x82\xd3\xe4\x93\x02?24/v2/{catalog.name=projects/*/locations/*/catalogs/*}:\x07\x63\x61talog\x12\xb2\x01\n\x10SetDefaultBranch\x12/.google.cloud.retail.v2.SetDefaultBranchRequest\x1a\x16.google.protobuf.Empty\"U\xda\x41\x07\x63\x61talog\x82\xd3\xe4\x93\x02\x45\"@/v2/{catalog=projects/*/locations/*/catalogs/*}:setDefaultBranch:\x01*\x12\xc9\x01\n\x10GetDefaultBranch\x12/.google.cloud.retail.v2.GetDefaultBranchRequest\x1a\x30.google.cloud.retail.v2.GetDefaultBranchResponse\"R\xda\x41\x07\x63\x61talog\x82\xd3\xe4\x93\x02\x42\x12@/v2/{catalog=projects/*/locations/*/catalogs/*}:getDefaultBranch\x12\xc1\x01\n\x13GetCompletionConfig\x12\x32.google.cloud.retail.v2.GetCompletionConfigRequest\x1a(.google.cloud.retail.v2.CompletionConfig\"L\xda\x41\x04name\x82\xd3\xe4\x93\x02?\x12=/v2/{name=projects/*/locations/*/catalogs/*/completionConfig}\x12\x86\x02\n\x16UpdateCompletionConfig\x12\x35.google.cloud.retail.v2.UpdateCompletionConfigRequest\x1a(.google.cloud.retail.v2.CompletionConfig\"\x8a\x01\xda\x41\x1d\x63ompletion_config,update_mask\x82\xd3\xe4\x93\x02\x64\x32O/v2/{completion_config.name=projects/*/locations/*/catalogs/*/completionConfig}:\x11\x63ompletion_config\x12\xc1\x01\n\x13GetAttributesConfig\x12\x32.google.cloud.retail.v2.GetAttributesConfigRequest\x1a(.google.cloud.retail.v2.AttributesConfig\"L\xda\x41\x04name\x82\xd3\xe4\x93\x02?\x12=/v2/{name=projects/*/locations/*/catalogs/*/attributesConfig}\x12\x86\x02\n\x16UpdateAttributesConfig\x12\x35.google.cloud.retail.v2.UpdateAttributesConfigRequest\x1a(.google.cloud.retail.v2.AttributesConfig\"\x8a\x01\xda\x41\x1d\x61ttributes_config,update_mask\x82\xd3\xe4\x93\x02\x64\x32O/v2/{attributes_config.name=projects/*/locations/*/catalogs/*/attributesConfig}:\x11\x61ttributes_config\x12\xde\x01\n\x13\x41\x64\x64\x43\x61talogAttribute\x12\x32.google.cloud.retail.v2.AddCatalogAttributeRequest\x1a(.google.cloud.retail.v2.AttributesConfig\"i\x82\xd3\xe4\x93\x02\x63\"^/v2/{attributes_config=projects/*/locations/*/catalogs/*/attributesConfig}:addCatalogAttribute:\x01*\x12\xe7\x01\n\x16RemoveCatalogAttribute\x12\x35.google.cloud.retail.v2.RemoveCatalogAttributeRequest\x1a(.google.cloud.retail.v2.AttributesConfig\"l\x82\xd3\xe4\x93\x02\x66\"a/v2/{attributes_config=projects/*/locations/*/catalogs/*/attributesConfig}:removeCatalogAttribute:\x01*\x12\xea\x01\n\x17ReplaceCatalogAttribute\x12\x36.google.cloud.retail.v2.ReplaceCatalogAttributeRequest\x1a(.google.cloud.retail.v2.AttributesConfig\"m\x82\xd3\xe4\x93\x02g\"b/v2/{attributes_config=projects/*/locations/*/catalogs/*/attributesConfig}:replaceCatalogAttribute:\x01*\x1aI\xca\x41\x15retail.googleapis.com\xd2\x41.https://www.googleapis.com/auth/cloud-platformB\xbe\x01\n\x1a\x63om.google.cloud.retail.v2B\x13\x43\x61talogServiceProtoP\x01Z2cloud.google.com/go/retail/apiv2/retailpb;retailpb\xa2\x02\x06RETAIL\xaa\x02\x16Google.Cloud.Retail.V2\xca\x02\x16Google\\Cloud\\Retail\\V2\xea\x02\x19Google::Cloud::Retail::V2b\x06proto3" + +pool = ::Google::Protobuf::DescriptorPool.generated_pool +pool.add_serialized_file(descriptor_data) + +module Google + module Cloud + module Retail + module V2 + ListCatalogsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ListCatalogsRequest").msgclass + ListCatalogsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ListCatalogsResponse").msgclass + UpdateCatalogRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.UpdateCatalogRequest").msgclass + SetDefaultBranchRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SetDefaultBranchRequest").msgclass + GetDefaultBranchRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.GetDefaultBranchRequest").msgclass + GetDefaultBranchResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.GetDefaultBranchResponse").msgclass + GetCompletionConfigRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.GetCompletionConfigRequest").msgclass + UpdateCompletionConfigRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.UpdateCompletionConfigRequest").msgclass + GetAttributesConfigRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.GetAttributesConfigRequest").msgclass + UpdateAttributesConfigRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.UpdateAttributesConfigRequest").msgclass + AddCatalogAttributeRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.AddCatalogAttributeRequest").msgclass + RemoveCatalogAttributeRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.RemoveCatalogAttributeRequest").msgclass + ReplaceCatalogAttributeRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ReplaceCatalogAttributeRequest").msgclass + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service_services_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service_services_pb.rb new file mode 100644 index 000000000000..bfd199b2e5c5 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service_services_pb.rb @@ -0,0 +1,125 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# Source: google/cloud/retail/v2/catalog_service.proto for package 'Google.Cloud.Retail.V2' +# Original file comments: +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +require 'grpc' +require 'google/cloud/retail/v2/catalog_service_pb' + +module Google + module Cloud + module Retail + module V2 + module CatalogService + # Service for managing catalog configuration. + class Service + + include ::GRPC::GenericService + + self.marshal_class_method = :encode + self.unmarshal_class_method = :decode + self.service_name = 'google.cloud.retail.v2.CatalogService' + + # Lists all the [Catalog][google.cloud.retail.v2.Catalog]s associated with + # the project. + rpc :ListCatalogs, ::Google::Cloud::Retail::V2::ListCatalogsRequest, ::Google::Cloud::Retail::V2::ListCatalogsResponse + # Updates the [Catalog][google.cloud.retail.v2.Catalog]s. + rpc :UpdateCatalog, ::Google::Cloud::Retail::V2::UpdateCatalogRequest, ::Google::Cloud::Retail::V2::Catalog + # Set a specified branch id as default branch. API methods such as + # [SearchService.Search][google.cloud.retail.v2.SearchService.Search], + # [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct], + # [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts] + # will treat requests using "default_branch" to the actual branch id set as + # default. + # + # For example, if `projects/*/locations/*/catalogs/*/branches/1` is set as + # default, setting + # [SearchRequest.branch][google.cloud.retail.v2.SearchRequest.branch] to + # `projects/*/locations/*/catalogs/*/branches/default_branch` is equivalent + # to setting + # [SearchRequest.branch][google.cloud.retail.v2.SearchRequest.branch] to + # `projects/*/locations/*/catalogs/*/branches/1`. + # + # Using multiple branches can be useful when developers would like + # to have a staging branch to test and verify for future usage. When it + # becomes ready, developers switch on the staging branch using this API + # while keeping using + # `projects/*/locations/*/catalogs/*/branches/default_branch` as + # [SearchRequest.branch][google.cloud.retail.v2.SearchRequest.branch] to + # route the traffic to this staging branch. + # + # CAUTION: If you have live predict/search traffic, switching the default + # branch could potentially cause outages if the ID space of the new branch + # is very different from the old one. + # + # More specifically: + # + # * PredictionService will only return product IDs from branch {newBranch}. + # * SearchService will only return product IDs from branch {newBranch} + # (if branch is not explicitly set). + # * UserEventService will only join events with products from branch + # {newBranch}. + rpc :SetDefaultBranch, ::Google::Cloud::Retail::V2::SetDefaultBranchRequest, ::Google::Protobuf::Empty + # Get which branch is currently default branch set by + # [CatalogService.SetDefaultBranch][google.cloud.retail.v2.CatalogService.SetDefaultBranch] + # method under a specified parent catalog. + rpc :GetDefaultBranch, ::Google::Cloud::Retail::V2::GetDefaultBranchRequest, ::Google::Cloud::Retail::V2::GetDefaultBranchResponse + # Gets a [CompletionConfig][google.cloud.retail.v2.CompletionConfig]. + rpc :GetCompletionConfig, ::Google::Cloud::Retail::V2::GetCompletionConfigRequest, ::Google::Cloud::Retail::V2::CompletionConfig + # Updates the [CompletionConfig][google.cloud.retail.v2.CompletionConfig]s. + rpc :UpdateCompletionConfig, ::Google::Cloud::Retail::V2::UpdateCompletionConfigRequest, ::Google::Cloud::Retail::V2::CompletionConfig + # Gets an [AttributesConfig][google.cloud.retail.v2.AttributesConfig]. + rpc :GetAttributesConfig, ::Google::Cloud::Retail::V2::GetAttributesConfigRequest, ::Google::Cloud::Retail::V2::AttributesConfig + # Updates the [AttributesConfig][google.cloud.retail.v2.AttributesConfig]. + # + # The catalog attributes in the request will be updated in the catalog, or + # inserted if they do not exist. Existing catalog attributes not included in + # the request will remain unchanged. Attributes that are assigned to + # products, but do not exist at the catalog level, are always included in the + # response. The product attribute is assigned default values for missing + # catalog attribute fields, e.g., searchable and dynamic facetable options. + rpc :UpdateAttributesConfig, ::Google::Cloud::Retail::V2::UpdateAttributesConfigRequest, ::Google::Cloud::Retail::V2::AttributesConfig + # Adds the specified + # [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to the + # [AttributesConfig][google.cloud.retail.v2.AttributesConfig]. + # + # If the [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to add + # already exists, an ALREADY_EXISTS error is returned. + rpc :AddCatalogAttribute, ::Google::Cloud::Retail::V2::AddCatalogAttributeRequest, ::Google::Cloud::Retail::V2::AttributesConfig + # Removes the specified + # [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] from the + # [AttributesConfig][google.cloud.retail.v2.AttributesConfig]. + # + # If the [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to + # remove does not exist, a NOT_FOUND error is returned. + rpc :RemoveCatalogAttribute, ::Google::Cloud::Retail::V2::RemoveCatalogAttributeRequest, ::Google::Cloud::Retail::V2::AttributesConfig + # Replaces the specified + # [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] in the + # [AttributesConfig][google.cloud.retail.v2.AttributesConfig] by updating the + # catalog attribute with the same + # [CatalogAttribute.key][google.cloud.retail.v2.CatalogAttribute.key]. + # + # If the [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to + # replace does not exist, a NOT_FOUND error is returned. + rpc :ReplaceCatalogAttribute, ::Google::Cloud::Retail::V2::ReplaceCatalogAttributeRequest, ::Google::Cloud::Retail::V2::AttributesConfig + end + + Stub = Service.rpc_stub_class + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/common_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/common_pb.rb new file mode 100644 index 000000000000..275dd759e9cb --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/common_pb.rb @@ -0,0 +1,58 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/retail/v2/common.proto + +require 'google/protobuf' + +require 'google/api/field_behavior_pb' +require 'google/protobuf/timestamp_pb' + + +descriptor_data = "\n#google/cloud/retail/v2/common.proto\x12\x16google.cloud.retail.v2\x1a\x1fgoogle/api/field_behavior.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xc9\x02\n\tCondition\x12@\n\x0bquery_terms\x18\x01 \x03(\x0b\x32+.google.cloud.retail.v2.Condition.QueryTerm\x12\x46\n\x11\x61\x63tive_time_range\x18\x03 \x03(\x0b\x32+.google.cloud.retail.v2.Condition.TimeRange\x12\x17\n\x0fpage_categories\x18\x04 \x03(\t\x1a.\n\tQueryTerm\x12\r\n\x05value\x18\x01 \x01(\t\x12\x12\n\nfull_match\x18\x02 \x01(\x08\x1ai\n\tTimeRange\x12.\n\nstart_time\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12,\n\x08\x65nd_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"\xea\r\n\x04Rule\x12@\n\x0c\x62oost_action\x18\x02 \x01(\x0b\x32(.google.cloud.retail.v2.Rule.BoostActionH\x00\x12\x46\n\x0fredirect_action\x18\x03 \x01(\x0b\x32+.google.cloud.retail.v2.Rule.RedirectActionH\x00\x12S\n\x16oneway_synonyms_action\x18\x06 \x01(\x0b\x32\x31.google.cloud.retail.v2.Rule.OnewaySynonymsActionH\x00\x12T\n\x17\x64o_not_associate_action\x18\x07 \x01(\x0b\x32\x31.google.cloud.retail.v2.Rule.DoNotAssociateActionH\x00\x12L\n\x12replacement_action\x18\x08 \x01(\x0b\x32..google.cloud.retail.v2.Rule.ReplacementActionH\x00\x12\x42\n\rignore_action\x18\t \x01(\x0b\x32).google.cloud.retail.v2.Rule.IgnoreActionH\x00\x12\x42\n\rfilter_action\x18\n \x01(\x0b\x32).google.cloud.retail.v2.Rule.FilterActionH\x00\x12S\n\x16twoway_synonyms_action\x18\x0b \x01(\x0b\x32\x31.google.cloud.retail.v2.Rule.TwowaySynonymsActionH\x00\x12X\n\x19\x66orce_return_facet_action\x18\x0c \x01(\x0b\x32\x33.google.cloud.retail.v2.Rule.ForceReturnFacetActionH\x00\x12M\n\x13remove_facet_action\x18\r \x01(\x0b\x32..google.cloud.retail.v2.Rule.RemoveFacetActionH\x00\x12<\n\npin_action\x18\x0e \x01(\x0b\x32&.google.cloud.retail.v2.Rule.PinActionH\x00\x12\x39\n\tcondition\x18\x01 \x01(\x0b\x32!.google.cloud.retail.v2.ConditionB\x03\xe0\x41\x02\x1a\x35\n\x0b\x42oostAction\x12\r\n\x05\x62oost\x18\x01 \x01(\x02\x12\x17\n\x0fproducts_filter\x18\x02 \x01(\t\x1a\x1e\n\x0c\x46ilterAction\x12\x0e\n\x06\x66ilter\x18\x01 \x01(\t\x1a&\n\x0eRedirectAction\x12\x14\n\x0credirect_uri\x18\x01 \x01(\t\x1a(\n\x14TwowaySynonymsAction\x12\x10\n\x08synonyms\x18\x01 \x03(\t\x1aS\n\x14OnewaySynonymsAction\x12\x13\n\x0bquery_terms\x18\x03 \x03(\t\x12\x10\n\x08synonyms\x18\x04 \x03(\t\x12\x14\n\x0coneway_terms\x18\x02 \x03(\t\x1aZ\n\x14\x44oNotAssociateAction\x12\x13\n\x0bquery_terms\x18\x02 \x03(\t\x12\x1e\n\x16\x64o_not_associate_terms\x18\x03 \x03(\t\x12\r\n\x05terms\x18\x01 \x03(\t\x1aP\n\x11ReplacementAction\x12\x13\n\x0bquery_terms\x18\x02 \x03(\t\x12\x18\n\x10replacement_term\x18\x03 \x01(\t\x12\x0c\n\x04term\x18\x01 \x01(\t\x1a$\n\x0cIgnoreAction\x12\x14\n\x0cignore_terms\x18\x01 \x03(\t\x1a\xce\x01\n\x16\x46orceReturnFacetAction\x12o\n\x1a\x66\x61\x63\x65t_position_adjustments\x18\x01 \x03(\x0b\x32K.google.cloud.retail.v2.Rule.ForceReturnFacetAction.FacetPositionAdjustment\x1a\x43\n\x17\x46\x61\x63\x65tPositionAdjustment\x12\x16\n\x0e\x61ttribute_name\x18\x01 \x01(\t\x12\x10\n\x08position\x18\x02 \x01(\x05\x1a,\n\x11RemoveFacetAction\x12\x17\n\x0f\x61ttribute_names\x18\x01 \x03(\t\x1a\x84\x01\n\tPinAction\x12H\n\x07pin_map\x18\x01 \x03(\x0b\x32\x32.google.cloud.retail.v2.Rule.PinAction.PinMapEntryB\x03\xe0\x41\x02\x1a-\n\x0bPinMapEntry\x12\x0b\n\x03key\x18\x01 \x01(\x03\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x42\x08\n\x06\x61\x63tion\"/\n\x08\x41udience\x12\x0f\n\x07genders\x18\x01 \x03(\t\x12\x12\n\nage_groups\x18\x02 \x03(\t\"3\n\tColorInfo\x12\x16\n\x0e\x63olor_families\x18\x01 \x03(\t\x12\x0e\n\x06\x63olors\x18\x02 \x03(\t\"\x86\x01\n\x0f\x43ustomAttribute\x12\x0c\n\x04text\x18\x01 \x03(\t\x12\x0f\n\x07numbers\x18\x02 \x03(\x01\x12\x1b\n\nsearchable\x18\x03 \x01(\x08\x42\x02\x18\x01H\x00\x88\x01\x01\x12\x1a\n\tindexable\x18\x04 \x01(\x08\x42\x02\x18\x01H\x01\x88\x01\x01\x42\r\n\x0b_searchableB\x0c\n\n_indexable\"2\n\x0f\x46ulfillmentInfo\x12\x0c\n\x04type\x18\x01 \x01(\t\x12\x11\n\tplace_ids\x18\x02 \x03(\t\"8\n\x05Image\x12\x10\n\x03uri\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x0e\n\x06height\x18\x02 \x01(\x05\x12\r\n\x05width\x18\x03 \x01(\x05\"x\n\x08Interval\x12\x11\n\x07minimum\x18\x01 \x01(\x01H\x00\x12\x1b\n\x11\x65xclusive_minimum\x18\x02 \x01(\x01H\x00\x12\x11\n\x07maximum\x18\x03 \x01(\x01H\x01\x12\x1b\n\x11\x65xclusive_maximum\x18\x04 \x01(\x01H\x01\x42\x05\n\x03minB\x05\n\x03max\"\x89\x03\n\tPriceInfo\x12\x15\n\rcurrency_code\x18\x01 \x01(\t\x12\r\n\x05price\x18\x02 \x01(\x02\x12\x16\n\x0eoriginal_price\x18\x03 \x01(\x02\x12\x0c\n\x04\x63ost\x18\x04 \x01(\x02\x12\x38\n\x14price_effective_time\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x35\n\x11price_expire_time\x18\x06 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x46\n\x0bprice_range\x18\x07 \x01(\x0b\x32,.google.cloud.retail.v2.PriceInfo.PriceRangeB\x03\xe0\x41\x03\x1aw\n\nPriceRange\x12/\n\x05price\x18\x01 \x01(\x0b\x32 .google.cloud.retail.v2.Interval\x12\x38\n\x0eoriginal_price\x18\x02 \x01(\x0b\x32 .google.cloud.retail.v2.Interval\"P\n\x06Rating\x12\x14\n\x0crating_count\x18\x01 \x01(\x05\x12\x16\n\x0e\x61verage_rating\x18\x02 \x01(\x02\x12\x18\n\x10rating_histogram\x18\x03 \x03(\x05\"`\n\x08UserInfo\x12\x0f\n\x07user_id\x18\x01 \x01(\t\x12\x12\n\nip_address\x18\x02 \x01(\t\x12\x12\n\nuser_agent\x18\x03 \x01(\t\x12\x1b\n\x13\x64irect_user_request\x18\x04 \x01(\x08\"\xb0\x02\n\x0eLocalInventory\x12\x15\n\x08place_id\x18\x01 \x01(\tB\x03\xe0\x41\x01\x12:\n\nprice_info\x18\x02 \x01(\x0b\x32!.google.cloud.retail.v2.PriceInfoB\x03\xe0\x41\x01\x12O\n\nattributes\x18\x03 \x03(\x0b\x32\x36.google.cloud.retail.v2.LocalInventory.AttributesEntryB\x03\xe0\x41\x01\x12\x1e\n\x11\x66ulfillment_types\x18\x04 \x03(\tB\x03\xe0\x41\x01\x1aZ\n\x0f\x41ttributesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x36\n\x05value\x18\x02 \x01(\x0b\x32\'.google.cloud.retail.v2.CustomAttribute:\x02\x38\x01\"\xbf\x03\n\x12PinControlMetadata\x12X\n\x10\x61ll_matched_pins\x18\x01 \x03(\x0b\x32>.google.cloud.retail.v2.PinControlMetadata.AllMatchedPinsEntry\x12Q\n\x0c\x64ropped_pins\x18\x02 \x03(\x0b\x32;.google.cloud.retail.v2.PinControlMetadata.DroppedPinsEntry\x1a!\n\x0bProductPins\x12\x12\n\nproduct_id\x18\x01 \x03(\t\x1am\n\x13\x41llMatchedPinsEntry\x12\x0b\n\x03key\x18\x01 \x01(\x03\x12\x45\n\x05value\x18\x02 \x01(\x0b\x32\x36.google.cloud.retail.v2.PinControlMetadata.ProductPins:\x02\x38\x01\x1aj\n\x10\x44roppedPinsEntry\x12\x0b\n\x03key\x18\x01 \x01(\x03\x12\x45\n\x05value\x18\x02 \x01(\x0b\x32\x36.google.cloud.retail.v2.PinControlMetadata.ProductPins:\x02\x38\x01\"\x1c\n\nStringList\x12\x0e\n\x06values\x18\x01 \x03(\t\"\x1c\n\nDoubleList\x12\x0e\n\x06values\x18\x01 \x03(\x01*\x86\x01\n\x14\x41ttributeConfigLevel\x12&\n\"ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED\x10\x00\x12\"\n\x1ePRODUCT_LEVEL_ATTRIBUTE_CONFIG\x10\x01\x12\"\n\x1e\x43\x41TALOG_LEVEL_ATTRIBUTE_CONFIG\x10\x02*i\n\x0cSolutionType\x12\x1d\n\x19SOLUTION_TYPE_UNSPECIFIED\x10\x00\x12 \n\x1cSOLUTION_TYPE_RECOMMENDATION\x10\x01\x12\x18\n\x14SOLUTION_TYPE_SEARCH\x10\x02*\xa1\x01\n\x1eRecommendationsFilteringOption\x12\x30\n,RECOMMENDATIONS_FILTERING_OPTION_UNSPECIFIED\x10\x00\x12&\n\"RECOMMENDATIONS_FILTERING_DISABLED\x10\x01\x12%\n!RECOMMENDATIONS_FILTERING_ENABLED\x10\x03*\x8b\x01\n\x15SearchSolutionUseCase\x12(\n$SEARCH_SOLUTION_USE_CASE_UNSPECIFIED\x10\x00\x12#\n\x1fSEARCH_SOLUTION_USE_CASE_SEARCH\x10\x01\x12#\n\x1fSEARCH_SOLUTION_USE_CASE_BROWSE\x10\x02\x42\xb6\x01\n\x1a\x63om.google.cloud.retail.v2B\x0b\x43ommonProtoP\x01Z2cloud.google.com/go/retail/apiv2/retailpb;retailpb\xa2\x02\x06RETAIL\xaa\x02\x16Google.Cloud.Retail.V2\xca\x02\x16Google\\Cloud\\Retail\\V2\xea\x02\x19Google::Cloud::Retail::V2b\x06proto3" + +pool = ::Google::Protobuf::DescriptorPool.generated_pool +pool.add_serialized_file(descriptor_data) + +module Google + module Cloud + module Retail + module V2 + Condition = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Condition").msgclass + Condition::QueryTerm = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Condition.QueryTerm").msgclass + Condition::TimeRange = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Condition.TimeRange").msgclass + Rule = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Rule").msgclass + Rule::BoostAction = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Rule.BoostAction").msgclass + Rule::FilterAction = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Rule.FilterAction").msgclass + Rule::RedirectAction = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Rule.RedirectAction").msgclass + Rule::TwowaySynonymsAction = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Rule.TwowaySynonymsAction").msgclass + Rule::OnewaySynonymsAction = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Rule.OnewaySynonymsAction").msgclass + Rule::DoNotAssociateAction = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Rule.DoNotAssociateAction").msgclass + Rule::ReplacementAction = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Rule.ReplacementAction").msgclass + Rule::IgnoreAction = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Rule.IgnoreAction").msgclass + Rule::ForceReturnFacetAction = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Rule.ForceReturnFacetAction").msgclass + Rule::ForceReturnFacetAction::FacetPositionAdjustment = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Rule.ForceReturnFacetAction.FacetPositionAdjustment").msgclass + Rule::RemoveFacetAction = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Rule.RemoveFacetAction").msgclass + Rule::PinAction = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Rule.PinAction").msgclass + Audience = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Audience").msgclass + ColorInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ColorInfo").msgclass + CustomAttribute = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CustomAttribute").msgclass + FulfillmentInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.FulfillmentInfo").msgclass + Image = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Image").msgclass + Interval = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Interval").msgclass + PriceInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.PriceInfo").msgclass + PriceInfo::PriceRange = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.PriceInfo.PriceRange").msgclass + Rating = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Rating").msgclass + UserInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.UserInfo").msgclass + LocalInventory = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.LocalInventory").msgclass + PinControlMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.PinControlMetadata").msgclass + PinControlMetadata::ProductPins = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.PinControlMetadata.ProductPins").msgclass + StringList = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.StringList").msgclass + DoubleList = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.DoubleList").msgclass + AttributeConfigLevel = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.AttributeConfigLevel").enummodule + SolutionType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SolutionType").enummodule + RecommendationsFilteringOption = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.RecommendationsFilteringOption").enummodule + SearchSolutionUseCase = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchSolutionUseCase").enummodule + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service.rb new file mode 100644 index 000000000000..910963175533 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service.rb @@ -0,0 +1,59 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/common" +require "gapic/config" +require "gapic/config/method" + +require "google/cloud/retail/v2/version" + +require "google/cloud/retail/v2/completion_service/credentials" +require "google/cloud/retail/v2/completion_service/paths" +require "google/cloud/retail/v2/completion_service/operations" +require "google/cloud/retail/v2/completion_service/client" +require "google/cloud/retail/v2/completion_service/rest" + +module Google + module Cloud + module Retail + module V2 + ## + # Autocomplete service for retail. + # + # This feature is only available for users who have Retail Search enabled. + # Enable Retail Search on Cloud Console before using this feature. + # + # @example Load this service and instantiate a gRPC client + # + # require "google/cloud/retail/v2/completion_service" + # client = ::Google::Cloud::Retail::V2::CompletionService::Client.new + # + # @example Load this service and instantiate a REST client + # + # require "google/cloud/retail/v2/completion_service/rest" + # client = ::Google::Cloud::Retail::V2::CompletionService::Rest::Client.new + # + module CompletionService + end + end + end + end +end + +helper_path = ::File.join __dir__, "completion_service", "helpers.rb" +require "google/cloud/retail/v2/completion_service/helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/client.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/client.rb new file mode 100644 index 000000000000..956d00b4dee1 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/client.rb @@ -0,0 +1,716 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/cloud/retail/v2/completion_service_pb" +require "google/cloud/location" + +module Google + module Cloud + module Retail + module V2 + module CompletionService + ## + # Client for the CompletionService service. + # + # Autocomplete service for retail. + # + # This feature is only available for users who have Retail Search enabled. + # Enable Retail Search on Cloud Console before using this feature. + # + class Client + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" + + include Paths + + # @private + attr_reader :completion_service_stub + + ## + # Configure the CompletionService Client class. + # + # See {::Google::Cloud::Retail::V2::CompletionService::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all CompletionService clients + # ::Google::Cloud::Retail::V2::CompletionService::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "Retail", "V2"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config.timeout = 5.0 + default_config.retry_policy = { + initial_delay: 0.1, max_delay: 5.0, multiplier: 1.3, retry_codes: [14, 4] + } + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the CompletionService Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Cloud::Retail::V2::CompletionService::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @completion_service_stub.universe_domain + end + + ## + # Create a new CompletionService client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::Retail::V2::CompletionService::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::Retail::V2::CompletionService::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the CompletionService client. + # @yieldparam config [Client::Configuration] + # + def initialize + # These require statements are intentionally placed here to initialize + # the gRPC module only when it's required. + # See https://github.com/googleapis/toolkit/issues/446 + require "gapic/grpc" + require "google/cloud/retail/v2/completion_service_services_pb" + + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @operations_client = Operations.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain + end + + @completion_service_stub = ::Gapic::ServiceStub.new( + ::Google::Cloud::Retail::V2::CompletionService::Stub, + credentials: credentials, + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + channel_args: @config.channel_args, + interceptors: @config.interceptors, + channel_pool_config: @config.channel_pool, + logger: @config.logger + ) + + @completion_service_stub.stub_logger&.info do |entry| + entry.set_system_name + entry.set_service + entry.message = "Created client for #{entry.service}" + entry.set_credentials_fields credentials + entry.set "customEndpoint", @config.endpoint if @config.endpoint + entry.set "defaultTimeout", @config.timeout if @config.timeout + entry.set "quotaProject", @quota_project_id if @quota_project_id + end + + @location_client = Google::Cloud::Location::Locations::Client.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @completion_service_stub.endpoint + config.universe_domain = @completion_service_stub.universe_domain + config.logger = @completion_service_stub.logger if config.respond_to? :logger= + end + end + + ## + # Get the associated client for long-running operations. + # + # @return [::Google::Cloud::Retail::V2::CompletionService::Operations] + # + attr_reader :operations_client + + ## + # Get the associated client for mix-in of the Locations. + # + # @return [Google::Cloud::Location::Locations::Client] + # + attr_reader :location_client + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @completion_service_stub.logger + end + + # Service calls + + ## + # Completes the specified prefix with keyword suggestions. + # + # This feature is only available for users who have Retail Search enabled. + # Enable Retail Search on Cloud Console before using this feature. + # + # @overload complete_query(request, options = nil) + # Pass arguments to `complete_query` via a request object, either of type + # {::Google::Cloud::Retail::V2::CompleteQueryRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::CompleteQueryRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload complete_query(catalog: nil, query: nil, visitor_id: nil, language_codes: nil, device_type: nil, dataset: nil, max_suggestions: nil, enable_attribute_suggestions: nil, entity: nil) + # Pass arguments to `complete_query` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param catalog [::String] + # Required. Catalog for which the completion is performed. + # + # Full resource name of catalog, such as + # `projects/*/locations/global/catalogs/default_catalog`. + # @param query [::String] + # Required. The query used to generate suggestions. + # + # The maximum number of allowed characters is 255. + # @param visitor_id [::String] + # Recommended field. A unique identifier for tracking visitors. For example, + # this could be implemented with an HTTP cookie, which should be able to + # uniquely identify a visitor on a single device. This unique identifier + # should not change if the visitor logs in or out of the website. + # + # The field must be a UTF-8 encoded string with a length limit of 128 + # characters. Otherwise, an INVALID_ARGUMENT error is returned. + # @param language_codes [::Array<::String>] + # Note that this field applies for `user-data` dataset only. For requests + # with `cloud-retail` dataset, setting this field has no effect. + # + # The language filters applied to the output suggestions. If set, it should + # contain the language of the query. If not set, suggestions are returned + # without considering language restrictions. This is the BCP-47 language + # code, such as "en-US" or "sr-Latn". For more information, see [Tags for + # Identifying Languages](https://tools.ietf.org/html/bcp47). The maximum + # number of language codes is 3. + # @param device_type [::String] + # The device type context for completion suggestions. We recommend that you + # leave this field empty. + # + # It can apply different suggestions on different device types, e.g. + # `DESKTOP`, `MOBILE`. If it is empty, the suggestions are across all device + # types. + # + # Supported formats: + # + # * `UNKNOWN_DEVICE_TYPE` + # + # * `DESKTOP` + # + # * `MOBILE` + # + # * A customized string starts with `OTHER_`, e.g. `OTHER_IPHONE`. + # @param dataset [::String] + # Determines which dataset to use for fetching completion. "user-data" will + # use the dataset imported through + # {::Google::Cloud::Retail::V2::CompletionService::Client#import_completion_data CompletionService.ImportCompletionData}. + # `cloud-retail` will use the dataset generated by Cloud Retail based on user + # events. If left empty, completions will be fetched from the `user-data` + # dataset. + # + # Current supported values: + # + # * user-data + # + # * cloud-retail: + # This option requires enabling auto-learning function first. See + # [guidelines](https://cloud.google.com/retail/docs/completion-overview#generated-completion-dataset). + # @param max_suggestions [::Integer] + # Completion max suggestions. If left unset or set to 0, then will fallback + # to the configured value + # {::Google::Cloud::Retail::V2::CompletionConfig#max_suggestions CompletionConfig.max_suggestions}. + # + # The maximum allowed max suggestions is 20. If it is set higher, it will be + # capped by 20. + # @param enable_attribute_suggestions [::Boolean] + # If true, attribute suggestions are enabled and provided in the response. + # + # This field is only available for the `cloud-retail` dataset. + # @param entity [::String] + # The entity for customers who run multiple entities, domains, sites, or + # regions, for example, `Google US`, `Google Ads`, `Waymo`, + # `google.com`, `youtube.com`, etc. + # If this is set, it must be an exact match with + # {::Google::Cloud::Retail::V2::UserEvent#entity UserEvent.entity} to get + # per-entity autocomplete results. This field will be applied to + # `completion_results` only. It has no effect on the `attribute_results`. + # Also, this entity should be limited to 256 characters, if too long, it will + # be truncated to 256 characters in both generation and serving time, and may + # lead to mis-match. To ensure it works, please set the entity with string + # within 256 characters. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Retail::V2::CompleteQueryResponse] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Retail::V2::CompleteQueryResponse] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::CompletionService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::CompleteQueryRequest.new + # + # # Call the complete_query method. + # result = client.complete_query request + # + # # The returned object is of type Google::Cloud::Retail::V2::CompleteQueryResponse. + # p result + # + def complete_query request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::CompleteQueryRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.complete_query.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.catalog + header_params["catalog"] = request.catalog + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.complete_query.timeout, + metadata: metadata, + retry_policy: @config.rpcs.complete_query.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @completion_service_stub.call_rpc :complete_query, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Bulk import of processed completion dataset. + # + # Request processing is asynchronous. Partial updating is not supported. + # + # The operation is successfully finished only after the imported suggestions + # are indexed successfully and ready for serving. The process takes hours. + # + # This feature is only available for users who have Retail Search enabled. + # Enable Retail Search on Cloud Console before using this feature. + # + # @overload import_completion_data(request, options = nil) + # Pass arguments to `import_completion_data` via a request object, either of type + # {::Google::Cloud::Retail::V2::ImportCompletionDataRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::ImportCompletionDataRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload import_completion_data(parent: nil, input_config: nil, notification_pubsub_topic: nil) + # Pass arguments to `import_completion_data` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. The catalog which the suggestions dataset belongs to. + # + # Format: `projects/1234/locations/global/catalogs/default_catalog`. + # @param input_config [::Google::Cloud::Retail::V2::CompletionDataInputConfig, ::Hash] + # Required. The desired input location of the data. + # @param notification_pubsub_topic [::String] + # Pub/Sub topic for receiving notification. If this field is set, + # when the import is finished, a notification is sent to + # specified Pub/Sub topic. The message data is JSON string of a + # {::Google::Longrunning::Operation Operation}. + # Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::CompletionService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::ImportCompletionDataRequest.new + # + # # Call the import_completion_data method. + # result = client.import_completion_data request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def import_completion_data request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ImportCompletionDataRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.import_completion_data.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.import_completion_data.timeout, + metadata: metadata, + retry_policy: @config.rpcs.import_completion_data.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @completion_service_stub.call_rpc :import_completion_data, request, options: options do |response, operation| + response = ::Gapic::Operation.new response, @operations_client, options: options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the CompletionService API. + # + # This class represents the configuration for CompletionService, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::Retail::V2::CompletionService::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # complete_query to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Retail::V2::CompletionService::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.complete_query.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Retail::V2::CompletionService::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.complete_query.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`GRPC::Core::Channel`) a gRPC channel with included credentials + # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object + # * (`nil`) indicating no credentials + # + # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials + # is deprecated. Providing an unvalidated credential configuration to + # Google APIs can compromise the security of your systems and data. + # + # @example + # + # # The recommended way to provide credentials is to use the `make_creds` method + # # on the appropriate credentials class for your environment. + # + # require "googleauth" + # + # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds( + # json_key_io: ::File.open("/path/to/keyfile.json") + # ) + # + # client = ::Google::Cloud::Retail::V2::CompletionService::Client.new do |config| + # config.credentials = credentials + # end + # + # @note Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] channel_args + # Extra parameters passed to the gRPC channel. Note: this is ignored if a + # `GRPC::Core::Channel` object is provided as the credential. + # @return [::Hash] + # @!attribute [rw] interceptors + # An array of interceptors that are run before calls are executed. + # @return [::Array<::GRPC::ClientInterceptor>] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional gRPC headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "retail.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) + config_attr :interceptors, nil, ::Array, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration for the channel pool + # @return [::Gapic::ServiceStub::ChannelPool::Configuration] + # + def channel_pool + @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new + end + + ## + # Configuration RPC class for the CompletionService API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `complete_query` + # @return [::Gapic::Config::Method] + # + attr_reader :complete_query + ## + # RPC-specific configuration for `import_completion_data` + # @return [::Gapic::Config::Method] + # + attr_reader :import_completion_data + + # @private + def initialize parent_rpcs = nil + complete_query_config = parent_rpcs.complete_query if parent_rpcs.respond_to? :complete_query + @complete_query = ::Gapic::Config::Method.new complete_query_config + import_completion_data_config = parent_rpcs.import_completion_data if parent_rpcs.respond_to? :import_completion_data + @import_completion_data = ::Gapic::Config::Method.new import_completion_data_config + + yield self if block_given? + end + end + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/credentials.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/credentials.rb new file mode 100644 index 000000000000..fad74ea58827 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/credentials.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "googleauth" + +module Google + module Cloud + module Retail + module V2 + module CompletionService + # Credentials for the CompletionService API. + class Credentials < ::Google::Auth::Credentials + self.scope = [ + "https://www.googleapis.com/auth/cloud-platform" + ] + self.env_vars = [ + "RETAIL_CREDENTIALS", + "RETAIL_KEYFILE", + "GOOGLE_CLOUD_CREDENTIALS", + "GOOGLE_CLOUD_KEYFILE", + "GCLOUD_KEYFILE", + "RETAIL_CREDENTIALS_JSON", + "RETAIL_KEYFILE_JSON", + "GOOGLE_CLOUD_CREDENTIALS_JSON", + "GOOGLE_CLOUD_KEYFILE_JSON", + "GCLOUD_KEYFILE_JSON" + ] + self.paths = [ + "~/.config/google_cloud/application_default_credentials.json" + ] + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/operations.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/operations.rb new file mode 100644 index 000000000000..0c0957f84195 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/operations.rb @@ -0,0 +1,843 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/operation" +require "google/longrunning/operations_pb" + +module Google + module Cloud + module Retail + module V2 + module CompletionService + # Service that implements Longrunning Operations API. + class Operations + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" + + # @private + attr_reader :operations_stub + + ## + # Configuration for the CompletionService Operations API. + # + # @yield [config] Configure the Operations client. + # @yieldparam config [Operations::Configuration] + # + # @return [Operations::Configuration] + # + def self.configure + @configure ||= Operations::Configuration.new + yield @configure if block_given? + @configure + end + + ## + # Configure the CompletionService Operations instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Operations.configure}. + # + # @yield [config] Configure the Operations client. + # @yieldparam config [Operations::Configuration] + # + # @return [Operations::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @operations_stub.universe_domain + end + + ## + # Create a new Operations client object. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Operations::Configuration] + # + def initialize + # These require statements are intentionally placed here to initialize + # the gRPC module only when it's required. + # See https://github.com/googleapis/toolkit/issues/446 + require "gapic/grpc" + require "google/longrunning/operations_services_pb" + + # Create the configuration object + @config = Configuration.new Operations.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + credentials ||= Credentials.default scope: @config.scope + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @operations_stub = ::Gapic::ServiceStub.new( + ::Google::Longrunning::Operations::Stub, + credentials: credentials, + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + channel_args: @config.channel_args, + interceptors: @config.interceptors, + channel_pool_config: @config.channel_pool + ) + + # Used by an LRO wrapper for some methods of this service + @operations_client = self + end + + # Service calls + + ## + # Lists operations that match the specified filter in the request. If the + # server doesn't support this method, it returns `UNIMPLEMENTED`. + # + # @overload list_operations(request, options = nil) + # Pass arguments to `list_operations` via a request object, either of type + # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::ListOperationsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload list_operations(name: nil, filter: nil, page_size: nil, page_token: nil, return_partial_success: nil) + # Pass arguments to `list_operations` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation's parent resource. + # @param filter [::String] + # The standard list filter. + # @param page_size [::Integer] + # The standard list page size. + # @param page_token [::String] + # The standard list page token. + # @param return_partial_success [::Boolean] + # When set to `true`, operations that are reachable are returned as normal, + # and those that are unreachable are returned in the + # [ListOperationsResponse.unreachable] field. + # + # This can only be `true` when reading across collections e.g. when `parent` + # is set to `"projects/example/locations/-"`. + # + # This field is not by default supported and will result in an + # `UNIMPLEMENTED` error if set unless explicitly documented otherwise in + # service or product specific documentation. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::PagedEnumerable<::Gapic::Operation>] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::PagedEnumerable<::Gapic::Operation>] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::ListOperationsRequest.new + # + # # Call the list_operations method. + # result = client.list_operations request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Longrunning::Operation. + # p item + # end + # + def list_operations request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::ListOperationsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.list_operations.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.list_operations.timeout, + metadata: metadata, + retry_policy: @config.rpcs.list_operations.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.call_rpc :list_operations, request, options: options do |response, operation| + wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client } + response = ::Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets the latest state of a long-running operation. Clients can use this + # method to poll the operation result at intervals as recommended by the API + # service. + # + # @overload get_operation(request, options = nil) + # Pass arguments to `get_operation` via a request object, either of type + # {::Google::Longrunning::GetOperationRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::GetOperationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload get_operation(name: nil) + # Pass arguments to `get_operation` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation resource. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::GetOperationRequest.new + # + # # Call the get_operation method. + # result = client.get_operation request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def get_operation request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::GetOperationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.get_operation.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.get_operation.timeout, + metadata: metadata, + retry_policy: @config.rpcs.get_operation.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.call_rpc :get_operation, request, options: options do |response, operation| + response = ::Gapic::Operation.new response, @operations_client, options: options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Deletes a long-running operation. This method indicates that the client is + # no longer interested in the operation result. It does not cancel the + # operation. If the server doesn't support this method, it returns + # `google.rpc.Code.UNIMPLEMENTED`. + # + # @overload delete_operation(request, options = nil) + # Pass arguments to `delete_operation` via a request object, either of type + # {::Google::Longrunning::DeleteOperationRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::DeleteOperationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload delete_operation(name: nil) + # Pass arguments to `delete_operation` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation resource to be deleted. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Protobuf::Empty] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Protobuf::Empty] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::DeleteOperationRequest.new + # + # # Call the delete_operation method. + # result = client.delete_operation request + # + # # The returned object is of type Google::Protobuf::Empty. + # p result + # + def delete_operation request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::DeleteOperationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.delete_operation.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.delete_operation.timeout, + metadata: metadata, + retry_policy: @config.rpcs.delete_operation.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.call_rpc :delete_operation, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Starts asynchronous cancellation on a long-running operation. The server + # makes a best effort to cancel the operation, but success is not + # guaranteed. If the server doesn't support this method, it returns + # `google.rpc.Code.UNIMPLEMENTED`. Clients can use + # Operations.GetOperation or + # other methods to check whether the cancellation succeeded or whether the + # operation completed despite cancellation. On successful cancellation, + # the operation is not deleted; instead, it becomes an operation with + # an {::Google::Longrunning::Operation#error Operation.error} value with a + # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to + # `Code.CANCELLED`. + # + # @overload cancel_operation(request, options = nil) + # Pass arguments to `cancel_operation` via a request object, either of type + # {::Google::Longrunning::CancelOperationRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::CancelOperationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload cancel_operation(name: nil) + # Pass arguments to `cancel_operation` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation resource to be cancelled. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Protobuf::Empty] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Protobuf::Empty] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::CancelOperationRequest.new + # + # # Call the cancel_operation method. + # result = client.cancel_operation request + # + # # The returned object is of type Google::Protobuf::Empty. + # p result + # + def cancel_operation request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::CancelOperationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.cancel_operation.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.cancel_operation.timeout, + metadata: metadata, + retry_policy: @config.rpcs.cancel_operation.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Waits until the specified long-running operation is done or reaches at most + # a specified timeout, returning the latest state. If the operation is + # already done, the latest state is immediately returned. If the timeout + # specified is greater than the default HTTP/RPC timeout, the HTTP/RPC + # timeout is used. If the server does not support this method, it returns + # `google.rpc.Code.UNIMPLEMENTED`. + # Note that this method is on a best-effort basis. It may return the latest + # state before the specified timeout (including immediately), meaning even an + # immediate response is no guarantee that the operation is done. + # + # @overload wait_operation(request, options = nil) + # Pass arguments to `wait_operation` via a request object, either of type + # {::Google::Longrunning::WaitOperationRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::WaitOperationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload wait_operation(name: nil, timeout: nil) + # Pass arguments to `wait_operation` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation resource to wait on. + # @param timeout [::Google::Protobuf::Duration, ::Hash] + # The maximum duration to wait before timing out. If left blank, the wait + # will be at most the time permitted by the underlying HTTP/RPC protocol. + # If RPC context deadline is also specified, the shorter one will be used. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::WaitOperationRequest.new + # + # # Call the wait_operation method. + # result = client.wait_operation request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def wait_operation request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::WaitOperationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.wait_operation.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.wait_operation.timeout, + metadata: metadata, + retry_policy: @config.rpcs.wait_operation.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation| + response = ::Gapic::Operation.new response, @operations_client, options: options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the Operations API. + # + # This class represents the configuration for Operations, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Longrunning::Operations::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # list_operations to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Longrunning::Operations::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.list_operations.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Longrunning::Operations::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.list_operations.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`GRPC::Core::Channel`) a gRPC channel with included credentials + # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object + # * (`nil`) indicating no credentials + # + # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials + # is deprecated. Providing an unvalidated credential configuration to + # Google APIs can compromise the security of your systems and data. + # + # @example + # + # # The recommended way to provide credentials is to use the `make_creds` method + # # on the appropriate credentials class for your environment. + # + # require "googleauth" + # + # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds( + # json_key_io: ::File.open("/path/to/keyfile.json") + # ) + # + # client = ::Google::Longrunning::Operations::Client.new do |config| + # config.credentials = credentials + # end + # + # @note Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] channel_args + # Extra parameters passed to the gRPC channel. Note: this is ignored if a + # `GRPC::Core::Channel` object is provided as the credential. + # @return [::Hash] + # @!attribute [rw] interceptors + # An array of interceptors that are run before calls are executed. + # @return [::Array<::GRPC::ClientInterceptor>] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional gRPC headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "retail.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) + config_attr :interceptors, nil, ::Array, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration for the channel pool + # @return [::Gapic::ServiceStub::ChannelPool::Configuration] + # + def channel_pool + @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new + end + + ## + # Configuration RPC class for the Operations API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `list_operations` + # @return [::Gapic::Config::Method] + # + attr_reader :list_operations + ## + # RPC-specific configuration for `get_operation` + # @return [::Gapic::Config::Method] + # + attr_reader :get_operation + ## + # RPC-specific configuration for `delete_operation` + # @return [::Gapic::Config::Method] + # + attr_reader :delete_operation + ## + # RPC-specific configuration for `cancel_operation` + # @return [::Gapic::Config::Method] + # + attr_reader :cancel_operation + ## + # RPC-specific configuration for `wait_operation` + # @return [::Gapic::Config::Method] + # + attr_reader :wait_operation + + # @private + def initialize parent_rpcs = nil + list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations + @list_operations = ::Gapic::Config::Method.new list_operations_config + get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation + @get_operation = ::Gapic::Config::Method.new get_operation_config + delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation + @delete_operation = ::Gapic::Config::Method.new delete_operation_config + cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation + @cancel_operation = ::Gapic::Config::Method.new cancel_operation_config + wait_operation_config = parent_rpcs.wait_operation if parent_rpcs.respond_to? :wait_operation + @wait_operation = ::Gapic::Config::Method.new wait_operation_config + + yield self if block_given? + end + end + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/paths.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/paths.rb new file mode 100644 index 000000000000..600b86ed9a0d --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/paths.rb @@ -0,0 +1,52 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Retail + module V2 + module CompletionService + # Path helper methods for the CompletionService API. + module Paths + ## + # Create a fully-qualified Catalog resource string. + # + # The resource will be in the following format: + # + # `projects/{project}/locations/{location}/catalogs/{catalog}` + # + # @param project [String] + # @param location [String] + # @param catalog [String] + # + # @return [::String] + def catalog_path project:, location:, catalog: + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" + + "projects/#{project}/locations/#{location}/catalogs/#{catalog}" + end + + extend self + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/rest.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/rest.rb new file mode 100644 index 000000000000..1cf8247a53be --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/rest.rb @@ -0,0 +1,56 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/rest" +require "gapic/config" +require "gapic/config/method" + +require "google/cloud/retail/v2/version" + +require "google/cloud/retail/v2/completion_service/credentials" +require "google/cloud/retail/v2/completion_service/paths" +require "google/cloud/retail/v2/completion_service/rest/operations" +require "google/cloud/retail/v2/completion_service/rest/client" + +module Google + module Cloud + module Retail + module V2 + ## + # Autocomplete service for retail. + # + # This feature is only available for users who have Retail Search enabled. + # Enable Retail Search on Cloud Console before using this feature. + # + # To load this service and instantiate a REST client: + # + # require "google/cloud/retail/v2/completion_service/rest" + # client = ::Google::Cloud::Retail::V2::CompletionService::Rest::Client.new + # + module CompletionService + # Client for the REST transport + module Rest + end + end + end + end + end +end + +helper_path = ::File.join __dir__, "rest", "helpers.rb" +require "google/cloud/retail/v2/completion_service/rest/helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/rest/client.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/rest/client.rb new file mode 100644 index 000000000000..7e1ea70c6b10 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/rest/client.rb @@ -0,0 +1,659 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/cloud/retail/v2/completion_service_pb" +require "google/cloud/retail/v2/completion_service/rest/service_stub" +require "google/cloud/location/rest" + +module Google + module Cloud + module Retail + module V2 + module CompletionService + module Rest + ## + # REST client for the CompletionService service. + # + # Autocomplete service for retail. + # + # This feature is only available for users who have Retail Search enabled. + # Enable Retail Search on Cloud Console before using this feature. + # + class Client + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" + + include Paths + + # @private + attr_reader :completion_service_stub + + ## + # Configure the CompletionService Client class. + # + # See {::Google::Cloud::Retail::V2::CompletionService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all CompletionService clients + # ::Google::Cloud::Retail::V2::CompletionService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "Retail", "V2"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config.timeout = 5.0 + default_config.retry_policy = { + initial_delay: 0.1, max_delay: 5.0, multiplier: 1.3, retry_codes: [14, 4] + } + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the CompletionService Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Cloud::Retail::V2::CompletionService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @completion_service_stub.universe_domain + end + + ## + # Create a new CompletionService REST client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::Retail::V2::CompletionService::Rest::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::Retail::V2::CompletionService::Rest::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the CompletionService client. + # @yieldparam config [Client::Configuration] + # + def initialize + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @operations_client = ::Google::Cloud::Retail::V2::CompletionService::Rest::Operations.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain + end + + @completion_service_stub = ::Google::Cloud::Retail::V2::CompletionService::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials, + logger: @config.logger + ) + + @completion_service_stub.logger(stub: true)&.info do |entry| + entry.set_system_name + entry.set_service + entry.message = "Created client for #{entry.service}" + entry.set_credentials_fields credentials + entry.set "customEndpoint", @config.endpoint if @config.endpoint + entry.set "defaultTimeout", @config.timeout if @config.timeout + entry.set "quotaProject", @quota_project_id if @quota_project_id + end + + @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @completion_service_stub.endpoint + config.universe_domain = @completion_service_stub.universe_domain + config.logger = @completion_service_stub.logger if config.respond_to? :logger= + end + end + + ## + # Get the associated client for long-running operations. + # + # @return [::Google::Cloud::Retail::V2::CompletionService::Rest::Operations] + # + attr_reader :operations_client + + ## + # Get the associated client for mix-in of the Locations. + # + # @return [Google::Cloud::Location::Locations::Rest::Client] + # + attr_reader :location_client + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @completion_service_stub.logger + end + + # Service calls + + ## + # Completes the specified prefix with keyword suggestions. + # + # This feature is only available for users who have Retail Search enabled. + # Enable Retail Search on Cloud Console before using this feature. + # + # @overload complete_query(request, options = nil) + # Pass arguments to `complete_query` via a request object, either of type + # {::Google::Cloud::Retail::V2::CompleteQueryRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::CompleteQueryRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload complete_query(catalog: nil, query: nil, visitor_id: nil, language_codes: nil, device_type: nil, dataset: nil, max_suggestions: nil, enable_attribute_suggestions: nil, entity: nil) + # Pass arguments to `complete_query` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param catalog [::String] + # Required. Catalog for which the completion is performed. + # + # Full resource name of catalog, such as + # `projects/*/locations/global/catalogs/default_catalog`. + # @param query [::String] + # Required. The query used to generate suggestions. + # + # The maximum number of allowed characters is 255. + # @param visitor_id [::String] + # Recommended field. A unique identifier for tracking visitors. For example, + # this could be implemented with an HTTP cookie, which should be able to + # uniquely identify a visitor on a single device. This unique identifier + # should not change if the visitor logs in or out of the website. + # + # The field must be a UTF-8 encoded string with a length limit of 128 + # characters. Otherwise, an INVALID_ARGUMENT error is returned. + # @param language_codes [::Array<::String>] + # Note that this field applies for `user-data` dataset only. For requests + # with `cloud-retail` dataset, setting this field has no effect. + # + # The language filters applied to the output suggestions. If set, it should + # contain the language of the query. If not set, suggestions are returned + # without considering language restrictions. This is the BCP-47 language + # code, such as "en-US" or "sr-Latn". For more information, see [Tags for + # Identifying Languages](https://tools.ietf.org/html/bcp47). The maximum + # number of language codes is 3. + # @param device_type [::String] + # The device type context for completion suggestions. We recommend that you + # leave this field empty. + # + # It can apply different suggestions on different device types, e.g. + # `DESKTOP`, `MOBILE`. If it is empty, the suggestions are across all device + # types. + # + # Supported formats: + # + # * `UNKNOWN_DEVICE_TYPE` + # + # * `DESKTOP` + # + # * `MOBILE` + # + # * A customized string starts with `OTHER_`, e.g. `OTHER_IPHONE`. + # @param dataset [::String] + # Determines which dataset to use for fetching completion. "user-data" will + # use the dataset imported through + # {::Google::Cloud::Retail::V2::CompletionService::Rest::Client#import_completion_data CompletionService.ImportCompletionData}. + # `cloud-retail` will use the dataset generated by Cloud Retail based on user + # events. If left empty, completions will be fetched from the `user-data` + # dataset. + # + # Current supported values: + # + # * user-data + # + # * cloud-retail: + # This option requires enabling auto-learning function first. See + # [guidelines](https://cloud.google.com/retail/docs/completion-overview#generated-completion-dataset). + # @param max_suggestions [::Integer] + # Completion max suggestions. If left unset or set to 0, then will fallback + # to the configured value + # {::Google::Cloud::Retail::V2::CompletionConfig#max_suggestions CompletionConfig.max_suggestions}. + # + # The maximum allowed max suggestions is 20. If it is set higher, it will be + # capped by 20. + # @param enable_attribute_suggestions [::Boolean] + # If true, attribute suggestions are enabled and provided in the response. + # + # This field is only available for the `cloud-retail` dataset. + # @param entity [::String] + # The entity for customers who run multiple entities, domains, sites, or + # regions, for example, `Google US`, `Google Ads`, `Waymo`, + # `google.com`, `youtube.com`, etc. + # If this is set, it must be an exact match with + # {::Google::Cloud::Retail::V2::UserEvent#entity UserEvent.entity} to get + # per-entity autocomplete results. This field will be applied to + # `completion_results` only. It has no effect on the `attribute_results`. + # Also, this entity should be limited to 256 characters, if too long, it will + # be truncated to 256 characters in both generation and serving time, and may + # lead to mis-match. To ensure it works, please set the entity with string + # within 256 characters. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::CompleteQueryResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::CompleteQueryResponse] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::CompletionService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::CompleteQueryRequest.new + # + # # Call the complete_query method. + # result = client.complete_query request + # + # # The returned object is of type Google::Cloud::Retail::V2::CompleteQueryResponse. + # p result + # + def complete_query request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::CompleteQueryRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.complete_query.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.complete_query.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.complete_query.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @completion_service_stub.complete_query request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Bulk import of processed completion dataset. + # + # Request processing is asynchronous. Partial updating is not supported. + # + # The operation is successfully finished only after the imported suggestions + # are indexed successfully and ready for serving. The process takes hours. + # + # This feature is only available for users who have Retail Search enabled. + # Enable Retail Search on Cloud Console before using this feature. + # + # @overload import_completion_data(request, options = nil) + # Pass arguments to `import_completion_data` via a request object, either of type + # {::Google::Cloud::Retail::V2::ImportCompletionDataRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::ImportCompletionDataRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload import_completion_data(parent: nil, input_config: nil, notification_pubsub_topic: nil) + # Pass arguments to `import_completion_data` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. The catalog which the suggestions dataset belongs to. + # + # Format: `projects/1234/locations/global/catalogs/default_catalog`. + # @param input_config [::Google::Cloud::Retail::V2::CompletionDataInputConfig, ::Hash] + # Required. The desired input location of the data. + # @param notification_pubsub_topic [::String] + # Pub/Sub topic for receiving notification. If this field is set, + # when the import is finished, a notification is sent to + # specified Pub/Sub topic. The message data is JSON string of a + # {::Google::Longrunning::Operation Operation}. + # Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::CompletionService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::ImportCompletionDataRequest.new + # + # # Call the import_completion_data method. + # result = client.import_completion_data request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def import_completion_data request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ImportCompletionDataRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.import_completion_data.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.import_completion_data.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.import_completion_data.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @completion_service_stub.import_completion_data request, options do |result, operation| + result = ::Gapic::Operation.new result, @operations_client, options: options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the CompletionService REST API. + # + # This class represents the configuration for CompletionService REST, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::Retail::V2::CompletionService::Rest::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # complete_query to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Retail::V2::CompletionService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.complete_query.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Retail::V2::CompletionService::Rest::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.complete_query.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`String`) The path to a service account key file in JSON format + # * (`Hash`) A service account key as a Hash + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`nil`) indicating no credentials + # + # Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "retail.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration RPC class for the CompletionService API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `complete_query` + # @return [::Gapic::Config::Method] + # + attr_reader :complete_query + ## + # RPC-specific configuration for `import_completion_data` + # @return [::Gapic::Config::Method] + # + attr_reader :import_completion_data + + # @private + def initialize parent_rpcs = nil + complete_query_config = parent_rpcs.complete_query if parent_rpcs.respond_to? :complete_query + @complete_query = ::Gapic::Config::Method.new complete_query_config + import_completion_data_config = parent_rpcs.import_completion_data if parent_rpcs.respond_to? :import_completion_data + @import_completion_data = ::Gapic::Config::Method.new import_completion_data_config + + yield self if block_given? + end + end + end + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/rest/operations.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/rest/operations.rb new file mode 100644 index 000000000000..ab0fc41898c9 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/rest/operations.rb @@ -0,0 +1,962 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/operation" + +module Google + module Cloud + module Retail + module V2 + module CompletionService + module Rest + # Service that implements Longrunning Operations API. + class Operations + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" + + # @private + attr_reader :operations_stub + + ## + # Configuration for the CompletionService Operations API. + # + # @yield [config] Configure the Operations client. + # @yieldparam config [Operations::Configuration] + # + # @return [Operations::Configuration] + # + def self.configure + @configure ||= Operations::Configuration.new + yield @configure if block_given? + @configure + end + + ## + # Configure the CompletionService Operations instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Operations.configure}. + # + # @yield [config] Configure the Operations client. + # @yieldparam config [Operations::Configuration] + # + # @return [Operations::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @operations_stub.universe_domain + end + + ## + # Create a new Operations client object. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Operations::Configuration] + # + def initialize + # Create the configuration object + @config = Configuration.new Operations.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + credentials ||= Credentials.default scope: @config.scope + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @operations_stub = OperationsServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials + ) + + # Used by an LRO wrapper for some methods of this service + @operations_client = self + end + + # Service calls + + ## + # Lists operations that match the specified filter in the request. If the + # server doesn't support this method, it returns `UNIMPLEMENTED`. + # + # @overload list_operations(request, options = nil) + # Pass arguments to `list_operations` via a request object, either of type + # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::ListOperationsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload list_operations(name: nil, filter: nil, page_size: nil, page_token: nil, return_partial_success: nil) + # Pass arguments to `list_operations` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation's parent resource. + # @param filter [::String] + # The standard list filter. + # @param page_size [::Integer] + # The standard list page size. + # @param page_token [::String] + # The standard list page token. + # @param return_partial_success [::Boolean] + # When set to `true`, operations that are reachable are returned as normal, + # and those that are unreachable are returned in the + # [ListOperationsResponse.unreachable] field. + # + # This can only be `true` when reading across collections e.g. when `parent` + # is set to `"projects/example/locations/-"`. + # + # This field is not by default supported and will result in an + # `UNIMPLEMENTED` error if set unless explicitly documented otherwise in + # service or product specific documentation. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::ListOperationsRequest.new + # + # # Call the list_operations method. + # result = client.list_operations request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Longrunning::Operation. + # p item + # end + # + def list_operations request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::ListOperationsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.list_operations.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.list_operations.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.list_operations.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.list_operations request, options do |result, operation| + result = ::Gapic::Rest::PagedEnumerable.new @operations_stub, :list_operations, "operations", request, result, options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets the latest state of a long-running operation. Clients can use this + # method to poll the operation result at intervals as recommended by the API + # service. + # + # @overload get_operation(request, options = nil) + # Pass arguments to `get_operation` via a request object, either of type + # {::Google::Longrunning::GetOperationRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::GetOperationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload get_operation(name: nil) + # Pass arguments to `get_operation` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation resource. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::GetOperationRequest.new + # + # # Call the get_operation method. + # result = client.get_operation request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def get_operation request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::GetOperationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.get_operation.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.get_operation.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.get_operation.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.get_operation request, options do |result, operation| + result = ::Gapic::Operation.new result, @operations_client, options: options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Deletes a long-running operation. This method indicates that the client is + # no longer interested in the operation result. It does not cancel the + # operation. If the server doesn't support this method, it returns + # `google.rpc.Code.UNIMPLEMENTED`. + # + # @overload delete_operation(request, options = nil) + # Pass arguments to `delete_operation` via a request object, either of type + # {::Google::Longrunning::DeleteOperationRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::DeleteOperationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload delete_operation(name: nil) + # Pass arguments to `delete_operation` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation resource to be deleted. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Protobuf::Empty] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Protobuf::Empty] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::DeleteOperationRequest.new + # + # # Call the delete_operation method. + # result = client.delete_operation request + # + # # The returned object is of type Google::Protobuf::Empty. + # p result + # + def delete_operation request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::DeleteOperationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.delete_operation.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.delete_operation.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.delete_operation.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.delete_operation request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Starts asynchronous cancellation on a long-running operation. The server + # makes a best effort to cancel the operation, but success is not + # guaranteed. If the server doesn't support this method, it returns + # `google.rpc.Code.UNIMPLEMENTED`. Clients can use + # Operations.GetOperation or + # other methods to check whether the cancellation succeeded or whether the + # operation completed despite cancellation. On successful cancellation, + # the operation is not deleted; instead, it becomes an operation with + # an {::Google::Longrunning::Operation#error Operation.error} value with a + # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to + # `Code.CANCELLED`. + # + # @overload cancel_operation(request, options = nil) + # Pass arguments to `cancel_operation` via a request object, either of type + # {::Google::Longrunning::CancelOperationRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::CancelOperationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload cancel_operation(name: nil) + # Pass arguments to `cancel_operation` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation resource to be cancelled. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Protobuf::Empty] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Protobuf::Empty] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::CancelOperationRequest.new + # + # # Call the cancel_operation method. + # result = client.cancel_operation request + # + # # The returned object is of type Google::Protobuf::Empty. + # p result + # + def cancel_operation request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::CancelOperationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.cancel_operation.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.cancel_operation.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.cancel_operation.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.cancel_operation request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the Operations REST API. + # + # This class represents the configuration for Operations REST, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Longrunning::Operations::Rest::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # list_operations to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Longrunning::Operations::Rest::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.list_operations.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Longrunning::Operations::Rest::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.list_operations.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`String`) The path to a service account key file in JSON format + # * (`Hash`) A service account key as a Hash + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`nil`) indicating no credentials + # + # Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "retail.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration RPC class for the Operations API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `list_operations` + # @return [::Gapic::Config::Method] + # + attr_reader :list_operations + ## + # RPC-specific configuration for `get_operation` + # @return [::Gapic::Config::Method] + # + attr_reader :get_operation + ## + # RPC-specific configuration for `delete_operation` + # @return [::Gapic::Config::Method] + # + attr_reader :delete_operation + ## + # RPC-specific configuration for `cancel_operation` + # @return [::Gapic::Config::Method] + # + attr_reader :cancel_operation + + # @private + def initialize parent_rpcs = nil + list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations + @list_operations = ::Gapic::Config::Method.new list_operations_config + get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation + @get_operation = ::Gapic::Config::Method.new get_operation_config + delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation + @delete_operation = ::Gapic::Config::Method.new delete_operation_config + cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation + @cancel_operation = ::Gapic::Config::Method.new cancel_operation_config + + yield self if block_given? + end + end + end + end + + ## + # @private + # REST service stub for the Longrunning Operations API. + # Service stub contains baseline method implementations + # including transcoding, making the REST call, and deserialing the response. + class OperationsServiceStub + def initialize endpoint:, endpoint_template:, universe_domain:, credentials: + # These require statements are intentionally placed here to initialize + # the REST modules only when it's required. + require "gapic/rest" + + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials + end + + ## + # Baseline implementation for the list_operations REST call + # + # @param request_pb [::Google::Longrunning::ListOperationsRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::ListOperationsResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::ListOperationsResponse] + # A result object deserialized from the server's reply + def list_operations request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = OperationsServiceStub.transcode_list_operations_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "list_operations", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::ListOperationsResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the get_operation REST call + # + # @param request_pb [::Google::Longrunning::GetOperationRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::Operation] + # A result object deserialized from the server's reply + def get_operation request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = OperationsServiceStub.transcode_get_operation_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "get_operation", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the delete_operation REST call + # + # @param request_pb [::Google::Longrunning::DeleteOperationRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Protobuf::Empty] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Protobuf::Empty] + # A result object deserialized from the server's reply + def delete_operation request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = OperationsServiceStub.transcode_delete_operation_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "delete_operation", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the cancel_operation REST call + # + # @param request_pb [::Google::Longrunning::CancelOperationRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Protobuf::Empty] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Protobuf::Empty] + # A result object deserialized from the server's reply + def cancel_operation request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = OperationsServiceStub.transcode_cancel_operation_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "cancel_operation", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # @private + # + # GRPC transcoding helper method for the list_operations REST call + # + # @param request_pb [::Google::Longrunning::ListOperationsRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_list_operations_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v2/{name}/operations", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/?$}, false] + ] + ) + .with_bindings( + uri_method: :get, + uri_template: "/v2/{name}/operations", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] + ] + ) + .with_bindings( + uri_method: :get, + uri_template: "/v2/{name}/operations", + matches: [ + ["name", %r{^projects/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the get_operation REST call + # + # @param request_pb [::Google::Longrunning::GetOperationRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_get_operation_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v2/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/operations/[^/]+/?$}, false] + ] + ) + .with_bindings( + uri_method: :get, + uri_template: "/v2/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/branches/[^/]+/operations/[^/]+/?$}, false] + ] + ) + .with_bindings( + uri_method: :get, + uri_template: "/v2/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/operations/[^/]+/?$}, false] + ] + ) + .with_bindings( + uri_method: :get, + uri_template: "/v2/{name}", + matches: [ + ["name", %r{^projects/[^/]+/operations/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the delete_operation REST call + # + # @param request_pb [::Google::Longrunning::DeleteOperationRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_delete_operation_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :delete, + uri_template: "/v1/{name}", + matches: [ + ["name", %r{^operations(?:/(?<__wildcard__>.*))?$}, true] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the cancel_operation REST call + # + # @param request_pb [::Google::Longrunning::CancelOperationRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_cancel_operation_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/{name}:cancel", + body: "*", + matches: [ + ["name", %r{^operations(?:/(?<__wildcard__>.*))?$}, true] + ] + ) + transcoder.transcode request_pb + end + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/rest/service_stub.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/rest/service_stub.rb new file mode 100644 index 000000000000..31957d90f097 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/rest/service_stub.rb @@ -0,0 +1,204 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/retail/v2/completion_service_pb" + +module Google + module Cloud + module Retail + module V2 + module CompletionService + module Rest + ## + # REST service stub for the CompletionService service. + # Service stub contains baseline method implementations + # including transcoding, making the REST call, and deserialing the response. + # + class ServiceStub + # @private + def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger: + # These require statements are intentionally placed here to initialize + # the REST modules only when it's required. + require "gapic/rest" + + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials, + numeric_enums: true, + service_name: self.class, + raise_faraday_errors: false, + logger: logger + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @client_stub.universe_domain + end + + ## + # The effective endpoint + # + # @return [String] + # + def endpoint + @client_stub.endpoint + end + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger stub: false + stub ? @client_stub.stub_logger : @client_stub.logger + end + + ## + # Baseline implementation for the complete_query REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::CompleteQueryRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::CompleteQueryResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::CompleteQueryResponse] + # A result object deserialized from the server's reply + def complete_query request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_complete_query_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "complete_query", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Retail::V2::CompleteQueryResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the import_completion_data REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::ImportCompletionDataRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::Operation] + # A result object deserialized from the server's reply + def import_completion_data request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_import_completion_data_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "import_completion_data", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # @private + # + # GRPC transcoding helper method for the complete_query REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::CompleteQueryRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_complete_query_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v2/{catalog}:completeQuery", + matches: [ + ["catalog", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the import_completion_data REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::ImportCompletionDataRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_import_completion_data_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v2/{parent}/completionData:import", + body: "*", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service_pb.rb new file mode 100644 index 000000000000..6f2a2a1fdade --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service_pb.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/retail/v2/completion_service.proto + +require 'google/protobuf' + +require 'google/api/annotations_pb' +require 'google/api/client_pb' +require 'google/api/field_behavior_pb' +require 'google/api/resource_pb' +require 'google/cloud/retail/v2/common_pb' +require 'google/cloud/retail/v2/import_config_pb' +require 'google/longrunning/operations_pb' + + +descriptor_data = "\n/google/cloud/retail/v2/completion_service.proto\x12\x16google.cloud.retail.v2\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a#google/cloud/retail/v2/common.proto\x1a*google/cloud/retail/v2/import_config.proto\x1a#google/longrunning/operations.proto\"\x83\x02\n\x14\x43ompleteQueryRequest\x12\x36\n\x07\x63\x61talog\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\n\x1dretail.googleapis.com/Catalog\x12\x12\n\x05query\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\x12\n\nvisitor_id\x18\x07 \x01(\t\x12\x16\n\x0elanguage_codes\x18\x03 \x03(\t\x12\x13\n\x0b\x64\x65vice_type\x18\x04 \x01(\t\x12\x0f\n\x07\x64\x61taset\x18\x06 \x01(\t\x12\x17\n\x0fmax_suggestions\x18\x05 \x01(\x05\x12$\n\x1c\x65nable_attribute_suggestions\x18\t \x01(\x08\x12\x0e\n\x06\x65ntity\x18\n \x01(\t\"\x8d\x06\n\x15\x43ompleteQueryResponse\x12Z\n\x12\x63ompletion_results\x18\x01 \x03(\x0b\x32>.google.cloud.retail.v2.CompleteQueryResponse.CompletionResult\x12\x19\n\x11\x61ttribution_token\x18\x02 \x01(\t\x12\x63\n\x15recent_search_results\x18\x03 \x03(\x0b\x32@.google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResultB\x02\x18\x01\x12^\n\x11\x61ttribute_results\x18\x04 \x03(\x0b\x32\x43.google.cloud.retail.v2.CompleteQueryResponse.AttributeResultsEntry\x1a\xe6\x01\n\x10\x43ompletionResult\x12\x12\n\nsuggestion\x18\x01 \x01(\t\x12\x62\n\nattributes\x18\x02 \x03(\x0b\x32N.google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.AttributesEntry\x1aZ\n\x0f\x41ttributesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x36\n\x05value\x18\x02 \x01(\x0b\x32\'.google.cloud.retail.v2.CustomAttribute:\x02\x38\x01\x1a/\n\x12RecentSearchResult\x12\x15\n\rrecent_search\x18\x01 \x01(\t:\x02\x18\x01\x1a&\n\x0f\x41ttributeResult\x12\x13\n\x0bsuggestions\x18\x01 \x03(\t\x1av\n\x15\x41ttributeResultsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12L\n\x05value\x18\x02 \x01(\x0b\x32=.google.cloud.retail.v2.CompleteQueryResponse.AttributeResult:\x02\x38\x01\x32\xb2\x04\n\x11\x43ompletionService\x12\xb3\x01\n\rCompleteQuery\x12,.google.cloud.retail.v2.CompleteQueryRequest\x1a-.google.cloud.retail.v2.CompleteQueryResponse\"E\x82\xd3\xe4\x93\x02?\x12=/v2/{catalog=projects/*/locations/*/catalogs/*}:completeQuery\x12\x9b\x02\n\x14ImportCompletionData\x12\x33.google.cloud.retail.v2.ImportCompletionDataRequest\x1a\x1d.google.longrunning.Operation\"\xae\x01\xca\x41\\\n3google.cloud.retail.v2.ImportCompletionDataResponse\x12%google.cloud.retail.v2.ImportMetadata\x82\xd3\xe4\x93\x02I\"D/v2/{parent=projects/*/locations/*/catalogs/*}/completionData:import:\x01*\x1aI\xca\x41\x15retail.googleapis.com\xd2\x41.https://www.googleapis.com/auth/cloud-platformB\xc1\x01\n\x1a\x63om.google.cloud.retail.v2B\x16\x43ompletionServiceProtoP\x01Z2cloud.google.com/go/retail/apiv2/retailpb;retailpb\xa2\x02\x06RETAIL\xaa\x02\x16Google.Cloud.Retail.V2\xca\x02\x16Google\\Cloud\\Retail\\V2\xea\x02\x19Google::Cloud::Retail::V2b\x06proto3" + +pool = ::Google::Protobuf::DescriptorPool.generated_pool +pool.add_serialized_file(descriptor_data) + +module Google + module Cloud + module Retail + module V2 + CompleteQueryRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CompleteQueryRequest").msgclass + CompleteQueryResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CompleteQueryResponse").msgclass + CompleteQueryResponse::CompletionResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CompleteQueryResponse.CompletionResult").msgclass + CompleteQueryResponse::RecentSearchResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult").msgclass + CompleteQueryResponse::AttributeResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CompleteQueryResponse.AttributeResult").msgclass + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service_services_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service_services_pb.rb new file mode 100644 index 000000000000..64e7fdaa4af5 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service_services_pb.rb @@ -0,0 +1,61 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# Source: google/cloud/retail/v2/completion_service.proto for package 'Google.Cloud.Retail.V2' +# Original file comments: +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +require 'grpc' +require 'google/cloud/retail/v2/completion_service_pb' + +module Google + module Cloud + module Retail + module V2 + module CompletionService + # Autocomplete service for retail. + # + # This feature is only available for users who have Retail Search enabled. + # Enable Retail Search on Cloud Console before using this feature. + class Service + + include ::GRPC::GenericService + + self.marshal_class_method = :encode + self.unmarshal_class_method = :decode + self.service_name = 'google.cloud.retail.v2.CompletionService' + + # Completes the specified prefix with keyword suggestions. + # + # This feature is only available for users who have Retail Search enabled. + # Enable Retail Search on Cloud Console before using this feature. + rpc :CompleteQuery, ::Google::Cloud::Retail::V2::CompleteQueryRequest, ::Google::Cloud::Retail::V2::CompleteQueryResponse + # Bulk import of processed completion dataset. + # + # Request processing is asynchronous. Partial updating is not supported. + # + # The operation is successfully finished only after the imported suggestions + # are indexed successfully and ready for serving. The process takes hours. + # + # This feature is only available for users who have Retail Search enabled. + # Enable Retail Search on Cloud Console before using this feature. + rpc :ImportCompletionData, ::Google::Cloud::Retail::V2::ImportCompletionDataRequest, ::Google::Longrunning::Operation + end + + Stub = Service.rpc_stub_class + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_pb.rb new file mode 100644 index 000000000000..6b4f341f7d2a --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_pb.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/retail/v2/control.proto + +require 'google/protobuf' + +require 'google/api/field_behavior_pb' +require 'google/api/resource_pb' +require 'google/cloud/retail/v2/common_pb' + + +descriptor_data = "\n$google/cloud/retail/v2/control.proto\x12\x16google.cloud.retail.v2\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a#google/cloud/retail/v2/common.proto\"\xa6\x03\n\x07\x43ontrol\x12,\n\x04rule\x18\x04 \x01(\x0b\x32\x1c.google.cloud.retail.v2.RuleH\x00\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x05\x12\x19\n\x0c\x64isplay_name\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12*\n\x1d\x61ssociated_serving_config_ids\x18\x05 \x03(\tB\x03\xe0\x41\x03\x12\x44\n\x0esolution_types\x18\x06 \x03(\x0e\x32$.google.cloud.retail.v2.SolutionTypeB\x06\xe0\x41\x02\xe0\x41\x05\x12O\n\x18search_solution_use_case\x18\x07 \x03(\x0e\x32-.google.cloud.retail.v2.SearchSolutionUseCase:q\xea\x41n\n\x1dretail.googleapis.com/Control\x12Mprojects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}B\t\n\x07\x63ontrolB\xb7\x01\n\x1a\x63om.google.cloud.retail.v2B\x0c\x43ontrolProtoP\x01Z2cloud.google.com/go/retail/apiv2/retailpb;retailpb\xa2\x02\x06RETAIL\xaa\x02\x16Google.Cloud.Retail.V2\xca\x02\x16Google\\Cloud\\Retail\\V2\xea\x02\x19Google::Cloud::Retail::V2b\x06proto3" + +pool = ::Google::Protobuf::DescriptorPool.generated_pool +pool.add_serialized_file(descriptor_data) + +module Google + module Cloud + module Retail + module V2 + Control = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Control").msgclass + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service.rb new file mode 100644 index 000000000000..e93086f0a231 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service.rb @@ -0,0 +1,55 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/common" +require "gapic/config" +require "gapic/config/method" + +require "google/cloud/retail/v2/version" + +require "google/cloud/retail/v2/control_service/credentials" +require "google/cloud/retail/v2/control_service/paths" +require "google/cloud/retail/v2/control_service/client" +require "google/cloud/retail/v2/control_service/rest" + +module Google + module Cloud + module Retail + module V2 + ## + # Service for modifying Control. + # + # @example Load this service and instantiate a gRPC client + # + # require "google/cloud/retail/v2/control_service" + # client = ::Google::Cloud::Retail::V2::ControlService::Client.new + # + # @example Load this service and instantiate a REST client + # + # require "google/cloud/retail/v2/control_service/rest" + # client = ::Google::Cloud::Retail::V2::ControlService::Rest::Client.new + # + module ControlService + end + end + end + end +end + +helper_path = ::File.join __dir__, "control_service", "helpers.rb" +require "google/cloud/retail/v2/control_service/helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/client.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/client.rb new file mode 100644 index 000000000000..58f5be8a828e --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/client.rb @@ -0,0 +1,911 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/cloud/retail/v2/control_service_pb" +require "google/cloud/location" + +module Google + module Cloud + module Retail + module V2 + module ControlService + ## + # Client for the ControlService service. + # + # Service for modifying Control. + # + class Client + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" + + include Paths + + # @private + attr_reader :control_service_stub + + ## + # Configure the ControlService Client class. + # + # See {::Google::Cloud::Retail::V2::ControlService::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all ControlService clients + # ::Google::Cloud::Retail::V2::ControlService::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "Retail", "V2"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the ControlService Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Cloud::Retail::V2::ControlService::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @control_service_stub.universe_domain + end + + ## + # Create a new ControlService client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::Retail::V2::ControlService::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::Retail::V2::ControlService::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the ControlService client. + # @yieldparam config [Client::Configuration] + # + def initialize + # These require statements are intentionally placed here to initialize + # the gRPC module only when it's required. + # See https://github.com/googleapis/toolkit/issues/446 + require "gapic/grpc" + require "google/cloud/retail/v2/control_service_services_pb" + + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @control_service_stub = ::Gapic::ServiceStub.new( + ::Google::Cloud::Retail::V2::ControlService::Stub, + credentials: credentials, + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + channel_args: @config.channel_args, + interceptors: @config.interceptors, + channel_pool_config: @config.channel_pool, + logger: @config.logger + ) + + @control_service_stub.stub_logger&.info do |entry| + entry.set_system_name + entry.set_service + entry.message = "Created client for #{entry.service}" + entry.set_credentials_fields credentials + entry.set "customEndpoint", @config.endpoint if @config.endpoint + entry.set "defaultTimeout", @config.timeout if @config.timeout + entry.set "quotaProject", @quota_project_id if @quota_project_id + end + + @location_client = Google::Cloud::Location::Locations::Client.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @control_service_stub.endpoint + config.universe_domain = @control_service_stub.universe_domain + config.logger = @control_service_stub.logger if config.respond_to? :logger= + end + end + + ## + # Get the associated client for mix-in of the Locations. + # + # @return [Google::Cloud::Location::Locations::Client] + # + attr_reader :location_client + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @control_service_stub.logger + end + + # Service calls + + ## + # Creates a Control. + # + # If the {::Google::Cloud::Retail::V2::Control Control} to create already exists, + # an ALREADY_EXISTS error is returned. + # + # @overload create_control(request, options = nil) + # Pass arguments to `create_control` via a request object, either of type + # {::Google::Cloud::Retail::V2::CreateControlRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::CreateControlRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload create_control(parent: nil, control: nil, control_id: nil) + # Pass arguments to `create_control` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. Full resource name of parent catalog. Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` + # @param control [::Google::Cloud::Retail::V2::Control, ::Hash] + # Required. The Control to create. + # @param control_id [::String] + # Required. The ID to use for the Control, which will become the final + # component of the Control's resource name. + # + # This value should be 4-63 characters, and valid characters + # are /[a-z][0-9]-_/. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Retail::V2::Control] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Retail::V2::Control] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ControlService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::CreateControlRequest.new + # + # # Call the create_control method. + # result = client.create_control request + # + # # The returned object is of type Google::Cloud::Retail::V2::Control. + # p result + # + def create_control request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::CreateControlRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.create_control.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.create_control.timeout, + metadata: metadata, + retry_policy: @config.rpcs.create_control.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @control_service_stub.call_rpc :create_control, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Deletes a Control. + # + # If the {::Google::Cloud::Retail::V2::Control Control} to delete does not exist, + # a NOT_FOUND error is returned. + # + # @overload delete_control(request, options = nil) + # Pass arguments to `delete_control` via a request object, either of type + # {::Google::Cloud::Retail::V2::DeleteControlRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::DeleteControlRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload delete_control(name: nil) + # Pass arguments to `delete_control` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. The resource name of the Control to delete. Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}` + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Protobuf::Empty] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Protobuf::Empty] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ControlService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::DeleteControlRequest.new + # + # # Call the delete_control method. + # result = client.delete_control request + # + # # The returned object is of type Google::Protobuf::Empty. + # p result + # + def delete_control request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::DeleteControlRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.delete_control.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.delete_control.timeout, + metadata: metadata, + retry_policy: @config.rpcs.delete_control.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @control_service_stub.call_rpc :delete_control, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Updates a Control. + # + # {::Google::Cloud::Retail::V2::Control Control} cannot be set to a different + # oneof field, if so an INVALID_ARGUMENT is returned. If the + # {::Google::Cloud::Retail::V2::Control Control} to update does not exist, a + # NOT_FOUND error is returned. + # + # @overload update_control(request, options = nil) + # Pass arguments to `update_control` via a request object, either of type + # {::Google::Cloud::Retail::V2::UpdateControlRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::UpdateControlRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload update_control(control: nil, update_mask: nil) + # Pass arguments to `update_control` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param control [::Google::Cloud::Retail::V2::Control, ::Hash] + # Required. The Control to update. + # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] + # Indicates which fields in the provided + # {::Google::Cloud::Retail::V2::Control Control} to update. The following are NOT + # supported: + # + # * {::Google::Cloud::Retail::V2::Control#name Control.name} + # + # If not set or empty, all supported fields are updated. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Retail::V2::Control] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Retail::V2::Control] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ControlService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::UpdateControlRequest.new + # + # # Call the update_control method. + # result = client.update_control request + # + # # The returned object is of type Google::Cloud::Retail::V2::Control. + # p result + # + def update_control request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::UpdateControlRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.update_control.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.control&.name + header_params["control.name"] = request.control.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.update_control.timeout, + metadata: metadata, + retry_policy: @config.rpcs.update_control.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @control_service_stub.call_rpc :update_control, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets a Control. + # + # @overload get_control(request, options = nil) + # Pass arguments to `get_control` via a request object, either of type + # {::Google::Cloud::Retail::V2::GetControlRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::GetControlRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload get_control(name: nil) + # Pass arguments to `get_control` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. The resource name of the Control to get. Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}` + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Retail::V2::Control] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Retail::V2::Control] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ControlService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::GetControlRequest.new + # + # # Call the get_control method. + # result = client.get_control request + # + # # The returned object is of type Google::Cloud::Retail::V2::Control. + # p result + # + def get_control request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::GetControlRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.get_control.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.get_control.timeout, + metadata: metadata, + retry_policy: @config.rpcs.get_control.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @control_service_stub.call_rpc :get_control, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists all Controls by their parent + # {::Google::Cloud::Retail::V2::Catalog Catalog}. + # + # @overload list_controls(request, options = nil) + # Pass arguments to `list_controls` via a request object, either of type + # {::Google::Cloud::Retail::V2::ListControlsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::ListControlsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload list_controls(parent: nil, page_size: nil, page_token: nil, filter: nil) + # Pass arguments to `list_controls` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. The catalog resource name. Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` + # @param page_size [::Integer] + # Optional. Maximum number of results to return. If unspecified, defaults + # to 50. Max allowed value is 1000. + # @param page_token [::String] + # Optional. A page token, received from a previous `ListControls` call. + # Provide this to retrieve the subsequent page. + # @param filter [::String] + # Optional. A filter to apply on the list results. Supported features: + # + # * List all the products under the parent branch if + # {::Google::Cloud::Retail::V2::ListControlsRequest#filter filter} is unset. + # * List controls that are used in a single ServingConfig: + # 'serving_config = "boosted_home_page_cvr"' + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Retail::V2::Control>] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::PagedEnumerable<::Google::Cloud::Retail::V2::Control>] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ControlService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::ListControlsRequest.new + # + # # Call the list_controls method. + # result = client.list_controls request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Cloud::Retail::V2::Control. + # p item + # end + # + def list_controls request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ListControlsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.list_controls.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.list_controls.timeout, + metadata: metadata, + retry_policy: @config.rpcs.list_controls.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @control_service_stub.call_rpc :list_controls, request, options: options do |response, operation| + response = ::Gapic::PagedEnumerable.new @control_service_stub, :list_controls, request, response, operation, options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the ControlService API. + # + # This class represents the configuration for ControlService, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::Retail::V2::ControlService::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # create_control to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Retail::V2::ControlService::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.create_control.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Retail::V2::ControlService::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.create_control.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`GRPC::Core::Channel`) a gRPC channel with included credentials + # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object + # * (`nil`) indicating no credentials + # + # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials + # is deprecated. Providing an unvalidated credential configuration to + # Google APIs can compromise the security of your systems and data. + # + # @example + # + # # The recommended way to provide credentials is to use the `make_creds` method + # # on the appropriate credentials class for your environment. + # + # require "googleauth" + # + # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds( + # json_key_io: ::File.open("/path/to/keyfile.json") + # ) + # + # client = ::Google::Cloud::Retail::V2::ControlService::Client.new do |config| + # config.credentials = credentials + # end + # + # @note Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] channel_args + # Extra parameters passed to the gRPC channel. Note: this is ignored if a + # `GRPC::Core::Channel` object is provided as the credential. + # @return [::Hash] + # @!attribute [rw] interceptors + # An array of interceptors that are run before calls are executed. + # @return [::Array<::GRPC::ClientInterceptor>] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional gRPC headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "retail.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) + config_attr :interceptors, nil, ::Array, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration for the channel pool + # @return [::Gapic::ServiceStub::ChannelPool::Configuration] + # + def channel_pool + @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new + end + + ## + # Configuration RPC class for the ControlService API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `create_control` + # @return [::Gapic::Config::Method] + # + attr_reader :create_control + ## + # RPC-specific configuration for `delete_control` + # @return [::Gapic::Config::Method] + # + attr_reader :delete_control + ## + # RPC-specific configuration for `update_control` + # @return [::Gapic::Config::Method] + # + attr_reader :update_control + ## + # RPC-specific configuration for `get_control` + # @return [::Gapic::Config::Method] + # + attr_reader :get_control + ## + # RPC-specific configuration for `list_controls` + # @return [::Gapic::Config::Method] + # + attr_reader :list_controls + + # @private + def initialize parent_rpcs = nil + create_control_config = parent_rpcs.create_control if parent_rpcs.respond_to? :create_control + @create_control = ::Gapic::Config::Method.new create_control_config + delete_control_config = parent_rpcs.delete_control if parent_rpcs.respond_to? :delete_control + @delete_control = ::Gapic::Config::Method.new delete_control_config + update_control_config = parent_rpcs.update_control if parent_rpcs.respond_to? :update_control + @update_control = ::Gapic::Config::Method.new update_control_config + get_control_config = parent_rpcs.get_control if parent_rpcs.respond_to? :get_control + @get_control = ::Gapic::Config::Method.new get_control_config + list_controls_config = parent_rpcs.list_controls if parent_rpcs.respond_to? :list_controls + @list_controls = ::Gapic::Config::Method.new list_controls_config + + yield self if block_given? + end + end + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/credentials.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/credentials.rb new file mode 100644 index 000000000000..127904154fe5 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/credentials.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "googleauth" + +module Google + module Cloud + module Retail + module V2 + module ControlService + # Credentials for the ControlService API. + class Credentials < ::Google::Auth::Credentials + self.scope = [ + "https://www.googleapis.com/auth/cloud-platform" + ] + self.env_vars = [ + "RETAIL_CREDENTIALS", + "RETAIL_KEYFILE", + "GOOGLE_CLOUD_CREDENTIALS", + "GOOGLE_CLOUD_KEYFILE", + "GCLOUD_KEYFILE", + "RETAIL_CREDENTIALS_JSON", + "RETAIL_KEYFILE_JSON", + "GOOGLE_CLOUD_CREDENTIALS_JSON", + "GOOGLE_CLOUD_KEYFILE_JSON", + "GCLOUD_KEYFILE_JSON" + ] + self.paths = [ + "~/.config/google_cloud/application_default_credentials.json" + ] + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/paths.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/paths.rb new file mode 100644 index 000000000000..464e5d03b5ba --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/paths.rb @@ -0,0 +1,73 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Retail + module V2 + module ControlService + # Path helper methods for the ControlService API. + module Paths + ## + # Create a fully-qualified Catalog resource string. + # + # The resource will be in the following format: + # + # `projects/{project}/locations/{location}/catalogs/{catalog}` + # + # @param project [String] + # @param location [String] + # @param catalog [String] + # + # @return [::String] + def catalog_path project:, location:, catalog: + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" + + "projects/#{project}/locations/#{location}/catalogs/#{catalog}" + end + + ## + # Create a fully-qualified Control resource string. + # + # The resource will be in the following format: + # + # `projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}` + # + # @param project [String] + # @param location [String] + # @param catalog [String] + # @param control [String] + # + # @return [::String] + def control_path project:, location:, catalog:, control: + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" + raise ::ArgumentError, "catalog cannot contain /" if catalog.to_s.include? "/" + + "projects/#{project}/locations/#{location}/catalogs/#{catalog}/controls/#{control}" + end + + extend self + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/rest.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/rest.rb new file mode 100644 index 000000000000..31828796abd0 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/rest.rb @@ -0,0 +1,52 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/rest" +require "gapic/config" +require "gapic/config/method" + +require "google/cloud/retail/v2/version" + +require "google/cloud/retail/v2/control_service/credentials" +require "google/cloud/retail/v2/control_service/paths" +require "google/cloud/retail/v2/control_service/rest/client" + +module Google + module Cloud + module Retail + module V2 + ## + # Service for modifying Control. + # + # To load this service and instantiate a REST client: + # + # require "google/cloud/retail/v2/control_service/rest" + # client = ::Google::Cloud::Retail::V2::ControlService::Rest::Client.new + # + module ControlService + # Client for the REST transport + module Rest + end + end + end + end + end +end + +helper_path = ::File.join __dir__, "rest", "helpers.rb" +require "google/cloud/retail/v2/control_service/rest/helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/rest/client.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/rest/client.rb new file mode 100644 index 000000000000..8d4d1c1b8f6f --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/rest/client.rb @@ -0,0 +1,833 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/cloud/retail/v2/control_service_pb" +require "google/cloud/retail/v2/control_service/rest/service_stub" +require "google/cloud/location/rest" + +module Google + module Cloud + module Retail + module V2 + module ControlService + module Rest + ## + # REST client for the ControlService service. + # + # Service for modifying Control. + # + class Client + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" + + include Paths + + # @private + attr_reader :control_service_stub + + ## + # Configure the ControlService Client class. + # + # See {::Google::Cloud::Retail::V2::ControlService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all ControlService clients + # ::Google::Cloud::Retail::V2::ControlService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "Retail", "V2"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the ControlService Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Cloud::Retail::V2::ControlService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @control_service_stub.universe_domain + end + + ## + # Create a new ControlService REST client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::Retail::V2::ControlService::Rest::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::Retail::V2::ControlService::Rest::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the ControlService client. + # @yieldparam config [Client::Configuration] + # + def initialize + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @control_service_stub = ::Google::Cloud::Retail::V2::ControlService::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials, + logger: @config.logger + ) + + @control_service_stub.logger(stub: true)&.info do |entry| + entry.set_system_name + entry.set_service + entry.message = "Created client for #{entry.service}" + entry.set_credentials_fields credentials + entry.set "customEndpoint", @config.endpoint if @config.endpoint + entry.set "defaultTimeout", @config.timeout if @config.timeout + entry.set "quotaProject", @quota_project_id if @quota_project_id + end + + @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @control_service_stub.endpoint + config.universe_domain = @control_service_stub.universe_domain + config.logger = @control_service_stub.logger if config.respond_to? :logger= + end + end + + ## + # Get the associated client for mix-in of the Locations. + # + # @return [Google::Cloud::Location::Locations::Rest::Client] + # + attr_reader :location_client + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @control_service_stub.logger + end + + # Service calls + + ## + # Creates a Control. + # + # If the {::Google::Cloud::Retail::V2::Control Control} to create already exists, + # an ALREADY_EXISTS error is returned. + # + # @overload create_control(request, options = nil) + # Pass arguments to `create_control` via a request object, either of type + # {::Google::Cloud::Retail::V2::CreateControlRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::CreateControlRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload create_control(parent: nil, control: nil, control_id: nil) + # Pass arguments to `create_control` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. Full resource name of parent catalog. Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` + # @param control [::Google::Cloud::Retail::V2::Control, ::Hash] + # Required. The Control to create. + # @param control_id [::String] + # Required. The ID to use for the Control, which will become the final + # component of the Control's resource name. + # + # This value should be 4-63 characters, and valid characters + # are /[a-z][0-9]-_/. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::Control] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::Control] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ControlService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::CreateControlRequest.new + # + # # Call the create_control method. + # result = client.create_control request + # + # # The returned object is of type Google::Cloud::Retail::V2::Control. + # p result + # + def create_control request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::CreateControlRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.create_control.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.create_control.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.create_control.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @control_service_stub.create_control request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Deletes a Control. + # + # If the {::Google::Cloud::Retail::V2::Control Control} to delete does not exist, + # a NOT_FOUND error is returned. + # + # @overload delete_control(request, options = nil) + # Pass arguments to `delete_control` via a request object, either of type + # {::Google::Cloud::Retail::V2::DeleteControlRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::DeleteControlRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload delete_control(name: nil) + # Pass arguments to `delete_control` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. The resource name of the Control to delete. Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}` + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Protobuf::Empty] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Protobuf::Empty] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ControlService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::DeleteControlRequest.new + # + # # Call the delete_control method. + # result = client.delete_control request + # + # # The returned object is of type Google::Protobuf::Empty. + # p result + # + def delete_control request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::DeleteControlRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.delete_control.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.delete_control.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.delete_control.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @control_service_stub.delete_control request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Updates a Control. + # + # {::Google::Cloud::Retail::V2::Control Control} cannot be set to a different + # oneof field, if so an INVALID_ARGUMENT is returned. If the + # {::Google::Cloud::Retail::V2::Control Control} to update does not exist, a + # NOT_FOUND error is returned. + # + # @overload update_control(request, options = nil) + # Pass arguments to `update_control` via a request object, either of type + # {::Google::Cloud::Retail::V2::UpdateControlRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::UpdateControlRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload update_control(control: nil, update_mask: nil) + # Pass arguments to `update_control` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param control [::Google::Cloud::Retail::V2::Control, ::Hash] + # Required. The Control to update. + # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] + # Indicates which fields in the provided + # {::Google::Cloud::Retail::V2::Control Control} to update. The following are NOT + # supported: + # + # * {::Google::Cloud::Retail::V2::Control#name Control.name} + # + # If not set or empty, all supported fields are updated. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::Control] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::Control] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ControlService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::UpdateControlRequest.new + # + # # Call the update_control method. + # result = client.update_control request + # + # # The returned object is of type Google::Cloud::Retail::V2::Control. + # p result + # + def update_control request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::UpdateControlRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.update_control.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.update_control.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.update_control.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @control_service_stub.update_control request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets a Control. + # + # @overload get_control(request, options = nil) + # Pass arguments to `get_control` via a request object, either of type + # {::Google::Cloud::Retail::V2::GetControlRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::GetControlRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload get_control(name: nil) + # Pass arguments to `get_control` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. The resource name of the Control to get. Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}` + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::Control] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::Control] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ControlService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::GetControlRequest.new + # + # # Call the get_control method. + # result = client.get_control request + # + # # The returned object is of type Google::Cloud::Retail::V2::Control. + # p result + # + def get_control request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::GetControlRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.get_control.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.get_control.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.get_control.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @control_service_stub.get_control request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists all Controls by their parent + # {::Google::Cloud::Retail::V2::Catalog Catalog}. + # + # @overload list_controls(request, options = nil) + # Pass arguments to `list_controls` via a request object, either of type + # {::Google::Cloud::Retail::V2::ListControlsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::ListControlsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload list_controls(parent: nil, page_size: nil, page_token: nil, filter: nil) + # Pass arguments to `list_controls` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. The catalog resource name. Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` + # @param page_size [::Integer] + # Optional. Maximum number of results to return. If unspecified, defaults + # to 50. Max allowed value is 1000. + # @param page_token [::String] + # Optional. A page token, received from a previous `ListControls` call. + # Provide this to retrieve the subsequent page. + # @param filter [::String] + # Optional. A filter to apply on the list results. Supported features: + # + # * List all the products under the parent branch if + # {::Google::Cloud::Retail::V2::ListControlsRequest#filter filter} is unset. + # * List controls that are used in a single ServingConfig: + # 'serving_config = "boosted_home_page_cvr"' + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Retail::V2::Control>] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Retail::V2::Control>] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ControlService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::ListControlsRequest.new + # + # # Call the list_controls method. + # result = client.list_controls request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Cloud::Retail::V2::Control. + # p item + # end + # + def list_controls request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ListControlsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.list_controls.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.list_controls.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.list_controls.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @control_service_stub.list_controls request, options do |result, operation| + result = ::Gapic::Rest::PagedEnumerable.new @control_service_stub, :list_controls, "controls", request, result, options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the ControlService REST API. + # + # This class represents the configuration for ControlService REST, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::Retail::V2::ControlService::Rest::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # create_control to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Retail::V2::ControlService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.create_control.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Retail::V2::ControlService::Rest::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.create_control.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`String`) The path to a service account key file in JSON format + # * (`Hash`) A service account key as a Hash + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`nil`) indicating no credentials + # + # Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "retail.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration RPC class for the ControlService API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `create_control` + # @return [::Gapic::Config::Method] + # + attr_reader :create_control + ## + # RPC-specific configuration for `delete_control` + # @return [::Gapic::Config::Method] + # + attr_reader :delete_control + ## + # RPC-specific configuration for `update_control` + # @return [::Gapic::Config::Method] + # + attr_reader :update_control + ## + # RPC-specific configuration for `get_control` + # @return [::Gapic::Config::Method] + # + attr_reader :get_control + ## + # RPC-specific configuration for `list_controls` + # @return [::Gapic::Config::Method] + # + attr_reader :list_controls + + # @private + def initialize parent_rpcs = nil + create_control_config = parent_rpcs.create_control if parent_rpcs.respond_to? :create_control + @create_control = ::Gapic::Config::Method.new create_control_config + delete_control_config = parent_rpcs.delete_control if parent_rpcs.respond_to? :delete_control + @delete_control = ::Gapic::Config::Method.new delete_control_config + update_control_config = parent_rpcs.update_control if parent_rpcs.respond_to? :update_control + @update_control = ::Gapic::Config::Method.new update_control_config + get_control_config = parent_rpcs.get_control if parent_rpcs.respond_to? :get_control + @get_control = ::Gapic::Config::Method.new get_control_config + list_controls_config = parent_rpcs.list_controls if parent_rpcs.respond_to? :list_controls + @list_controls = ::Gapic::Config::Method.new list_controls_config + + yield self if block_given? + end + end + end + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/rest/service_stub.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/rest/service_stub.rb new file mode 100644 index 000000000000..61b0a0f77df2 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/rest/service_stub.rb @@ -0,0 +1,388 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/retail/v2/control_service_pb" + +module Google + module Cloud + module Retail + module V2 + module ControlService + module Rest + ## + # REST service stub for the ControlService service. + # Service stub contains baseline method implementations + # including transcoding, making the REST call, and deserialing the response. + # + class ServiceStub + # @private + def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger: + # These require statements are intentionally placed here to initialize + # the REST modules only when it's required. + require "gapic/rest" + + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials, + numeric_enums: true, + service_name: self.class, + raise_faraday_errors: false, + logger: logger + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @client_stub.universe_domain + end + + ## + # The effective endpoint + # + # @return [String] + # + def endpoint + @client_stub.endpoint + end + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger stub: false + stub ? @client_stub.stub_logger : @client_stub.logger + end + + ## + # Baseline implementation for the create_control REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::CreateControlRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::Control] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::Control] + # A result object deserialized from the server's reply + def create_control request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_create_control_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "create_control", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Retail::V2::Control.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the delete_control REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::DeleteControlRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Protobuf::Empty] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Protobuf::Empty] + # A result object deserialized from the server's reply + def delete_control request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_delete_control_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "delete_control", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the update_control REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::UpdateControlRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::Control] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::Control] + # A result object deserialized from the server's reply + def update_control request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_update_control_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "update_control", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Retail::V2::Control.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the get_control REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::GetControlRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::Control] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::Control] + # A result object deserialized from the server's reply + def get_control request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_get_control_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "get_control", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Retail::V2::Control.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the list_controls REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::ListControlsRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::ListControlsResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::ListControlsResponse] + # A result object deserialized from the server's reply + def list_controls request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_list_controls_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "list_controls", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Retail::V2::ListControlsResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # @private + # + # GRPC transcoding helper method for the create_control REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::CreateControlRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_create_control_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v2/{parent}/controls", + body: "control", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the delete_control REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::DeleteControlRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_delete_control_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :delete, + uri_template: "/v2/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/controls/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the update_control REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::UpdateControlRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_update_control_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :patch, + uri_template: "/v2/{control.name}", + body: "control", + matches: [ + ["control.name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/controls/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the get_control REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::GetControlRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_get_control_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v2/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/controls/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the list_controls REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::ListControlsRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_list_controls_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v2/{parent}/controls", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service_pb.rb new file mode 100644 index 000000000000..4af2840862e1 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service_pb.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/retail/v2/control_service.proto + +require 'google/protobuf' + +require 'google/api/annotations_pb' +require 'google/api/client_pb' +require 'google/api/field_behavior_pb' +require 'google/api/resource_pb' +require 'google/cloud/retail/v2/control_pb' +require 'google/protobuf/empty_pb' +require 'google/protobuf/field_mask_pb' + + +descriptor_data = "\n,google/cloud/retail/v2/control_service.proto\x12\x16google.cloud.retail.v2\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a$google/cloud/retail/v2/control.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\"\x9d\x01\n\x14\x43reateControlRequest\x12\x35\n\x06parent\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\n\x1dretail.googleapis.com/Catalog\x12\x35\n\x07\x63ontrol\x18\x02 \x01(\x0b\x32\x1f.google.cloud.retail.v2.ControlB\x03\xe0\x41\x02\x12\x17\n\ncontrol_id\x18\x03 \x01(\tB\x03\xe0\x41\x02\"~\n\x14UpdateControlRequest\x12\x35\n\x07\x63ontrol\x18\x01 \x01(\x0b\x32\x1f.google.cloud.retail.v2.ControlB\x03\xe0\x41\x02\x12/\n\x0bupdate_mask\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMask\"K\n\x14\x44\x65leteControlRequest\x12\x33\n\x04name\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\n\x1dretail.googleapis.com/Control\"H\n\x11GetControlRequest\x12\x33\n\x04name\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\n\x1dretail.googleapis.com/Control\"\x92\x01\n\x13ListControlsRequest\x12\x35\n\x06parent\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\n\x1dretail.googleapis.com/Catalog\x12\x16\n\tpage_size\x18\x02 \x01(\x05\x42\x03\xe0\x41\x01\x12\x17\n\npage_token\x18\x03 \x01(\tB\x03\xe0\x41\x01\x12\x13\n\x06\x66ilter\x18\x04 \x01(\tB\x03\xe0\x41\x01\"b\n\x14ListControlsResponse\x12\x31\n\x08\x63ontrols\x18\x01 \x03(\x0b\x32\x1f.google.cloud.retail.v2.Control\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t2\xe4\x07\n\x0e\x43ontrolService\x12\xc4\x01\n\rCreateControl\x12,.google.cloud.retail.v2.CreateControlRequest\x1a\x1f.google.cloud.retail.v2.Control\"d\xda\x41\x19parent,control,control_id\x82\xd3\xe4\x93\x02\x42\"7/v2/{parent=projects/*/locations/*/catalogs/*}/controls:\x07\x63ontrol\x12\x9d\x01\n\rDeleteControl\x12,.google.cloud.retail.v2.DeleteControlRequest\x1a\x16.google.protobuf.Empty\"F\xda\x41\x04name\x82\xd3\xe4\x93\x02\x39*7/v2/{name=projects/*/locations/*/catalogs/*/controls/*}\x12\xc6\x01\n\rUpdateControl\x12,.google.cloud.retail.v2.UpdateControlRequest\x1a\x1f.google.cloud.retail.v2.Control\"f\xda\x41\x13\x63ontrol,update_mask\x82\xd3\xe4\x93\x02J2?/v2/{control.name=projects/*/locations/*/catalogs/*/controls/*}:\x07\x63ontrol\x12\xa0\x01\n\nGetControl\x12).google.cloud.retail.v2.GetControlRequest\x1a\x1f.google.cloud.retail.v2.Control\"F\xda\x41\x04name\x82\xd3\xe4\x93\x02\x39\x12\x37/v2/{name=projects/*/locations/*/catalogs/*/controls/*}\x12\xb3\x01\n\x0cListControls\x12+.google.cloud.retail.v2.ListControlsRequest\x1a,.google.cloud.retail.v2.ListControlsResponse\"H\xda\x41\x06parent\x82\xd3\xe4\x93\x02\x39\x12\x37/v2/{parent=projects/*/locations/*/catalogs/*}/controls\x1aI\xca\x41\x15retail.googleapis.com\xd2\x41.https://www.googleapis.com/auth/cloud-platformB\xbe\x01\n\x1a\x63om.google.cloud.retail.v2B\x13\x43ontrolServiceProtoP\x01Z2cloud.google.com/go/retail/apiv2/retailpb;retailpb\xa2\x02\x06RETAIL\xaa\x02\x16Google.Cloud.Retail.V2\xca\x02\x16Google\\Cloud\\Retail\\V2\xea\x02\x19Google::Cloud::Retail::V2b\x06proto3" + +pool = ::Google::Protobuf::DescriptorPool.generated_pool +pool.add_serialized_file(descriptor_data) + +module Google + module Cloud + module Retail + module V2 + CreateControlRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CreateControlRequest").msgclass + UpdateControlRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.UpdateControlRequest").msgclass + DeleteControlRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.DeleteControlRequest").msgclass + GetControlRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.GetControlRequest").msgclass + ListControlsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ListControlsRequest").msgclass + ListControlsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ListControlsResponse").msgclass + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service_services_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service_services_pb.rb new file mode 100644 index 000000000000..bcef36f6b4c1 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service_services_pb.rb @@ -0,0 +1,65 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# Source: google/cloud/retail/v2/control_service.proto for package 'Google.Cloud.Retail.V2' +# Original file comments: +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +require 'grpc' +require 'google/cloud/retail/v2/control_service_pb' + +module Google + module Cloud + module Retail + module V2 + module ControlService + # Service for modifying Control. + class Service + + include ::GRPC::GenericService + + self.marshal_class_method = :encode + self.unmarshal_class_method = :decode + self.service_name = 'google.cloud.retail.v2.ControlService' + + # Creates a Control. + # + # If the [Control][google.cloud.retail.v2.Control] to create already exists, + # an ALREADY_EXISTS error is returned. + rpc :CreateControl, ::Google::Cloud::Retail::V2::CreateControlRequest, ::Google::Cloud::Retail::V2::Control + # Deletes a Control. + # + # If the [Control][google.cloud.retail.v2.Control] to delete does not exist, + # a NOT_FOUND error is returned. + rpc :DeleteControl, ::Google::Cloud::Retail::V2::DeleteControlRequest, ::Google::Protobuf::Empty + # Updates a Control. + # + # [Control][google.cloud.retail.v2.Control] cannot be set to a different + # oneof field, if so an INVALID_ARGUMENT is returned. If the + # [Control][google.cloud.retail.v2.Control] to update does not exist, a + # NOT_FOUND error is returned. + rpc :UpdateControl, ::Google::Cloud::Retail::V2::UpdateControlRequest, ::Google::Cloud::Retail::V2::Control + # Gets a Control. + rpc :GetControl, ::Google::Cloud::Retail::V2::GetControlRequest, ::Google::Cloud::Retail::V2::Control + # Lists all Controls by their parent + # [Catalog][google.cloud.retail.v2.Catalog]. + rpc :ListControls, ::Google::Cloud::Retail::V2::ListControlsRequest, ::Google::Cloud::Retail::V2::ListControlsResponse + end + + Stub = Service.rpc_stub_class + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service.rb new file mode 100644 index 000000000000..c3b86da366b9 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service.rb @@ -0,0 +1,59 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/common" +require "gapic/config" +require "gapic/config/method" + +require "google/cloud/retail/v2/version" + +require "google/cloud/retail/v2/conversational_search_service/credentials" +require "google/cloud/retail/v2/conversational_search_service/paths" +require "google/cloud/retail/v2/conversational_search_service/client" +require "google/cloud/retail/v2/conversational_search_service/rest" + +module Google + module Cloud + module Retail + module V2 + ## + # Service for retail conversational search. + # + # This feature is only available for users who have Retail Conversational + # Search enabled. Enable Retail Conversational Search on Cloud Console + # before using this feature. + # + # @example Load this service and instantiate a gRPC client + # + # require "google/cloud/retail/v2/conversational_search_service" + # client = ::Google::Cloud::Retail::V2::ConversationalSearchService::Client.new + # + # @example Load this service and instantiate a REST client + # + # require "google/cloud/retail/v2/conversational_search_service/rest" + # client = ::Google::Cloud::Retail::V2::ConversationalSearchService::Rest::Client.new + # + module ConversationalSearchService + end + end + end + end +end + +helper_path = ::File.join __dir__, "conversational_search_service", "helpers.rb" +require "google/cloud/retail/v2/conversational_search_service/helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/client.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/client.rb new file mode 100644 index 000000000000..0a37d6165e10 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/client.rb @@ -0,0 +1,576 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/cloud/retail/v2/conversational_search_service_pb" +require "google/cloud/location" + +module Google + module Cloud + module Retail + module V2 + module ConversationalSearchService + ## + # Client for the ConversationalSearchService service. + # + # Service for retail conversational search. + # + # This feature is only available for users who have Retail Conversational + # Search enabled. Enable Retail Conversational Search on Cloud Console + # before using this feature. + # + class Client + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" + + include Paths + + # @private + attr_reader :conversational_search_service_stub + + ## + # Configure the ConversationalSearchService Client class. + # + # See {::Google::Cloud::Retail::V2::ConversationalSearchService::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all ConversationalSearchService clients + # ::Google::Cloud::Retail::V2::ConversationalSearchService::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "Retail", "V2"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the ConversationalSearchService Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Cloud::Retail::V2::ConversationalSearchService::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @conversational_search_service_stub.universe_domain + end + + ## + # Create a new ConversationalSearchService client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::Retail::V2::ConversationalSearchService::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::Retail::V2::ConversationalSearchService::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the ConversationalSearchService client. + # @yieldparam config [Client::Configuration] + # + def initialize + # These require statements are intentionally placed here to initialize + # the gRPC module only when it's required. + # See https://github.com/googleapis/toolkit/issues/446 + require "gapic/grpc" + require "google/cloud/retail/v2/conversational_search_service_services_pb" + + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @conversational_search_service_stub = ::Gapic::ServiceStub.new( + ::Google::Cloud::Retail::V2::ConversationalSearchService::Stub, + credentials: credentials, + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + channel_args: @config.channel_args, + interceptors: @config.interceptors, + channel_pool_config: @config.channel_pool, + logger: @config.logger + ) + + @conversational_search_service_stub.stub_logger&.info do |entry| + entry.set_system_name + entry.set_service + entry.message = "Created client for #{entry.service}" + entry.set_credentials_fields credentials + entry.set "customEndpoint", @config.endpoint if @config.endpoint + entry.set "defaultTimeout", @config.timeout if @config.timeout + entry.set "quotaProject", @quota_project_id if @quota_project_id + end + + @location_client = Google::Cloud::Location::Locations::Client.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @conversational_search_service_stub.endpoint + config.universe_domain = @conversational_search_service_stub.universe_domain + config.logger = @conversational_search_service_stub.logger if config.respond_to? :logger= + end + end + + ## + # Get the associated client for mix-in of the Locations. + # + # @return [Google::Cloud::Location::Locations::Client] + # + attr_reader :location_client + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @conversational_search_service_stub.logger + end + + # Service calls + + ## + # Performs a conversational search. + # + # This feature is only available for users who have Conversational Search + # enabled. + # + # @overload conversational_search(request, options = nil) + # Pass arguments to `conversational_search` via a request object, either of type + # {::Google::Cloud::Retail::V2::ConversationalSearchRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::ConversationalSearchRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload conversational_search(placement: nil, branch: nil, query: nil, page_categories: nil, conversation_id: nil, search_params: nil, visitor_id: nil, user_info: nil, conversational_filtering_spec: nil, user_labels: nil, safety_settings: nil) + # Pass arguments to `conversational_search` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param placement [::String] + # Required. The resource name of the search engine placement, such as + # `projects/*/locations/global/catalogs/default_catalog/placements/default_search` + # or + # `projects/*/locations/global/catalogs/default_catalog/servingConfigs/default_serving_config` + # This field is used to identify the serving config name and the set + # of models that will be used to make the search. + # @param branch [::String] + # Required. The branch resource name, such as + # `projects/*/locations/global/catalogs/default_catalog/branches/0`. + # + # Use "default_branch" as the branch ID or leave this field empty, to search + # products under the default branch. + # @param query [::String] + # Optional. Raw search query to be searched for. + # + # If this field is empty, the request is considered a category browsing + # request. + # @param page_categories [::Array<::String>] + # Optional. The categories associated with a category page. Must be set for + # category navigation queries to achieve good search quality. The format + # should be the same as + # {::Google::Cloud::Retail::V2::UserEvent#page_categories UserEvent.page_categories}; + # + # To represent full path of category, use '>' sign to separate different + # hierarchies. If '>' is part of the category name, replace it with + # other character(s). + # + # Category pages include special pages such as sales or promotions. For + # instance, a special sale page may have the category hierarchy: + # "pageCategories" : ["Sales > 2017 Black Friday Deals"]. + # @param conversation_id [::String] + # Optional. This field specifies the conversation id, which maintains the + # state of the conversation between client side and server side. Use the + # value from the previous + # {::Google::Cloud::Retail::V2::ConversationalSearchResponse#conversation_id ConversationalSearchResponse.conversation_id}. + # For the initial request, this should be empty. + # @param search_params [::Google::Cloud::Retail::V2::ConversationalSearchRequest::SearchParams, ::Hash] + # Optional. Search parameters. + # @param visitor_id [::String] + # Required. A unique identifier for tracking visitors. For example, this + # could be implemented with an HTTP cookie, which should be able to uniquely + # identify a visitor on a single device. This unique identifier should not + # change if the visitor logs in or out of the website. + # + # This should be the same identifier as + # {::Google::Cloud::Retail::V2::UserEvent#visitor_id UserEvent.visitor_id}. + # + # The field must be a UTF-8 encoded string with a length limit of 128 + # characters. Otherwise, an INVALID_ARGUMENT error is returned. + # @param user_info [::Google::Cloud::Retail::V2::UserInfo, ::Hash] + # Optional. User information. + # @param conversational_filtering_spec [::Google::Cloud::Retail::V2::ConversationalSearchRequest::ConversationalFilteringSpec, ::Hash] + # Optional. This field specifies all conversational filtering related + # parameters. + # @param user_labels [::Hash{::String => ::String}] + # Optional. The user labels applied to a resource must meet the following + # requirements: + # + # * Each resource can have multiple labels, up to a maximum of 64. + # * Each label must be a key-value pair. + # * Keys have a minimum length of 1 character and a maximum length of 63 + # characters and cannot be empty. Values can be empty and have a maximum + # length of 63 characters. + # * Keys and values can contain only lowercase letters, numeric characters, + # underscores, and dashes. All characters must use UTF-8 encoding, and + # international characters are allowed. + # * The key portion of a label must be unique. However, you can use the same + # key with multiple resources. + # * Keys must start with a lowercase letter or international character. + # + # See [Google Cloud + # Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + # for more details. + # @param safety_settings [::Array<::Google::Cloud::Retail::V2::SafetySetting, ::Hash>] + # Optional. The safety settings to be applied to the generated content. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Enumerable<::Google::Cloud::Retail::V2::ConversationalSearchResponse>] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Enumerable<::Google::Cloud::Retail::V2::ConversationalSearchResponse>] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ConversationalSearchService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::ConversationalSearchRequest.new + # + # # Call the conversational_search method to start streaming. + # output = client.conversational_search request + # + # # The returned object is a streamed enumerable yielding elements of type + # # ::Google::Cloud::Retail::V2::ConversationalSearchResponse + # output.each do |current_response| + # p current_response + # end + # + def conversational_search request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ConversationalSearchRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.conversational_search.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.placement + header_params["placement"] = request.placement + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.conversational_search.timeout, + metadata: metadata, + retry_policy: @config.rpcs.conversational_search.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @conversational_search_service_stub.call_rpc :conversational_search, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the ConversationalSearchService API. + # + # This class represents the configuration for ConversationalSearchService, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::Retail::V2::ConversationalSearchService::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # conversational_search to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Retail::V2::ConversationalSearchService::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.conversational_search.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Retail::V2::ConversationalSearchService::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.conversational_search.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`GRPC::Core::Channel`) a gRPC channel with included credentials + # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object + # * (`nil`) indicating no credentials + # + # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials + # is deprecated. Providing an unvalidated credential configuration to + # Google APIs can compromise the security of your systems and data. + # + # @example + # + # # The recommended way to provide credentials is to use the `make_creds` method + # # on the appropriate credentials class for your environment. + # + # require "googleauth" + # + # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds( + # json_key_io: ::File.open("/path/to/keyfile.json") + # ) + # + # client = ::Google::Cloud::Retail::V2::ConversationalSearchService::Client.new do |config| + # config.credentials = credentials + # end + # + # @note Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] channel_args + # Extra parameters passed to the gRPC channel. Note: this is ignored if a + # `GRPC::Core::Channel` object is provided as the credential. + # @return [::Hash] + # @!attribute [rw] interceptors + # An array of interceptors that are run before calls are executed. + # @return [::Array<::GRPC::ClientInterceptor>] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional gRPC headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "retail.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) + config_attr :interceptors, nil, ::Array, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration for the channel pool + # @return [::Gapic::ServiceStub::ChannelPool::Configuration] + # + def channel_pool + @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new + end + + ## + # Configuration RPC class for the ConversationalSearchService API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `conversational_search` + # @return [::Gapic::Config::Method] + # + attr_reader :conversational_search + + # @private + def initialize parent_rpcs = nil + conversational_search_config = parent_rpcs.conversational_search if parent_rpcs.respond_to? :conversational_search + @conversational_search = ::Gapic::Config::Method.new conversational_search_config + + yield self if block_given? + end + end + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/credentials.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/credentials.rb new file mode 100644 index 000000000000..ccd5e02152d8 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/credentials.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "googleauth" + +module Google + module Cloud + module Retail + module V2 + module ConversationalSearchService + # Credentials for the ConversationalSearchService API. + class Credentials < ::Google::Auth::Credentials + self.scope = [ + "https://www.googleapis.com/auth/cloud-platform" + ] + self.env_vars = [ + "RETAIL_CREDENTIALS", + "RETAIL_KEYFILE", + "GOOGLE_CLOUD_CREDENTIALS", + "GOOGLE_CLOUD_KEYFILE", + "GCLOUD_KEYFILE", + "RETAIL_CREDENTIALS_JSON", + "RETAIL_KEYFILE_JSON", + "GOOGLE_CLOUD_CREDENTIALS_JSON", + "GOOGLE_CLOUD_KEYFILE_JSON", + "GCLOUD_KEYFILE_JSON" + ] + self.paths = [ + "~/.config/google_cloud/application_default_credentials.json" + ] + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/paths.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/paths.rb new file mode 100644 index 000000000000..f19dca726f47 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/paths.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Retail + module V2 + module ConversationalSearchService + # Path helper methods for the ConversationalSearchService API. + module Paths + ## + # Create a fully-qualified Branch resource string. + # + # The resource will be in the following format: + # + # `projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}` + # + # @param project [String] + # @param location [String] + # @param catalog [String] + # @param branch [String] + # + # @return [::String] + def branch_path project:, location:, catalog:, branch: + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" + raise ::ArgumentError, "catalog cannot contain /" if catalog.to_s.include? "/" + + "projects/#{project}/locations/#{location}/catalogs/#{catalog}/branches/#{branch}" + end + + extend self + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/rest.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/rest.rb new file mode 100644 index 000000000000..2177b82399f5 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/rest.rb @@ -0,0 +1,56 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/rest" +require "gapic/config" +require "gapic/config/method" + +require "google/cloud/retail/v2/version" + +require "google/cloud/retail/v2/conversational_search_service/credentials" +require "google/cloud/retail/v2/conversational_search_service/paths" +require "google/cloud/retail/v2/conversational_search_service/rest/client" + +module Google + module Cloud + module Retail + module V2 + ## + # Service for retail conversational search. + # + # This feature is only available for users who have Retail Conversational + # Search enabled. Enable Retail Conversational Search on Cloud Console + # before using this feature. + # + # To load this service and instantiate a REST client: + # + # require "google/cloud/retail/v2/conversational_search_service/rest" + # client = ::Google::Cloud::Retail::V2::ConversationalSearchService::Rest::Client.new + # + module ConversationalSearchService + # Client for the REST transport + module Rest + end + end + end + end + end +end + +helper_path = ::File.join __dir__, "rest", "helpers.rb" +require "google/cloud/retail/v2/conversational_search_service/rest/helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/rest/client.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/rest/client.rb new file mode 100644 index 000000000000..a4a6d12e6df2 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/rest/client.rb @@ -0,0 +1,528 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/cloud/retail/v2/conversational_search_service_pb" +require "google/cloud/retail/v2/conversational_search_service/rest/service_stub" +require "google/cloud/location/rest" + +module Google + module Cloud + module Retail + module V2 + module ConversationalSearchService + module Rest + ## + # REST client for the ConversationalSearchService service. + # + # Service for retail conversational search. + # + # This feature is only available for users who have Retail Conversational + # Search enabled. Enable Retail Conversational Search on Cloud Console + # before using this feature. + # + class Client + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" + + include Paths + + # @private + attr_reader :conversational_search_service_stub + + ## + # Configure the ConversationalSearchService Client class. + # + # See {::Google::Cloud::Retail::V2::ConversationalSearchService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all ConversationalSearchService clients + # ::Google::Cloud::Retail::V2::ConversationalSearchService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "Retail", "V2"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the ConversationalSearchService Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Cloud::Retail::V2::ConversationalSearchService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @conversational_search_service_stub.universe_domain + end + + ## + # Create a new ConversationalSearchService REST client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::Retail::V2::ConversationalSearchService::Rest::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::Retail::V2::ConversationalSearchService::Rest::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the ConversationalSearchService client. + # @yieldparam config [Client::Configuration] + # + def initialize + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @conversational_search_service_stub = ::Google::Cloud::Retail::V2::ConversationalSearchService::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials, + logger: @config.logger + ) + + @conversational_search_service_stub.logger(stub: true)&.info do |entry| + entry.set_system_name + entry.set_service + entry.message = "Created client for #{entry.service}" + entry.set_credentials_fields credentials + entry.set "customEndpoint", @config.endpoint if @config.endpoint + entry.set "defaultTimeout", @config.timeout if @config.timeout + entry.set "quotaProject", @quota_project_id if @quota_project_id + end + + @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @conversational_search_service_stub.endpoint + config.universe_domain = @conversational_search_service_stub.universe_domain + config.logger = @conversational_search_service_stub.logger if config.respond_to? :logger= + end + end + + ## + # Get the associated client for mix-in of the Locations. + # + # @return [Google::Cloud::Location::Locations::Rest::Client] + # + attr_reader :location_client + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @conversational_search_service_stub.logger + end + + # Service calls + + ## + # Performs a conversational search. + # + # This feature is only available for users who have Conversational Search + # enabled. + # + # @overload conversational_search(request, options = nil) + # Pass arguments to `conversational_search` via a request object, either of type + # {::Google::Cloud::Retail::V2::ConversationalSearchRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::ConversationalSearchRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload conversational_search(placement: nil, branch: nil, query: nil, page_categories: nil, conversation_id: nil, search_params: nil, visitor_id: nil, user_info: nil, conversational_filtering_spec: nil, user_labels: nil, safety_settings: nil) + # Pass arguments to `conversational_search` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param placement [::String] + # Required. The resource name of the search engine placement, such as + # `projects/*/locations/global/catalogs/default_catalog/placements/default_search` + # or + # `projects/*/locations/global/catalogs/default_catalog/servingConfigs/default_serving_config` + # This field is used to identify the serving config name and the set + # of models that will be used to make the search. + # @param branch [::String] + # Required. The branch resource name, such as + # `projects/*/locations/global/catalogs/default_catalog/branches/0`. + # + # Use "default_branch" as the branch ID or leave this field empty, to search + # products under the default branch. + # @param query [::String] + # Optional. Raw search query to be searched for. + # + # If this field is empty, the request is considered a category browsing + # request. + # @param page_categories [::Array<::String>] + # Optional. The categories associated with a category page. Must be set for + # category navigation queries to achieve good search quality. The format + # should be the same as + # {::Google::Cloud::Retail::V2::UserEvent#page_categories UserEvent.page_categories}; + # + # To represent full path of category, use '>' sign to separate different + # hierarchies. If '>' is part of the category name, replace it with + # other character(s). + # + # Category pages include special pages such as sales or promotions. For + # instance, a special sale page may have the category hierarchy: + # "pageCategories" : ["Sales > 2017 Black Friday Deals"]. + # @param conversation_id [::String] + # Optional. This field specifies the conversation id, which maintains the + # state of the conversation between client side and server side. Use the + # value from the previous + # {::Google::Cloud::Retail::V2::ConversationalSearchResponse#conversation_id ConversationalSearchResponse.conversation_id}. + # For the initial request, this should be empty. + # @param search_params [::Google::Cloud::Retail::V2::ConversationalSearchRequest::SearchParams, ::Hash] + # Optional. Search parameters. + # @param visitor_id [::String] + # Required. A unique identifier for tracking visitors. For example, this + # could be implemented with an HTTP cookie, which should be able to uniquely + # identify a visitor on a single device. This unique identifier should not + # change if the visitor logs in or out of the website. + # + # This should be the same identifier as + # {::Google::Cloud::Retail::V2::UserEvent#visitor_id UserEvent.visitor_id}. + # + # The field must be a UTF-8 encoded string with a length limit of 128 + # characters. Otherwise, an INVALID_ARGUMENT error is returned. + # @param user_info [::Google::Cloud::Retail::V2::UserInfo, ::Hash] + # Optional. User information. + # @param conversational_filtering_spec [::Google::Cloud::Retail::V2::ConversationalSearchRequest::ConversationalFilteringSpec, ::Hash] + # Optional. This field specifies all conversational filtering related + # parameters. + # @param user_labels [::Hash{::String => ::String}] + # Optional. The user labels applied to a resource must meet the following + # requirements: + # + # * Each resource can have multiple labels, up to a maximum of 64. + # * Each label must be a key-value pair. + # * Keys have a minimum length of 1 character and a maximum length of 63 + # characters and cannot be empty. Values can be empty and have a maximum + # length of 63 characters. + # * Keys and values can contain only lowercase letters, numeric characters, + # underscores, and dashes. All characters must use UTF-8 encoding, and + # international characters are allowed. + # * The key portion of a label must be unique. However, you can use the same + # key with multiple resources. + # * Keys must start with a lowercase letter or international character. + # + # See [Google Cloud + # Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + # for more details. + # @param safety_settings [::Array<::Google::Cloud::Retail::V2::SafetySetting, ::Hash>] + # Optional. The safety settings to be applied to the generated content. + # @return [::Enumerable<::Google::Cloud::Retail::V2::ConversationalSearchResponse>] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ConversationalSearchService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::ConversationalSearchRequest.new + # + # # Call the conversational_search method to start streaming. + # output = client.conversational_search request + # + # # The returned object is a streamed enumerable yielding elements of type + # # ::Google::Cloud::Retail::V2::ConversationalSearchResponse + # output.each do |current_response| + # p current_response + # end + # + def conversational_search request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ConversationalSearchRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.conversational_search.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.conversational_search.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.conversational_search.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + ::Gapic::Rest::ServerStream.new( + ::Google::Cloud::Retail::V2::ConversationalSearchResponse, + ::Gapic::Rest::ThreadedEnumerator.new do |in_q, out_q| + @conversational_search_service_stub.conversational_search request, options do |chunk| + in_q.deq + out_q.enq chunk + end + end + ) + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the ConversationalSearchService REST API. + # + # This class represents the configuration for ConversationalSearchService REST, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::Retail::V2::ConversationalSearchService::Rest::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # conversational_search to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Retail::V2::ConversationalSearchService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.conversational_search.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Retail::V2::ConversationalSearchService::Rest::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.conversational_search.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`String`) The path to a service account key file in JSON format + # * (`Hash`) A service account key as a Hash + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`nil`) indicating no credentials + # + # Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "retail.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration RPC class for the ConversationalSearchService API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `conversational_search` + # @return [::Gapic::Config::Method] + # + attr_reader :conversational_search + + # @private + def initialize parent_rpcs = nil + conversational_search_config = parent_rpcs.conversational_search if parent_rpcs.respond_to? :conversational_search + @conversational_search = ::Gapic::Config::Method.new conversational_search_config + + yield self if block_given? + end + end + end + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/rest/service_stub.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/rest/service_stub.rb new file mode 100644 index 000000000000..45338f592c0b --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/rest/service_stub.rb @@ -0,0 +1,145 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/retail/v2/conversational_search_service_pb" + +module Google + module Cloud + module Retail + module V2 + module ConversationalSearchService + module Rest + ## + # REST service stub for the ConversationalSearchService service. + # Service stub contains baseline method implementations + # including transcoding, making the REST call, and deserialing the response. + # + class ServiceStub + # @private + def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger: + # These require statements are intentionally placed here to initialize + # the REST modules only when it's required. + require "gapic/rest" + + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials, + numeric_enums: true, + service_name: self.class, + raise_faraday_errors: false, + logger: logger + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @client_stub.universe_domain + end + + ## + # The effective endpoint + # + # @return [String] + # + def endpoint + @client_stub.endpoint + end + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger stub: false + stub ? @client_stub.stub_logger : @client_stub.logger + end + + ## + # Baseline implementation for the conversational_search REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::ConversationalSearchRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yieldparam chunk [::String] The chunk of data received during server streaming. + # + # @return [::Gapic::Rest::TransportOperation] + def conversational_search(request_pb, options = nil, &) + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_conversational_search_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "conversational_search", + options: options, + is_server_streaming: true, + & + ) + ::Gapic::Rest::TransportOperation.new response + end + + ## + # @private + # + # GRPC transcoding helper method for the conversational_search REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::ConversationalSearchRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_conversational_search_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v2/{placement}:conversationalSearch", + body: "*", + matches: [ + ["placement", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/placements/[^/]+/?$}, false] + ] + ) + .with_bindings( + uri_method: :post, + uri_template: "/v2/{placement}:conversationalSearch", + body: "*", + matches: [ + ["placement", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/servingConfigs/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service_pb.rb new file mode 100644 index 000000000000..9bdaad5fdf84 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service_pb.rb @@ -0,0 +1,41 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/retail/v2/conversational_search_service.proto + +require 'google/protobuf' + +require 'google/api/annotations_pb' +require 'google/api/client_pb' +require 'google/api/field_behavior_pb' +require 'google/api/resource_pb' +require 'google/cloud/retail/v2/common_pb' +require 'google/cloud/retail/v2/safety_pb' +require 'google/cloud/retail/v2/search_service_pb' + + +descriptor_data = "\n:google/cloud/retail/v2/conversational_search_service.proto\x12\x16google.cloud.retail.v2\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a#google/cloud/retail/v2/common.proto\x1a#google/cloud/retail/v2/safety.proto\x1a+google/cloud/retail/v2/search_service.proto\"\xef\x0b\n\x1b\x43onversationalSearchRequest\x12\x16\n\tplacement\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x34\n\x06\x62ranch\x18\x02 \x01(\tB$\xe0\x41\x02\xfa\x41\x1e\n\x1cretail.googleapis.com/Branch\x12\x12\n\x05query\x18\x03 \x01(\tB\x03\xe0\x41\x01\x12\x1c\n\x0fpage_categories\x18\x04 \x03(\tB\x03\xe0\x41\x01\x12\x1c\n\x0f\x63onversation_id\x18\x05 \x01(\tB\x03\xe0\x41\x01\x12\\\n\rsearch_params\x18\x06 \x01(\x0b\x32@.google.cloud.retail.v2.ConversationalSearchRequest.SearchParamsB\x03\xe0\x41\x01\x12\x17\n\nvisitor_id\x18\t \x01(\tB\x03\xe0\x41\x02\x12\x38\n\tuser_info\x18\x07 \x01(\x0b\x32 .google.cloud.retail.v2.UserInfoB\x03\xe0\x41\x01\x12{\n\x1d\x63onversational_filtering_spec\x18\x08 \x01(\x0b\x32O.google.cloud.retail.v2.ConversationalSearchRequest.ConversationalFilteringSpecB\x03\xe0\x41\x01\x12]\n\x0buser_labels\x18\x0c \x03(\x0b\x32\x43.google.cloud.retail.v2.ConversationalSearchRequest.UserLabelsEntryB\x03\xe0\x41\x01\x12\x43\n\x0fsafety_settings\x18\x0e \x03(\x0b\x32%.google.cloud.retail.v2.SafetySettingB\x03\xe0\x41\x01\x1a\xa2\x01\n\x0cSearchParams\x12\x13\n\x06\x66ilter\x18\x01 \x01(\tB\x03\xe0\x41\x01\x12\x1d\n\x10\x63\x61nonical_filter\x18\x02 \x01(\tB\x03\xe0\x41\x01\x12\x14\n\x07sort_by\x18\x03 \x01(\tB\x03\xe0\x41\x01\x12H\n\nboost_spec\x18\x04 \x01(\x0b\x32/.google.cloud.retail.v2.SearchRequest.BoostSpecB\x03\xe0\x41\x01\x1a\x81\x02\n\nUserAnswer\x12\x15\n\x0btext_answer\x18\x01 \x01(\tH\x00\x12m\n\x0fselected_answer\x18\x02 \x01(\x0b\x32M.google.cloud.retail.v2.ConversationalSearchRequest.UserAnswer.SelectedAnswerB\x03\xe0\x41\x01H\x00\x1a\x65\n\x0eSelectedAnswer\x12S\n\x17product_attribute_value\x18\x01 \x01(\x0b\x32-.google.cloud.retail.v2.ProductAttributeValueB\x03\xe0\x41\x01\x42\x06\n\x04type\x1a\x83\x03\n\x1b\x43onversationalFilteringSpec\x12.\n\x1f\x65nable_conversational_filtering\x18\x01 \x01(\x08\x42\x05\x18\x01\xe0\x41\x01\x12X\n\x0buser_answer\x18\x02 \x01(\x0b\x32>.google.cloud.retail.v2.ConversationalSearchRequest.UserAnswerB\x03\xe0\x41\x01\x12\x80\x01\n\x1d\x63onversational_filtering_mode\x18\x04 \x01(\x0e\x32T.google.cloud.retail.v2.ConversationalSearchRequest.ConversationalFilteringSpec.ModeB\x03\xe0\x41\x01\"W\n\x04Mode\x12\x14\n\x10MODE_UNSPECIFIED\x10\x00\x12\x0c\n\x08\x44ISABLED\x10\x01\x12\x0b\n\x07\x45NABLED\x10\x02\x12\x1e\n\x1a\x43ONVERSATIONAL_FILTER_ONLY\x10\x03\x1a\x31\n\x0fUserLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"\xcd\t\n\x1c\x43onversationalSearchResponse\x12\x18\n\x10user_query_types\x18\n \x03(\t\x12$\n\x1c\x63onversational_text_response\x18\x02 \x01(\t\x12`\n\x11\x66ollowup_question\x18\x03 \x01(\x0b\x32\x45.google.cloud.retail.v2.ConversationalSearchResponse.FollowupQuestion\x12\x17\n\x0f\x63onversation_id\x18\x04 \x01(\t\x12Z\n\x0erefined_search\x18\x06 \x03(\x0b\x32\x42.google.cloud.retail.v2.ConversationalSearchResponse.RefinedSearch\x12{\n\x1f\x63onversational_filtering_result\x18\x07 \x01(\x0b\x32R.google.cloud.retail.v2.ConversationalSearchResponse.ConversationalFilteringResult\x12N\n\x05state\x18\t \x01(\x0e\x32:.google.cloud.retail.v2.ConversationalSearchResponse.StateB\x03\xe0\x41\x03\x1a\x82\x02\n\x10\x46ollowupQuestion\x12\x19\n\x11\x66ollowup_question\x18\x01 \x01(\t\x12p\n\x11suggested_answers\x18\x02 \x03(\x0b\x32U.google.cloud.retail.v2.ConversationalSearchResponse.FollowupQuestion.SuggestedAnswer\x1a\x61\n\x0fSuggestedAnswer\x12N\n\x17product_attribute_value\x18\x01 \x01(\x0b\x32-.google.cloud.retail.v2.ProductAttributeValue\x1a\x1e\n\rRefinedSearch\x12\r\n\x05query\x18\x01 \x01(\t\x1a\xe5\x02\n\x1d\x43onversationalFilteringResult\x12`\n\x11\x66ollowup_question\x18\x01 \x01(\x0b\x32\x45.google.cloud.retail.v2.ConversationalSearchResponse.FollowupQuestion\x12~\n\x11\x61\x64\x64itional_filter\x18\x02 \x01(\x0b\x32\x63.google.cloud.retail.v2.ConversationalSearchResponse.ConversationalFilteringResult.AdditionalFilter\x1a\x62\n\x10\x41\x64\x64itionalFilter\x12N\n\x17product_attribute_value\x18\x01 \x01(\x0b\x32-.google.cloud.retail.v2.ProductAttributeValue\"<\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\r\n\tSTREAMING\x10\x01\x12\r\n\tSUCCEEDED\x10\x02\x32\xae\x03\n\x1b\x43onversationalSearchService\x12\xc3\x02\n\x14\x43onversationalSearch\x12\x33.google.cloud.retail.v2.ConversationalSearchRequest\x1a\x34.google.cloud.retail.v2.ConversationalSearchResponse\"\xbd\x01\x82\xd3\xe4\x93\x02\xb6\x01\"S/v2/{placement=projects/*/locations/*/catalogs/*/placements/*}:conversationalSearch:\x01*Z\\\"W/v2/{placement=projects/*/locations/*/catalogs/*/servingConfigs/*}:conversationalSearch:\x01*0\x01\x1aI\xca\x41\x15retail.googleapis.com\xd2\x41.https://www.googleapis.com/auth/cloud-platformB\xcb\x01\n\x1a\x63om.google.cloud.retail.v2B ConversationalSearchServiceProtoP\x01Z2cloud.google.com/go/retail/apiv2/retailpb;retailpb\xa2\x02\x06RETAIL\xaa\x02\x16Google.Cloud.Retail.V2\xca\x02\x16Google\\Cloud\\Retail\\V2\xea\x02\x19Google::Cloud::Retail::V2b\x06proto3" + +pool = ::Google::Protobuf::DescriptorPool.generated_pool +pool.add_serialized_file(descriptor_data) + +module Google + module Cloud + module Retail + module V2 + ConversationalSearchRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ConversationalSearchRequest").msgclass + ConversationalSearchRequest::SearchParams = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ConversationalSearchRequest.SearchParams").msgclass + ConversationalSearchRequest::UserAnswer = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ConversationalSearchRequest.UserAnswer").msgclass + ConversationalSearchRequest::UserAnswer::SelectedAnswer = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ConversationalSearchRequest.UserAnswer.SelectedAnswer").msgclass + ConversationalSearchRequest::ConversationalFilteringSpec = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ConversationalSearchRequest.ConversationalFilteringSpec").msgclass + ConversationalSearchRequest::ConversationalFilteringSpec::Mode = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ConversationalSearchRequest.ConversationalFilteringSpec.Mode").enummodule + ConversationalSearchResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ConversationalSearchResponse").msgclass + ConversationalSearchResponse::FollowupQuestion = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ConversationalSearchResponse.FollowupQuestion").msgclass + ConversationalSearchResponse::FollowupQuestion::SuggestedAnswer = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ConversationalSearchResponse.FollowupQuestion.SuggestedAnswer").msgclass + ConversationalSearchResponse::RefinedSearch = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ConversationalSearchResponse.RefinedSearch").msgclass + ConversationalSearchResponse::ConversationalFilteringResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ConversationalSearchResponse.ConversationalFilteringResult").msgclass + ConversationalSearchResponse::ConversationalFilteringResult::AdditionalFilter = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ConversationalSearchResponse.ConversationalFilteringResult.AdditionalFilter").msgclass + ConversationalSearchResponse::State = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ConversationalSearchResponse.State").enummodule + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service_services_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service_services_pb.rb new file mode 100644 index 000000000000..f89ba3e94889 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service_services_pb.rb @@ -0,0 +1,52 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# Source: google/cloud/retail/v2/conversational_search_service.proto for package 'Google.Cloud.Retail.V2' +# Original file comments: +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +require 'grpc' +require 'google/cloud/retail/v2/conversational_search_service_pb' + +module Google + module Cloud + module Retail + module V2 + module ConversationalSearchService + # Service for retail conversational search. + # + # This feature is only available for users who have Retail Conversational + # Search enabled. Enable Retail Conversational Search on Cloud Console + # before using this feature. + class Service + + include ::GRPC::GenericService + + self.marshal_class_method = :encode + self.unmarshal_class_method = :decode + self.service_name = 'google.cloud.retail.v2.ConversationalSearchService' + + # Performs a conversational search. + # + # This feature is only available for users who have Conversational Search + # enabled. + rpc :ConversationalSearch, ::Google::Cloud::Retail::V2::ConversationalSearchRequest, stream(::Google::Cloud::Retail::V2::ConversationalSearchResponse) + end + + Stub = Service.rpc_stub_class + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/export_config_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/export_config_pb.rb new file mode 100644 index 000000000000..0799bfb12534 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/export_config_pb.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/retail/v2/export_config.proto + +require 'google/protobuf' + +require 'google/api/field_behavior_pb' +require 'google/api/resource_pb' +require 'google/protobuf/timestamp_pb' +require 'google/rpc/status_pb' + + +descriptor_data = "\n*google/cloud/retail/v2/export_config.proto\x12\x16google.cloud.retail.v2\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x17google/rpc/status.proto\"\xe0\x02\n\x0cOutputConfig\x12N\n\x0fgcs_destination\x18\x01 \x01(\x0b\x32\x33.google.cloud.retail.v2.OutputConfig.GcsDestinationH\x00\x12X\n\x14\x62igquery_destination\x18\x02 \x01(\x0b\x32\x38.google.cloud.retail.v2.OutputConfig.BigQueryDestinationH\x00\x1a\x30\n\x0eGcsDestination\x12\x1e\n\x11output_uri_prefix\x18\x01 \x01(\tB\x03\xe0\x41\x02\x1a\x65\n\x13\x42igQueryDestination\x12\x17\n\ndataset_id\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x1c\n\x0ftable_id_prefix\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\x17\n\ntable_type\x18\x03 \x01(\tB\x03\xe0\x41\x02\x42\r\n\x0b\x64\x65stination\"9\n\x12\x45xportErrorsConfig\x12\x14\n\ngcs_prefix\x18\x01 \x01(\tH\x00\x42\r\n\x0b\x64\x65stination\"\x87\x01\n\x1d\x45xportAnalyticsMetricsRequest\x12\x14\n\x07\x63\x61talog\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12@\n\routput_config\x18\x02 \x01(\x0b\x32$.google.cloud.retail.v2.OutputConfigB\x03\xe0\x41\x02\x12\x0e\n\x06\x66ilter\x18\x03 \x01(\t\"r\n\x0e\x45xportMetadata\x12/\n\x0b\x63reate_time\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12/\n\x0bupdate_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"\xcb\x01\n\x1e\x45xportAnalyticsMetricsResponse\x12)\n\rerror_samples\x18\x01 \x03(\x0b\x32\x12.google.rpc.Status\x12\x41\n\rerrors_config\x18\x02 \x01(\x0b\x32*.google.cloud.retail.v2.ExportErrorsConfig\x12;\n\routput_result\x18\x03 \x01(\x0b\x32$.google.cloud.retail.v2.OutputResult\"\x92\x01\n\x0cOutputResult\x12\x45\n\x0f\x62igquery_result\x18\x01 \x03(\x0b\x32,.google.cloud.retail.v2.BigQueryOutputResult\x12;\n\ngcs_result\x18\x02 \x03(\x0b\x32\'.google.cloud.retail.v2.GcsOutputResult\"<\n\x14\x42igQueryOutputResult\x12\x12\n\ndataset_id\x18\x01 \x01(\t\x12\x10\n\x08table_id\x18\x02 \x01(\t\"%\n\x0fGcsOutputResult\x12\x12\n\noutput_uri\x18\x01 \x01(\tB\xbc\x01\n\x1a\x63om.google.cloud.retail.v2B\x11\x45xportConfigProtoP\x01Z2cloud.google.com/go/retail/apiv2/retailpb;retailpb\xa2\x02\x06RETAIL\xaa\x02\x16Google.Cloud.Retail.V2\xca\x02\x16Google\\Cloud\\Retail\\V2\xea\x02\x19Google::Cloud::Retail::V2b\x06proto3" + +pool = ::Google::Protobuf::DescriptorPool.generated_pool +pool.add_serialized_file(descriptor_data) + +module Google + module Cloud + module Retail + module V2 + OutputConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.OutputConfig").msgclass + OutputConfig::GcsDestination = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.OutputConfig.GcsDestination").msgclass + OutputConfig::BigQueryDestination = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.OutputConfig.BigQueryDestination").msgclass + ExportErrorsConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ExportErrorsConfig").msgclass + ExportAnalyticsMetricsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ExportAnalyticsMetricsRequest").msgclass + ExportMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ExportMetadata").msgclass + ExportAnalyticsMetricsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ExportAnalyticsMetricsResponse").msgclass + OutputResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.OutputResult").msgclass + BigQueryOutputResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.BigQueryOutputResult").msgclass + GcsOutputResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.GcsOutputResult").msgclass + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_pb.rb new file mode 100644 index 000000000000..39063cf59e06 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_pb.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/retail/v2/generative_question.proto + +require 'google/protobuf' + +require 'google/api/field_behavior_pb' + + +descriptor_data = "\n0google/cloud/retail/v2/generative_question.proto\x12\x16google.cloud.retail.v2\x1a\x1fgoogle/api/field_behavior.proto\"u\n GenerativeQuestionsFeatureConfig\x12\x14\n\x07\x63\x61talog\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x1c\n\x0f\x66\x65\x61ture_enabled\x18\x02 \x01(\x08\x42\x03\xe0\x41\x01\x12\x1d\n\x10minimum_products\x18\x03 \x01(\x05\x42\x03\xe0\x41\x01\"\xdd\x01\n\x18GenerativeQuestionConfig\x12\x14\n\x07\x63\x61talog\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x12\n\x05\x66\x61\x63\x65t\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\x1f\n\x12generated_question\x18\x03 \x01(\tB\x03\xe0\x41\x03\x12\x1b\n\x0e\x66inal_question\x18\x04 \x01(\tB\x03\xe0\x41\x01\x12\x1b\n\x0e\x65xample_values\x18\x05 \x03(\tB\x03\xe0\x41\x03\x12\x16\n\tfrequency\x18\x06 \x01(\x02\x42\x03\xe0\x41\x03\x12$\n\x17\x61llowed_in_conversation\x18\x07 \x01(\x08\x42\x03\xe0\x41\x01\x42\xc2\x01\n\x1a\x63om.google.cloud.retail.v2B\x17GenerativeQuestionProtoP\x01Z2cloud.google.com/go/retail/apiv2/retailpb;retailpb\xa2\x02\x06RETAIL\xaa\x02\x16Google.Cloud.Retail.V2\xca\x02\x16Google\\Cloud\\Retail\\V2\xea\x02\x19Google::Cloud::Retail::V2b\x06proto3" + +pool = ::Google::Protobuf::DescriptorPool.generated_pool +pool.add_serialized_file(descriptor_data) + +module Google + module Cloud + module Retail + module V2 + GenerativeQuestionsFeatureConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.GenerativeQuestionsFeatureConfig").msgclass + GenerativeQuestionConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.GenerativeQuestionConfig").msgclass + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service.rb new file mode 100644 index 000000000000..820d713f4e45 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service.rb @@ -0,0 +1,55 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/common" +require "gapic/config" +require "gapic/config/method" + +require "google/cloud/retail/v2/version" + +require "google/cloud/retail/v2/generative_question_service/credentials" +require "google/cloud/retail/v2/generative_question_service/paths" +require "google/cloud/retail/v2/generative_question_service/client" +require "google/cloud/retail/v2/generative_question_service/rest" + +module Google + module Cloud + module Retail + module V2 + ## + # Service for managing LLM generated questions in search serving. + # + # @example Load this service and instantiate a gRPC client + # + # require "google/cloud/retail/v2/generative_question_service" + # client = ::Google::Cloud::Retail::V2::GenerativeQuestionService::Client.new + # + # @example Load this service and instantiate a REST client + # + # require "google/cloud/retail/v2/generative_question_service/rest" + # client = ::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client.new + # + module GenerativeQuestionService + end + end + end + end +end + +helper_path = ::File.join __dir__, "generative_question_service", "helpers.rb" +require "google/cloud/retail/v2/generative_question_service/helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/client.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/client.rb new file mode 100644 index 000000000000..de3a2a9764ad --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/client.rb @@ -0,0 +1,879 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/cloud/retail/v2/generative_question_service_pb" +require "google/cloud/location" + +module Google + module Cloud + module Retail + module V2 + module GenerativeQuestionService + ## + # Client for the GenerativeQuestionService service. + # + # Service for managing LLM generated questions in search serving. + # + class Client + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" + + include Paths + + # @private + attr_reader :generative_question_service_stub + + ## + # Configure the GenerativeQuestionService Client class. + # + # See {::Google::Cloud::Retail::V2::GenerativeQuestionService::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all GenerativeQuestionService clients + # ::Google::Cloud::Retail::V2::GenerativeQuestionService::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "Retail", "V2"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the GenerativeQuestionService Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Cloud::Retail::V2::GenerativeQuestionService::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @generative_question_service_stub.universe_domain + end + + ## + # Create a new GenerativeQuestionService client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::Retail::V2::GenerativeQuestionService::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::Retail::V2::GenerativeQuestionService::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the GenerativeQuestionService client. + # @yieldparam config [Client::Configuration] + # + def initialize + # These require statements are intentionally placed here to initialize + # the gRPC module only when it's required. + # See https://github.com/googleapis/toolkit/issues/446 + require "gapic/grpc" + require "google/cloud/retail/v2/generative_question_service_services_pb" + + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @generative_question_service_stub = ::Gapic::ServiceStub.new( + ::Google::Cloud::Retail::V2::GenerativeQuestionService::Stub, + credentials: credentials, + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + channel_args: @config.channel_args, + interceptors: @config.interceptors, + channel_pool_config: @config.channel_pool, + logger: @config.logger + ) + + @generative_question_service_stub.stub_logger&.info do |entry| + entry.set_system_name + entry.set_service + entry.message = "Created client for #{entry.service}" + entry.set_credentials_fields credentials + entry.set "customEndpoint", @config.endpoint if @config.endpoint + entry.set "defaultTimeout", @config.timeout if @config.timeout + entry.set "quotaProject", @quota_project_id if @quota_project_id + end + + @location_client = Google::Cloud::Location::Locations::Client.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @generative_question_service_stub.endpoint + config.universe_domain = @generative_question_service_stub.universe_domain + config.logger = @generative_question_service_stub.logger if config.respond_to? :logger= + end + end + + ## + # Get the associated client for mix-in of the Locations. + # + # @return [Google::Cloud::Location::Locations::Client] + # + attr_reader :location_client + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @generative_question_service_stub.logger + end + + # Service calls + + ## + # Manages overal generative question feature state -- enables toggling + # feature on and off. + # + # @overload update_generative_questions_feature_config(request, options = nil) + # Pass arguments to `update_generative_questions_feature_config` via a request object, either of type + # {::Google::Cloud::Retail::V2::UpdateGenerativeQuestionsFeatureConfigRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::UpdateGenerativeQuestionsFeatureConfigRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload update_generative_questions_feature_config(generative_questions_feature_config: nil, update_mask: nil) + # Pass arguments to `update_generative_questions_feature_config` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param generative_questions_feature_config [::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig, ::Hash] + # Required. The configuration managing the feature state. + # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] + # Optional. Indicates which fields in the provided + # {::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig GenerativeQuestionsFeatureConfig} + # to update. If not set or empty, all supported fields are updated. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::GenerativeQuestionService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::UpdateGenerativeQuestionsFeatureConfigRequest.new + # + # # Call the update_generative_questions_feature_config method. + # result = client.update_generative_questions_feature_config request + # + # # The returned object is of type Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig. + # p result + # + def update_generative_questions_feature_config request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::UpdateGenerativeQuestionsFeatureConfigRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.update_generative_questions_feature_config.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.generative_questions_feature_config&.catalog + header_params["generative_questions_feature_config.catalog"] = request.generative_questions_feature_config.catalog + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.update_generative_questions_feature_config.timeout, + metadata: metadata, + retry_policy: @config.rpcs.update_generative_questions_feature_config.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @generative_question_service_stub.call_rpc :update_generative_questions_feature_config, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Manages overal generative question feature state -- enables toggling + # feature on and off. + # + # @overload get_generative_questions_feature_config(request, options = nil) + # Pass arguments to `get_generative_questions_feature_config` via a request object, either of type + # {::Google::Cloud::Retail::V2::GetGenerativeQuestionsFeatureConfigRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::GetGenerativeQuestionsFeatureConfigRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload get_generative_questions_feature_config(catalog: nil) + # Pass arguments to `get_generative_questions_feature_config` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param catalog [::String] + # Required. Resource name of the parent catalog. + # Format: projects/\\{project}/locations/\\{location}/catalogs/\\{catalog} + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::GenerativeQuestionService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::GetGenerativeQuestionsFeatureConfigRequest.new + # + # # Call the get_generative_questions_feature_config method. + # result = client.get_generative_questions_feature_config request + # + # # The returned object is of type Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig. + # p result + # + def get_generative_questions_feature_config request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::GetGenerativeQuestionsFeatureConfigRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.get_generative_questions_feature_config.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.catalog + header_params["catalog"] = request.catalog + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.get_generative_questions_feature_config.timeout, + metadata: metadata, + retry_policy: @config.rpcs.get_generative_questions_feature_config.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @generative_question_service_stub.call_rpc :get_generative_questions_feature_config, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Returns all questions for a given catalog. + # + # @overload list_generative_question_configs(request, options = nil) + # Pass arguments to `list_generative_question_configs` via a request object, either of type + # {::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload list_generative_question_configs(parent: nil) + # Pass arguments to `list_generative_question_configs` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. Resource name of the parent catalog. + # Format: projects/\\{project}/locations/\\{location}/catalogs/\\{catalog} + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsResponse] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsResponse] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::GenerativeQuestionService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsRequest.new + # + # # Call the list_generative_question_configs method. + # result = client.list_generative_question_configs request + # + # # The returned object is of type Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsResponse. + # p result + # + def list_generative_question_configs request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.list_generative_question_configs.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.list_generative_question_configs.timeout, + metadata: metadata, + retry_policy: @config.rpcs.list_generative_question_configs.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @generative_question_service_stub.call_rpc :list_generative_question_configs, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Allows management of individual questions. + # + # @overload update_generative_question_config(request, options = nil) + # Pass arguments to `update_generative_question_config` via a request object, either of type + # {::Google::Cloud::Retail::V2::UpdateGenerativeQuestionConfigRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::UpdateGenerativeQuestionConfigRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload update_generative_question_config(generative_question_config: nil, update_mask: nil) + # Pass arguments to `update_generative_question_config` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param generative_question_config [::Google::Cloud::Retail::V2::GenerativeQuestionConfig, ::Hash] + # Required. The question to update. + # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] + # Optional. Indicates which fields in the provided + # {::Google::Cloud::Retail::V2::GenerativeQuestionConfig GenerativeQuestionConfig} + # to update. The following are NOT supported: + # + # * {::Google::Cloud::Retail::V2::GenerativeQuestionConfig#frequency GenerativeQuestionConfig.frequency} + # + # If not set or empty, all supported fields are updated. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Retail::V2::GenerativeQuestionConfig] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Retail::V2::GenerativeQuestionConfig] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::GenerativeQuestionService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::UpdateGenerativeQuestionConfigRequest.new + # + # # Call the update_generative_question_config method. + # result = client.update_generative_question_config request + # + # # The returned object is of type Google::Cloud::Retail::V2::GenerativeQuestionConfig. + # p result + # + def update_generative_question_config request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::UpdateGenerativeQuestionConfigRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.update_generative_question_config.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.generative_question_config&.catalog + header_params["generative_question_config.catalog"] = request.generative_question_config.catalog + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.update_generative_question_config.timeout, + metadata: metadata, + retry_policy: @config.rpcs.update_generative_question_config.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @generative_question_service_stub.call_rpc :update_generative_question_config, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Allows management of multiple questions. + # + # @overload batch_update_generative_question_configs(request, options = nil) + # Pass arguments to `batch_update_generative_question_configs` via a request object, either of type + # {::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload batch_update_generative_question_configs(parent: nil, requests: nil) + # Pass arguments to `batch_update_generative_question_configs` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Optional. Resource name of the parent catalog. + # Format: projects/\\{project}/locations/\\{location}/catalogs/\\{catalog} + # @param requests [::Array<::Google::Cloud::Retail::V2::UpdateGenerativeQuestionConfigRequest, ::Hash>] + # Required. The updates question configs. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsResponse] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsResponse] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::GenerativeQuestionService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsRequest.new + # + # # Call the batch_update_generative_question_configs method. + # result = client.batch_update_generative_question_configs request + # + # # The returned object is of type Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsResponse. + # p result + # + def batch_update_generative_question_configs request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.batch_update_generative_question_configs.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.batch_update_generative_question_configs.timeout, + metadata: metadata, + retry_policy: @config.rpcs.batch_update_generative_question_configs.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @generative_question_service_stub.call_rpc :batch_update_generative_question_configs, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the GenerativeQuestionService API. + # + # This class represents the configuration for GenerativeQuestionService, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::Retail::V2::GenerativeQuestionService::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # update_generative_questions_feature_config to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Retail::V2::GenerativeQuestionService::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.update_generative_questions_feature_config.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Retail::V2::GenerativeQuestionService::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.update_generative_questions_feature_config.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`GRPC::Core::Channel`) a gRPC channel with included credentials + # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object + # * (`nil`) indicating no credentials + # + # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials + # is deprecated. Providing an unvalidated credential configuration to + # Google APIs can compromise the security of your systems and data. + # + # @example + # + # # The recommended way to provide credentials is to use the `make_creds` method + # # on the appropriate credentials class for your environment. + # + # require "googleauth" + # + # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds( + # json_key_io: ::File.open("/path/to/keyfile.json") + # ) + # + # client = ::Google::Cloud::Retail::V2::GenerativeQuestionService::Client.new do |config| + # config.credentials = credentials + # end + # + # @note Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] channel_args + # Extra parameters passed to the gRPC channel. Note: this is ignored if a + # `GRPC::Core::Channel` object is provided as the credential. + # @return [::Hash] + # @!attribute [rw] interceptors + # An array of interceptors that are run before calls are executed. + # @return [::Array<::GRPC::ClientInterceptor>] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional gRPC headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "retail.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) + config_attr :interceptors, nil, ::Array, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration for the channel pool + # @return [::Gapic::ServiceStub::ChannelPool::Configuration] + # + def channel_pool + @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new + end + + ## + # Configuration RPC class for the GenerativeQuestionService API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `update_generative_questions_feature_config` + # @return [::Gapic::Config::Method] + # + attr_reader :update_generative_questions_feature_config + ## + # RPC-specific configuration for `get_generative_questions_feature_config` + # @return [::Gapic::Config::Method] + # + attr_reader :get_generative_questions_feature_config + ## + # RPC-specific configuration for `list_generative_question_configs` + # @return [::Gapic::Config::Method] + # + attr_reader :list_generative_question_configs + ## + # RPC-specific configuration for `update_generative_question_config` + # @return [::Gapic::Config::Method] + # + attr_reader :update_generative_question_config + ## + # RPC-specific configuration for `batch_update_generative_question_configs` + # @return [::Gapic::Config::Method] + # + attr_reader :batch_update_generative_question_configs + + # @private + def initialize parent_rpcs = nil + update_generative_questions_feature_config_config = parent_rpcs.update_generative_questions_feature_config if parent_rpcs.respond_to? :update_generative_questions_feature_config + @update_generative_questions_feature_config = ::Gapic::Config::Method.new update_generative_questions_feature_config_config + get_generative_questions_feature_config_config = parent_rpcs.get_generative_questions_feature_config if parent_rpcs.respond_to? :get_generative_questions_feature_config + @get_generative_questions_feature_config = ::Gapic::Config::Method.new get_generative_questions_feature_config_config + list_generative_question_configs_config = parent_rpcs.list_generative_question_configs if parent_rpcs.respond_to? :list_generative_question_configs + @list_generative_question_configs = ::Gapic::Config::Method.new list_generative_question_configs_config + update_generative_question_config_config = parent_rpcs.update_generative_question_config if parent_rpcs.respond_to? :update_generative_question_config + @update_generative_question_config = ::Gapic::Config::Method.new update_generative_question_config_config + batch_update_generative_question_configs_config = parent_rpcs.batch_update_generative_question_configs if parent_rpcs.respond_to? :batch_update_generative_question_configs + @batch_update_generative_question_configs = ::Gapic::Config::Method.new batch_update_generative_question_configs_config + + yield self if block_given? + end + end + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/credentials.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/credentials.rb new file mode 100644 index 000000000000..15af3d895c06 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/credentials.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "googleauth" + +module Google + module Cloud + module Retail + module V2 + module GenerativeQuestionService + # Credentials for the GenerativeQuestionService API. + class Credentials < ::Google::Auth::Credentials + self.scope = [ + "https://www.googleapis.com/auth/cloud-platform" + ] + self.env_vars = [ + "RETAIL_CREDENTIALS", + "RETAIL_KEYFILE", + "GOOGLE_CLOUD_CREDENTIALS", + "GOOGLE_CLOUD_KEYFILE", + "GCLOUD_KEYFILE", + "RETAIL_CREDENTIALS_JSON", + "RETAIL_KEYFILE_JSON", + "GOOGLE_CLOUD_CREDENTIALS_JSON", + "GOOGLE_CLOUD_KEYFILE_JSON", + "GCLOUD_KEYFILE_JSON" + ] + self.paths = [ + "~/.config/google_cloud/application_default_credentials.json" + ] + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/paths.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/paths.rb new file mode 100644 index 000000000000..a01a45d7d88f --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/paths.rb @@ -0,0 +1,52 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Retail + module V2 + module GenerativeQuestionService + # Path helper methods for the GenerativeQuestionService API. + module Paths + ## + # Create a fully-qualified Catalog resource string. + # + # The resource will be in the following format: + # + # `projects/{project}/locations/{location}/catalogs/{catalog}` + # + # @param project [String] + # @param location [String] + # @param catalog [String] + # + # @return [::String] + def catalog_path project:, location:, catalog: + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" + + "projects/#{project}/locations/#{location}/catalogs/#{catalog}" + end + + extend self + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/rest.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/rest.rb new file mode 100644 index 000000000000..a4599e934284 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/rest.rb @@ -0,0 +1,52 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/rest" +require "gapic/config" +require "gapic/config/method" + +require "google/cloud/retail/v2/version" + +require "google/cloud/retail/v2/generative_question_service/credentials" +require "google/cloud/retail/v2/generative_question_service/paths" +require "google/cloud/retail/v2/generative_question_service/rest/client" + +module Google + module Cloud + module Retail + module V2 + ## + # Service for managing LLM generated questions in search serving. + # + # To load this service and instantiate a REST client: + # + # require "google/cloud/retail/v2/generative_question_service/rest" + # client = ::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client.new + # + module GenerativeQuestionService + # Client for the REST transport + module Rest + end + end + end + end + end +end + +helper_path = ::File.join __dir__, "rest", "helpers.rb" +require "google/cloud/retail/v2/generative_question_service/rest/helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/rest/client.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/rest/client.rb new file mode 100644 index 000000000000..414fa2beac8b --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/rest/client.rb @@ -0,0 +1,801 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/cloud/retail/v2/generative_question_service_pb" +require "google/cloud/retail/v2/generative_question_service/rest/service_stub" +require "google/cloud/location/rest" + +module Google + module Cloud + module Retail + module V2 + module GenerativeQuestionService + module Rest + ## + # REST client for the GenerativeQuestionService service. + # + # Service for managing LLM generated questions in search serving. + # + class Client + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" + + include Paths + + # @private + attr_reader :generative_question_service_stub + + ## + # Configure the GenerativeQuestionService Client class. + # + # See {::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all GenerativeQuestionService clients + # ::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "Retail", "V2"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the GenerativeQuestionService Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @generative_question_service_stub.universe_domain + end + + ## + # Create a new GenerativeQuestionService REST client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the GenerativeQuestionService client. + # @yieldparam config [Client::Configuration] + # + def initialize + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @generative_question_service_stub = ::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials, + logger: @config.logger + ) + + @generative_question_service_stub.logger(stub: true)&.info do |entry| + entry.set_system_name + entry.set_service + entry.message = "Created client for #{entry.service}" + entry.set_credentials_fields credentials + entry.set "customEndpoint", @config.endpoint if @config.endpoint + entry.set "defaultTimeout", @config.timeout if @config.timeout + entry.set "quotaProject", @quota_project_id if @quota_project_id + end + + @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @generative_question_service_stub.endpoint + config.universe_domain = @generative_question_service_stub.universe_domain + config.logger = @generative_question_service_stub.logger if config.respond_to? :logger= + end + end + + ## + # Get the associated client for mix-in of the Locations. + # + # @return [Google::Cloud::Location::Locations::Rest::Client] + # + attr_reader :location_client + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @generative_question_service_stub.logger + end + + # Service calls + + ## + # Manages overal generative question feature state -- enables toggling + # feature on and off. + # + # @overload update_generative_questions_feature_config(request, options = nil) + # Pass arguments to `update_generative_questions_feature_config` via a request object, either of type + # {::Google::Cloud::Retail::V2::UpdateGenerativeQuestionsFeatureConfigRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::UpdateGenerativeQuestionsFeatureConfigRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload update_generative_questions_feature_config(generative_questions_feature_config: nil, update_mask: nil) + # Pass arguments to `update_generative_questions_feature_config` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param generative_questions_feature_config [::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig, ::Hash] + # Required. The configuration managing the feature state. + # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] + # Optional. Indicates which fields in the provided + # {::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig GenerativeQuestionsFeatureConfig} + # to update. If not set or empty, all supported fields are updated. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::UpdateGenerativeQuestionsFeatureConfigRequest.new + # + # # Call the update_generative_questions_feature_config method. + # result = client.update_generative_questions_feature_config request + # + # # The returned object is of type Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig. + # p result + # + def update_generative_questions_feature_config request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::UpdateGenerativeQuestionsFeatureConfigRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.update_generative_questions_feature_config.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.update_generative_questions_feature_config.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.update_generative_questions_feature_config.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @generative_question_service_stub.update_generative_questions_feature_config request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Manages overal generative question feature state -- enables toggling + # feature on and off. + # + # @overload get_generative_questions_feature_config(request, options = nil) + # Pass arguments to `get_generative_questions_feature_config` via a request object, either of type + # {::Google::Cloud::Retail::V2::GetGenerativeQuestionsFeatureConfigRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::GetGenerativeQuestionsFeatureConfigRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload get_generative_questions_feature_config(catalog: nil) + # Pass arguments to `get_generative_questions_feature_config` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param catalog [::String] + # Required. Resource name of the parent catalog. + # Format: projects/\\{project}/locations/\\{location}/catalogs/\\{catalog} + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::GetGenerativeQuestionsFeatureConfigRequest.new + # + # # Call the get_generative_questions_feature_config method. + # result = client.get_generative_questions_feature_config request + # + # # The returned object is of type Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig. + # p result + # + def get_generative_questions_feature_config request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::GetGenerativeQuestionsFeatureConfigRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.get_generative_questions_feature_config.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.get_generative_questions_feature_config.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.get_generative_questions_feature_config.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @generative_question_service_stub.get_generative_questions_feature_config request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Returns all questions for a given catalog. + # + # @overload list_generative_question_configs(request, options = nil) + # Pass arguments to `list_generative_question_configs` via a request object, either of type + # {::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload list_generative_question_configs(parent: nil) + # Pass arguments to `list_generative_question_configs` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. Resource name of the parent catalog. + # Format: projects/\\{project}/locations/\\{location}/catalogs/\\{catalog} + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsResponse] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsRequest.new + # + # # Call the list_generative_question_configs method. + # result = client.list_generative_question_configs request + # + # # The returned object is of type Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsResponse. + # p result + # + def list_generative_question_configs request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.list_generative_question_configs.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.list_generative_question_configs.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.list_generative_question_configs.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @generative_question_service_stub.list_generative_question_configs request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Allows management of individual questions. + # + # @overload update_generative_question_config(request, options = nil) + # Pass arguments to `update_generative_question_config` via a request object, either of type + # {::Google::Cloud::Retail::V2::UpdateGenerativeQuestionConfigRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::UpdateGenerativeQuestionConfigRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload update_generative_question_config(generative_question_config: nil, update_mask: nil) + # Pass arguments to `update_generative_question_config` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param generative_question_config [::Google::Cloud::Retail::V2::GenerativeQuestionConfig, ::Hash] + # Required. The question to update. + # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] + # Optional. Indicates which fields in the provided + # {::Google::Cloud::Retail::V2::GenerativeQuestionConfig GenerativeQuestionConfig} + # to update. The following are NOT supported: + # + # * {::Google::Cloud::Retail::V2::GenerativeQuestionConfig#frequency GenerativeQuestionConfig.frequency} + # + # If not set or empty, all supported fields are updated. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::GenerativeQuestionConfig] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::GenerativeQuestionConfig] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::UpdateGenerativeQuestionConfigRequest.new + # + # # Call the update_generative_question_config method. + # result = client.update_generative_question_config request + # + # # The returned object is of type Google::Cloud::Retail::V2::GenerativeQuestionConfig. + # p result + # + def update_generative_question_config request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::UpdateGenerativeQuestionConfigRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.update_generative_question_config.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.update_generative_question_config.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.update_generative_question_config.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @generative_question_service_stub.update_generative_question_config request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Allows management of multiple questions. + # + # @overload batch_update_generative_question_configs(request, options = nil) + # Pass arguments to `batch_update_generative_question_configs` via a request object, either of type + # {::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload batch_update_generative_question_configs(parent: nil, requests: nil) + # Pass arguments to `batch_update_generative_question_configs` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Optional. Resource name of the parent catalog. + # Format: projects/\\{project}/locations/\\{location}/catalogs/\\{catalog} + # @param requests [::Array<::Google::Cloud::Retail::V2::UpdateGenerativeQuestionConfigRequest, ::Hash>] + # Required. The updates question configs. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsResponse] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsRequest.new + # + # # Call the batch_update_generative_question_configs method. + # result = client.batch_update_generative_question_configs request + # + # # The returned object is of type Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsResponse. + # p result + # + def batch_update_generative_question_configs request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.batch_update_generative_question_configs.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.batch_update_generative_question_configs.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.batch_update_generative_question_configs.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @generative_question_service_stub.batch_update_generative_question_configs request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the GenerativeQuestionService REST API. + # + # This class represents the configuration for GenerativeQuestionService REST, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # update_generative_questions_feature_config to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.update_generative_questions_feature_config.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.update_generative_questions_feature_config.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`String`) The path to a service account key file in JSON format + # * (`Hash`) A service account key as a Hash + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`nil`) indicating no credentials + # + # Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "retail.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration RPC class for the GenerativeQuestionService API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `update_generative_questions_feature_config` + # @return [::Gapic::Config::Method] + # + attr_reader :update_generative_questions_feature_config + ## + # RPC-specific configuration for `get_generative_questions_feature_config` + # @return [::Gapic::Config::Method] + # + attr_reader :get_generative_questions_feature_config + ## + # RPC-specific configuration for `list_generative_question_configs` + # @return [::Gapic::Config::Method] + # + attr_reader :list_generative_question_configs + ## + # RPC-specific configuration for `update_generative_question_config` + # @return [::Gapic::Config::Method] + # + attr_reader :update_generative_question_config + ## + # RPC-specific configuration for `batch_update_generative_question_configs` + # @return [::Gapic::Config::Method] + # + attr_reader :batch_update_generative_question_configs + + # @private + def initialize parent_rpcs = nil + update_generative_questions_feature_config_config = parent_rpcs.update_generative_questions_feature_config if parent_rpcs.respond_to? :update_generative_questions_feature_config + @update_generative_questions_feature_config = ::Gapic::Config::Method.new update_generative_questions_feature_config_config + get_generative_questions_feature_config_config = parent_rpcs.get_generative_questions_feature_config if parent_rpcs.respond_to? :get_generative_questions_feature_config + @get_generative_questions_feature_config = ::Gapic::Config::Method.new get_generative_questions_feature_config_config + list_generative_question_configs_config = parent_rpcs.list_generative_question_configs if parent_rpcs.respond_to? :list_generative_question_configs + @list_generative_question_configs = ::Gapic::Config::Method.new list_generative_question_configs_config + update_generative_question_config_config = parent_rpcs.update_generative_question_config if parent_rpcs.respond_to? :update_generative_question_config + @update_generative_question_config = ::Gapic::Config::Method.new update_generative_question_config_config + batch_update_generative_question_configs_config = parent_rpcs.batch_update_generative_question_configs if parent_rpcs.respond_to? :batch_update_generative_question_configs + @batch_update_generative_question_configs = ::Gapic::Config::Method.new batch_update_generative_question_configs_config + + yield self if block_given? + end + end + end + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/rest/service_stub.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/rest/service_stub.rb new file mode 100644 index 000000000000..28bb60081ea8 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/rest/service_stub.rb @@ -0,0 +1,389 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/retail/v2/generative_question_service_pb" + +module Google + module Cloud + module Retail + module V2 + module GenerativeQuestionService + module Rest + ## + # REST service stub for the GenerativeQuestionService service. + # Service stub contains baseline method implementations + # including transcoding, making the REST call, and deserialing the response. + # + class ServiceStub + # @private + def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger: + # These require statements are intentionally placed here to initialize + # the REST modules only when it's required. + require "gapic/rest" + + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials, + numeric_enums: true, + service_name: self.class, + raise_faraday_errors: false, + logger: logger + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @client_stub.universe_domain + end + + ## + # The effective endpoint + # + # @return [String] + # + def endpoint + @client_stub.endpoint + end + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger stub: false + stub ? @client_stub.stub_logger : @client_stub.logger + end + + ## + # Baseline implementation for the update_generative_questions_feature_config REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::UpdateGenerativeQuestionsFeatureConfigRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig] + # A result object deserialized from the server's reply + def update_generative_questions_feature_config request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_update_generative_questions_feature_config_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "update_generative_questions_feature_config", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the get_generative_questions_feature_config REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::GetGenerativeQuestionsFeatureConfigRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig] + # A result object deserialized from the server's reply + def get_generative_questions_feature_config request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_get_generative_questions_feature_config_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "get_generative_questions_feature_config", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the list_generative_question_configs REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsResponse] + # A result object deserialized from the server's reply + def list_generative_question_configs request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_list_generative_question_configs_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "list_generative_question_configs", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the update_generative_question_config REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::UpdateGenerativeQuestionConfigRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::GenerativeQuestionConfig] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::GenerativeQuestionConfig] + # A result object deserialized from the server's reply + def update_generative_question_config request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_update_generative_question_config_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "update_generative_question_config", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Retail::V2::GenerativeQuestionConfig.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the batch_update_generative_question_configs REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsResponse] + # A result object deserialized from the server's reply + def batch_update_generative_question_configs request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_batch_update_generative_question_configs_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "batch_update_generative_question_configs", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # @private + # + # GRPC transcoding helper method for the update_generative_questions_feature_config REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::UpdateGenerativeQuestionsFeatureConfigRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_update_generative_questions_feature_config_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :patch, + uri_template: "/v2/{generative_questions_feature_config.catalog}/generativeQuestionFeature", + body: "generative_questions_feature_config", + matches: [ + ["generative_questions_feature_config.catalog", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the get_generative_questions_feature_config REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::GetGenerativeQuestionsFeatureConfigRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_get_generative_questions_feature_config_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v2/{catalog}/generativeQuestionFeature", + matches: [ + ["catalog", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the list_generative_question_configs REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_list_generative_question_configs_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v2/{parent}/generativeQuestions", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the update_generative_question_config REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::UpdateGenerativeQuestionConfigRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_update_generative_question_config_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :patch, + uri_template: "/v2/{generative_question_config.catalog}/generativeQuestion", + body: "generative_question_config", + matches: [ + ["generative_question_config.catalog", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the batch_update_generative_question_configs REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_batch_update_generative_question_configs_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v2/{parent}/generativeQuestion:batchUpdate", + body: "*", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service_pb.rb new file mode 100644 index 000000000000..36ad39b3e786 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service_pb.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/retail/v2/generative_question_service.proto + +require 'google/protobuf' + +require 'google/api/annotations_pb' +require 'google/api/client_pb' +require 'google/api/field_behavior_pb' +require 'google/api/resource_pb' +require 'google/cloud/retail/v2/generative_question_pb' +require 'google/protobuf/field_mask_pb' + + +descriptor_data = "\n8google/cloud/retail/v2/generative_question_service.proto\x12\x16google.cloud.retail.v2\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x30google/cloud/retail/v2/generative_question.proto\x1a google/protobuf/field_mask.proto\"\xd1\x01\n-UpdateGenerativeQuestionsFeatureConfigRequest\x12j\n#generative_questions_feature_config\x18\x02 \x01(\x0b\x32\x38.google.cloud.retail.v2.GenerativeQuestionsFeatureConfigB\x03\xe0\x41\x02\x12\x34\n\x0bupdate_mask\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.FieldMaskB\x03\xe0\x41\x01\"d\n*GetGenerativeQuestionsFeatureConfigRequest\x12\x36\n\x07\x63\x61talog\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\n\x1dretail.googleapis.com/Catalog\"]\n$ListGenerativeQuestionConfigsRequest\x12\x35\n\x06parent\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\n\x1dretail.googleapis.com/Catalog\"~\n%ListGenerativeQuestionConfigsResponse\x12U\n\x1bgenerative_question_configs\x18\x01 \x03(\x0b\x32\x30.google.cloud.retail.v2.GenerativeQuestionConfig\"\xb8\x01\n%UpdateGenerativeQuestionConfigRequest\x12Y\n\x1agenerative_question_config\x18\x03 \x01(\x0b\x32\x30.google.cloud.retail.v2.GenerativeQuestionConfigB\x03\xe0\x41\x02\x12\x34\n\x0bupdate_mask\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.FieldMaskB\x03\xe0\x41\x01\"\xba\x01\n+BatchUpdateGenerativeQuestionConfigsRequest\x12\x35\n\x06parent\x18\x01 \x01(\tB%\xe0\x41\x01\xfa\x41\x1f\n\x1dretail.googleapis.com/Catalog\x12T\n\x08requests\x18\x02 \x03(\x0b\x32=.google.cloud.retail.v2.UpdateGenerativeQuestionConfigRequestB\x03\xe0\x41\x02\"\x8a\x01\n,BatchUpdateGenerativeQuestionConfigsResponse\x12Z\n\x1bgenerative_question_configs\x18\x01 \x03(\x0b\x32\x30.google.cloud.retail.v2.GenerativeQuestionConfigB\x03\xe0\x41\x01\x32\xba\x0c\n\x19GenerativeQuestionService\x12\xf9\x02\n&UpdateGenerativeQuestionsFeatureConfig\x12\x45.google.cloud.retail.v2.UpdateGenerativeQuestionsFeatureConfigRequest\x1a\x38.google.cloud.retail.v2.GenerativeQuestionsFeatureConfig\"\xcd\x01\xda\x41/generative_questions_feature_config,update_mask\x82\xd3\xe4\x93\x02\x94\x01\x32m/v2/{generative_questions_feature_config.catalog=projects/*/locations/*/catalogs/*}/generativeQuestionFeature:#generative_questions_feature_config\x12\x80\x02\n#GetGenerativeQuestionsFeatureConfig\x12\x42.google.cloud.retail.v2.GetGenerativeQuestionsFeatureConfigRequest\x1a\x38.google.cloud.retail.v2.GenerativeQuestionsFeatureConfig\"[\xda\x41\x07\x63\x61talog\x82\xd3\xe4\x93\x02K\x12I/v2/{catalog=projects/*/locations/*/catalogs/*}/generativeQuestionFeature\x12\xf1\x01\n\x1dListGenerativeQuestionConfigs\x12<.google.cloud.retail.v2.ListGenerativeQuestionConfigsRequest\x1a=.google.cloud.retail.v2.ListGenerativeQuestionConfigsResponse\"S\xda\x41\x06parent\x82\xd3\xe4\x93\x02\x44\x12\x42/v2/{parent=projects/*/locations/*/catalogs/*}/generativeQuestions\x12\xbe\x02\n\x1eUpdateGenerativeQuestionConfig\x12=.google.cloud.retail.v2.UpdateGenerativeQuestionConfigRequest\x1a\x30.google.cloud.retail.v2.GenerativeQuestionConfig\"\xaa\x01\xda\x41&generative_question_config,update_mask\x82\xd3\xe4\x93\x02{2]/v2/{generative_question_config.catalog=projects/*/locations/*/catalogs/*}/generativeQuestion:\x1agenerative_question_config\x12\x9d\x02\n$BatchUpdateGenerativeQuestionConfigs\x12\x43.google.cloud.retail.v2.BatchUpdateGenerativeQuestionConfigsRequest\x1a\x44.google.cloud.retail.v2.BatchUpdateGenerativeQuestionConfigsResponse\"j\xda\x41\x0fparent,requests\x82\xd3\xe4\x93\x02R\"M/v2/{parent=projects/*/locations/*/catalogs/*}/generativeQuestion:batchUpdate:\x01*\x1aI\xca\x41\x15retail.googleapis.com\xd2\x41.https://www.googleapis.com/auth/cloud-platformB\xc9\x01\n\x1a\x63om.google.cloud.retail.v2B\x1eGenerativeQuestionServiceProtoP\x01Z2cloud.google.com/go/retail/apiv2/retailpb;retailpb\xa2\x02\x06RETAIL\xaa\x02\x16Google.Cloud.Retail.V2\xca\x02\x16Google\\Cloud\\Retail\\V2\xea\x02\x19Google::Cloud::Retail::V2b\x06proto3" + +pool = ::Google::Protobuf::DescriptorPool.generated_pool +pool.add_serialized_file(descriptor_data) + +module Google + module Cloud + module Retail + module V2 + UpdateGenerativeQuestionsFeatureConfigRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.UpdateGenerativeQuestionsFeatureConfigRequest").msgclass + GetGenerativeQuestionsFeatureConfigRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.GetGenerativeQuestionsFeatureConfigRequest").msgclass + ListGenerativeQuestionConfigsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ListGenerativeQuestionConfigsRequest").msgclass + ListGenerativeQuestionConfigsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ListGenerativeQuestionConfigsResponse").msgclass + UpdateGenerativeQuestionConfigRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.UpdateGenerativeQuestionConfigRequest").msgclass + BatchUpdateGenerativeQuestionConfigsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.BatchUpdateGenerativeQuestionConfigsRequest").msgclass + BatchUpdateGenerativeQuestionConfigsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.BatchUpdateGenerativeQuestionConfigsResponse").msgclass + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service_services_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service_services_pb.rb new file mode 100644 index 000000000000..259ede2d8557 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service_services_pb.rb @@ -0,0 +1,55 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# Source: google/cloud/retail/v2/generative_question_service.proto for package 'Google.Cloud.Retail.V2' +# Original file comments: +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +require 'grpc' +require 'google/cloud/retail/v2/generative_question_service_pb' + +module Google + module Cloud + module Retail + module V2 + module GenerativeQuestionService + # Service for managing LLM generated questions in search serving. + class Service + + include ::GRPC::GenericService + + self.marshal_class_method = :encode + self.unmarshal_class_method = :decode + self.service_name = 'google.cloud.retail.v2.GenerativeQuestionService' + + # Manages overal generative question feature state -- enables toggling + # feature on and off. + rpc :UpdateGenerativeQuestionsFeatureConfig, ::Google::Cloud::Retail::V2::UpdateGenerativeQuestionsFeatureConfigRequest, ::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig + # Manages overal generative question feature state -- enables toggling + # feature on and off. + rpc :GetGenerativeQuestionsFeatureConfig, ::Google::Cloud::Retail::V2::GetGenerativeQuestionsFeatureConfigRequest, ::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig + # Returns all questions for a given catalog. + rpc :ListGenerativeQuestionConfigs, ::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsRequest, ::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsResponse + # Allows management of individual questions. + rpc :UpdateGenerativeQuestionConfig, ::Google::Cloud::Retail::V2::UpdateGenerativeQuestionConfigRequest, ::Google::Cloud::Retail::V2::GenerativeQuestionConfig + # Allows management of multiple questions. + rpc :BatchUpdateGenerativeQuestionConfigs, ::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsRequest, ::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsResponse + end + + Stub = Service.rpc_stub_class + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/import_config_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/import_config_pb.rb new file mode 100644 index 000000000000..8dacabe59008 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/import_config_pb.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/retail/v2/import_config.proto + +require 'google/protobuf' + +require 'google/api/field_behavior_pb' +require 'google/api/resource_pb' +require 'google/cloud/retail/v2/product_pb' +require 'google/cloud/retail/v2/user_event_pb' +require 'google/protobuf/field_mask_pb' +require 'google/protobuf/timestamp_pb' +require 'google/rpc/status_pb' +require 'google/type/date_pb' + + +descriptor_data = "\n*google/cloud/retail/v2/import_config.proto\x12\x16google.cloud.retail.v2\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a$google/cloud/retail/v2/product.proto\x1a\'google/cloud/retail/v2/user_event.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x17google/rpc/status.proto\x1a\x16google/type/date.proto\"9\n\tGcsSource\x12\x17\n\ninput_uris\x18\x01 \x03(\tB\x03\xe0\x41\x02\x12\x13\n\x0b\x64\x61ta_schema\x18\x02 \x01(\t\"\xbc\x01\n\x0e\x42igQuerySource\x12+\n\x0epartition_date\x18\x06 \x01(\x0b\x32\x11.google.type.DateH\x00\x12\x12\n\nproject_id\x18\x05 \x01(\t\x12\x17\n\ndataset_id\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x15\n\x08table_id\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\x17\n\x0fgcs_staging_dir\x18\x03 \x01(\t\x12\x13\n\x0b\x64\x61ta_schema\x18\x04 \x01(\tB\x0b\n\tpartition\"M\n\x13ProductInlineSource\x12\x36\n\x08products\x18\x01 \x03(\x0b\x32\x1f.google.cloud.retail.v2.ProductB\x03\xe0\x41\x02\"T\n\x15UserEventInlineSource\x12;\n\x0buser_events\x18\x01 \x03(\x0b\x32!.google.cloud.retail.v2.UserEventB\x03\xe0\x41\x02\"9\n\x12ImportErrorsConfig\x12\x14\n\ngcs_prefix\x18\x01 \x01(\tH\x00\x42\r\n\x0b\x64\x65stination\"\xf8\x03\n\x15ImportProductsRequest\x12\x34\n\x06parent\x18\x01 \x01(\tB$\xe0\x41\x02\xfa\x41\x1e\n\x1cretail.googleapis.com/Branch\x12\x16\n\nrequest_id\x18\x06 \x01(\tB\x02\x18\x01\x12\x45\n\x0cinput_config\x18\x02 \x01(\x0b\x32*.google.cloud.retail.v2.ProductInputConfigB\x03\xe0\x41\x02\x12\x41\n\rerrors_config\x18\x03 \x01(\x0b\x32*.google.cloud.retail.v2.ImportErrorsConfig\x12/\n\x0bupdate_mask\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.FieldMask\x12]\n\x13reconciliation_mode\x18\x05 \x01(\x0e\x32@.google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode\x12!\n\x19notification_pubsub_topic\x18\x07 \x01(\t\"T\n\x12ReconciliationMode\x12#\n\x1fRECONCILIATION_MODE_UNSPECIFIED\x10\x00\x12\x0f\n\x0bINCREMENTAL\x10\x01\x12\x08\n\x04\x46ULL\x10\x02\"\xdc\x01\n\x17ImportUserEventsRequest\x12\x35\n\x06parent\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\n\x1dretail.googleapis.com/Catalog\x12G\n\x0cinput_config\x18\x02 \x01(\x0b\x32,.google.cloud.retail.v2.UserEventInputConfigB\x03\xe0\x41\x02\x12\x41\n\rerrors_config\x18\x03 \x01(\x0b\x32*.google.cloud.retail.v2.ImportErrorsConfig\"\xc5\x01\n\x1bImportCompletionDataRequest\x12\x35\n\x06parent\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\n\x1dretail.googleapis.com/Catalog\x12L\n\x0cinput_config\x18\x02 \x01(\x0b\x32\x31.google.cloud.retail.v2.CompletionDataInputConfigB\x03\xe0\x41\x02\x12!\n\x19notification_pubsub_topic\x18\x03 \x01(\t\"\xe9\x01\n\x12ProductInputConfig\x12L\n\x15product_inline_source\x18\x01 \x01(\x0b\x32+.google.cloud.retail.v2.ProductInlineSourceH\x00\x12\x37\n\ngcs_source\x18\x02 \x01(\x0b\x32!.google.cloud.retail.v2.GcsSourceH\x00\x12\x42\n\x10\x62ig_query_source\x18\x03 \x01(\x0b\x32&.google.cloud.retail.v2.BigQuerySourceH\x00\x42\x08\n\x06source\"\xff\x01\n\x14UserEventInputConfig\x12V\n\x18user_event_inline_source\x18\x01 \x01(\x0b\x32-.google.cloud.retail.v2.UserEventInlineSourceB\x03\xe0\x41\x02H\x00\x12<\n\ngcs_source\x18\x02 \x01(\x0b\x32!.google.cloud.retail.v2.GcsSourceB\x03\xe0\x41\x02H\x00\x12G\n\x10\x62ig_query_source\x18\x03 \x01(\x0b\x32&.google.cloud.retail.v2.BigQuerySourceB\x03\xe0\x41\x02H\x00\x42\x08\n\x06source\"n\n\x19\x43ompletionDataInputConfig\x12G\n\x10\x62ig_query_source\x18\x01 \x01(\x0b\x32&.google.cloud.retail.v2.BigQuerySourceB\x03\xe0\x41\x02H\x00\x42\x08\n\x06source\"\xdb\x01\n\x0eImportMetadata\x12/\n\x0b\x63reate_time\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12/\n\x0bupdate_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x15\n\rsuccess_count\x18\x03 \x01(\x03\x12\x15\n\rfailure_count\x18\x04 \x01(\x03\x12\x16\n\nrequest_id\x18\x05 \x01(\tB\x02\x18\x01\x12!\n\x19notification_pubsub_topic\x18\x06 \x01(\t\"\x86\x01\n\x16ImportProductsResponse\x12)\n\rerror_samples\x18\x01 \x03(\x0b\x32\x12.google.rpc.Status\x12\x41\n\rerrors_config\x18\x02 \x01(\x0b\x32*.google.cloud.retail.v2.ImportErrorsConfig\"\xd0\x01\n\x18ImportUserEventsResponse\x12)\n\rerror_samples\x18\x01 \x03(\x0b\x32\x12.google.rpc.Status\x12\x41\n\rerrors_config\x18\x02 \x01(\x0b\x32*.google.cloud.retail.v2.ImportErrorsConfig\x12\x46\n\x0eimport_summary\x18\x03 \x01(\x0b\x32..google.cloud.retail.v2.UserEventImportSummary\"T\n\x16UserEventImportSummary\x12\x1b\n\x13joined_events_count\x18\x01 \x01(\x03\x12\x1d\n\x15unjoined_events_count\x18\x02 \x01(\x03\"I\n\x1cImportCompletionDataResponse\x12)\n\rerror_samples\x18\x01 \x03(\x0b\x32\x12.google.rpc.StatusB\xbc\x01\n\x1a\x63om.google.cloud.retail.v2B\x11ImportConfigProtoP\x01Z2cloud.google.com/go/retail/apiv2/retailpb;retailpb\xa2\x02\x06RETAIL\xaa\x02\x16Google.Cloud.Retail.V2\xca\x02\x16Google\\Cloud\\Retail\\V2\xea\x02\x19Google::Cloud::Retail::V2b\x06proto3" + +pool = ::Google::Protobuf::DescriptorPool.generated_pool +pool.add_serialized_file(descriptor_data) + +module Google + module Cloud + module Retail + module V2 + GcsSource = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.GcsSource").msgclass + BigQuerySource = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.BigQuerySource").msgclass + ProductInlineSource = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ProductInlineSource").msgclass + UserEventInlineSource = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.UserEventInlineSource").msgclass + ImportErrorsConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ImportErrorsConfig").msgclass + ImportProductsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ImportProductsRequest").msgclass + ImportProductsRequest::ReconciliationMode = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode").enummodule + ImportUserEventsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ImportUserEventsRequest").msgclass + ImportCompletionDataRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ImportCompletionDataRequest").msgclass + ProductInputConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ProductInputConfig").msgclass + UserEventInputConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.UserEventInputConfig").msgclass + CompletionDataInputConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CompletionDataInputConfig").msgclass + ImportMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ImportMetadata").msgclass + ImportProductsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ImportProductsResponse").msgclass + ImportUserEventsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ImportUserEventsResponse").msgclass + UserEventImportSummary = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.UserEventImportSummary").msgclass + ImportCompletionDataResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ImportCompletionDataResponse").msgclass + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_pb.rb new file mode 100644 index 000000000000..037bc3c8d29c --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_pb.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/retail/v2/model.proto + +require 'google/protobuf' + +require 'google/api/field_behavior_pb' +require 'google/api/resource_pb' +require 'google/cloud/retail/v2/common_pb' +require 'google/protobuf/timestamp_pb' + + +descriptor_data = "\n\"google/cloud/retail/v2/model.proto\x12\x16google.cloud.retail.v2\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a#google/cloud/retail/v2/common.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\x97\x0e\n\x05Model\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x19\n\x0c\x64isplay_name\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12H\n\x0etraining_state\x18\x03 \x01(\x0e\x32+.google.cloud.retail.v2.Model.TrainingStateB\x03\xe0\x41\x01\x12\x46\n\rserving_state\x18\x04 \x01(\x0e\x32*.google.cloud.retail.v2.Model.ServingStateB\x03\xe0\x41\x03\x12\x34\n\x0b\x63reate_time\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x34\n\x0bupdate_time\x18\x06 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x11\n\x04type\x18\x07 \x01(\tB\x03\xe0\x41\x02\x12#\n\x16optimization_objective\x18\x08 \x01(\tB\x03\xe0\x41\x01\x12U\n\x15periodic_tuning_state\x18\x0b \x01(\x0e\x32\x31.google.cloud.retail.v2.Model.PeriodicTuningStateB\x03\xe0\x41\x01\x12\x37\n\x0elast_tune_time\x18\x0c \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x1d\n\x10tuning_operation\x18\x0f \x01(\tB\x03\xe0\x41\x03\x12@\n\ndata_state\x18\x10 \x01(\x0e\x32\'.google.cloud.retail.v2.Model.DataStateB\x03\xe0\x41\x03\x12U\n\x10\x66iltering_option\x18\x12 \x01(\x0e\x32\x36.google.cloud.retail.v2.RecommendationsFilteringOptionB\x03\xe0\x41\x01\x12R\n\x14serving_config_lists\x18\x13 \x03(\x0b\x32/.google.cloud.retail.v2.Model.ServingConfigListB\x03\xe0\x41\x03\x12U\n\x15model_features_config\x18\x16 \x01(\x0b\x32\x31.google.cloud.retail.v2.Model.ModelFeaturesConfigB\x03\xe0\x41\x01\x1a\x34\n\x11ServingConfigList\x12\x1f\n\x12serving_config_ids\x18\x01 \x03(\tB\x03\xe0\x41\x01\x1a\x7f\n&FrequentlyBoughtTogetherFeaturesConfig\x12U\n\x15\x63ontext_products_type\x18\x02 \x01(\x0e\x32\x31.google.cloud.retail.v2.Model.ContextProductsTypeB\x03\xe0\x41\x01\x1a\xa1\x01\n\x13ModelFeaturesConfig\x12q\n!frequently_bought_together_config\x18\x01 \x01(\x0b\x32\x44.google.cloud.retail.v2.Model.FrequentlyBoughtTogetherFeaturesConfigH\x00\x42\x17\n\x15type_dedicated_config\"R\n\x0cServingState\x12\x1d\n\x19SERVING_STATE_UNSPECIFIED\x10\x00\x12\x0c\n\x08INACTIVE\x10\x01\x12\n\n\x06\x41\x43TIVE\x10\x02\x12\t\n\x05TUNED\x10\x03\"I\n\rTrainingState\x12\x1e\n\x1aTRAINING_STATE_UNSPECIFIED\x10\x00\x12\n\n\x06PAUSED\x10\x01\x12\x0c\n\x08TRAINING\x10\x02\"\x90\x01\n\x13PeriodicTuningState\x12%\n!PERIODIC_TUNING_STATE_UNSPECIFIED\x10\x00\x12\x1c\n\x18PERIODIC_TUNING_DISABLED\x10\x01\x12\x17\n\x13\x41LL_TUNING_DISABLED\x10\x03\x12\x1b\n\x17PERIODIC_TUNING_ENABLED\x10\x02\"D\n\tDataState\x12\x1a\n\x16\x44\x41TA_STATE_UNSPECIFIED\x10\x00\x12\x0b\n\x07\x44\x41TA_OK\x10\x01\x12\x0e\n\nDATA_ERROR\x10\x02\"w\n\x13\x43ontextProductsType\x12%\n!CONTEXT_PRODUCTS_TYPE_UNSPECIFIED\x10\x00\x12\x1a\n\x16SINGLE_CONTEXT_PRODUCT\x10\x01\x12\x1d\n\x19MULTIPLE_CONTEXT_PRODUCTS\x10\x02:k\xea\x41h\n\x1bretail.googleapis.com/Model\x12Iprojects/{project}/locations/{location}/catalogs/{catalog}/models/{model}B\xb5\x01\n\x1a\x63om.google.cloud.retail.v2B\nModelProtoP\x01Z2cloud.google.com/go/retail/apiv2/retailpb;retailpb\xa2\x02\x06RETAIL\xaa\x02\x16Google.Cloud.Retail.V2\xca\x02\x16Google\\Cloud\\Retail\\V2\xea\x02\x19Google::Cloud::Retail::V2b\x06proto3" + +pool = ::Google::Protobuf::DescriptorPool.generated_pool +pool.add_serialized_file(descriptor_data) + +module Google + module Cloud + module Retail + module V2 + Model = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Model").msgclass + Model::ServingConfigList = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Model.ServingConfigList").msgclass + Model::FrequentlyBoughtTogetherFeaturesConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Model.FrequentlyBoughtTogetherFeaturesConfig").msgclass + Model::ModelFeaturesConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Model.ModelFeaturesConfig").msgclass + Model::ServingState = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Model.ServingState").enummodule + Model::TrainingState = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Model.TrainingState").enummodule + Model::PeriodicTuningState = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Model.PeriodicTuningState").enummodule + Model::DataState = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Model.DataState").enummodule + Model::ContextProductsType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Model.ContextProductsType").enummodule + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service.rb new file mode 100644 index 000000000000..7494180ffbb2 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service.rb @@ -0,0 +1,67 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/common" +require "gapic/config" +require "gapic/config/method" + +require "google/cloud/retail/v2/version" + +require "google/cloud/retail/v2/model_service/credentials" +require "google/cloud/retail/v2/model_service/paths" +require "google/cloud/retail/v2/model_service/operations" +require "google/cloud/retail/v2/model_service/client" +require "google/cloud/retail/v2/model_service/rest" + +module Google + module Cloud + module Retail + module V2 + ## + # Service for performing CRUD operations on models. + # Recommendation models contain all the metadata necessary to generate a set of + # models for the `Predict()` API. A model is queried + # indirectly via a ServingConfig, which associates a model with a + # given Placement (e.g. Frequently Bought Together on Home Page). + # + # This service allows you to do the following: + # + # * Initiate training of a model. + # * Pause training of an existing model. + # * List all the available models along with their metadata. + # * Control their tuning schedule. + # + # @example Load this service and instantiate a gRPC client + # + # require "google/cloud/retail/v2/model_service" + # client = ::Google::Cloud::Retail::V2::ModelService::Client.new + # + # @example Load this service and instantiate a REST client + # + # require "google/cloud/retail/v2/model_service/rest" + # client = ::Google::Cloud::Retail::V2::ModelService::Rest::Client.new + # + module ModelService + end + end + end + end +end + +helper_path = ::File.join __dir__, "model_service", "helpers.rb" +require "google/cloud/retail/v2/model_service/helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/client.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/client.rb new file mode 100644 index 000000000000..c39bfc7e2a36 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/client.rb @@ -0,0 +1,1221 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/cloud/retail/v2/model_service_pb" +require "google/cloud/location" + +module Google + module Cloud + module Retail + module V2 + module ModelService + ## + # Client for the ModelService service. + # + # Service for performing CRUD operations on models. + # Recommendation models contain all the metadata necessary to generate a set of + # models for the `Predict()` API. A model is queried + # indirectly via a ServingConfig, which associates a model with a + # given Placement (e.g. Frequently Bought Together on Home Page). + # + # This service allows you to do the following: + # + # * Initiate training of a model. + # * Pause training of an existing model. + # * List all the available models along with their metadata. + # * Control their tuning schedule. + # + class Client + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" + + include Paths + + # @private + attr_reader :model_service_stub + + ## + # Configure the ModelService Client class. + # + # See {::Google::Cloud::Retail::V2::ModelService::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all ModelService clients + # ::Google::Cloud::Retail::V2::ModelService::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "Retail", "V2"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config.timeout = 60.0 + default_config.retry_policy = { + initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4] + } + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the ModelService Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Cloud::Retail::V2::ModelService::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @model_service_stub.universe_domain + end + + ## + # Create a new ModelService client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::Retail::V2::ModelService::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::Retail::V2::ModelService::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the ModelService client. + # @yieldparam config [Client::Configuration] + # + def initialize + # These require statements are intentionally placed here to initialize + # the gRPC module only when it's required. + # See https://github.com/googleapis/toolkit/issues/446 + require "gapic/grpc" + require "google/cloud/retail/v2/model_service_services_pb" + + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @operations_client = Operations.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain + end + + @model_service_stub = ::Gapic::ServiceStub.new( + ::Google::Cloud::Retail::V2::ModelService::Stub, + credentials: credentials, + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + channel_args: @config.channel_args, + interceptors: @config.interceptors, + channel_pool_config: @config.channel_pool, + logger: @config.logger + ) + + @model_service_stub.stub_logger&.info do |entry| + entry.set_system_name + entry.set_service + entry.message = "Created client for #{entry.service}" + entry.set_credentials_fields credentials + entry.set "customEndpoint", @config.endpoint if @config.endpoint + entry.set "defaultTimeout", @config.timeout if @config.timeout + entry.set "quotaProject", @quota_project_id if @quota_project_id + end + + @location_client = Google::Cloud::Location::Locations::Client.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @model_service_stub.endpoint + config.universe_domain = @model_service_stub.universe_domain + config.logger = @model_service_stub.logger if config.respond_to? :logger= + end + end + + ## + # Get the associated client for long-running operations. + # + # @return [::Google::Cloud::Retail::V2::ModelService::Operations] + # + attr_reader :operations_client + + ## + # Get the associated client for mix-in of the Locations. + # + # @return [Google::Cloud::Location::Locations::Client] + # + attr_reader :location_client + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @model_service_stub.logger + end + + # Service calls + + ## + # Creates a new model. + # + # @overload create_model(request, options = nil) + # Pass arguments to `create_model` via a request object, either of type + # {::Google::Cloud::Retail::V2::CreateModelRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::CreateModelRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload create_model(parent: nil, model: nil, dry_run: nil) + # Pass arguments to `create_model` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. The parent resource under which to create the model. Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` + # @param model [::Google::Cloud::Retail::V2::Model, ::Hash] + # Required. The payload of the {::Google::Cloud::Retail::V2::Model Model} to + # create. + # @param dry_run [::Boolean] + # Optional. Whether to run a dry run to validate the request (without + # actually creating the model). + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ModelService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::CreateModelRequest.new + # + # # Call the create_model method. + # result = client.create_model request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def create_model request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::CreateModelRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.create_model.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.create_model.timeout, + metadata: metadata, + retry_policy: @config.rpcs.create_model.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @model_service_stub.call_rpc :create_model, request, options: options do |response, operation| + response = ::Gapic::Operation.new response, @operations_client, options: options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets a model. + # + # @overload get_model(request, options = nil) + # Pass arguments to `get_model` via a request object, either of type + # {::Google::Cloud::Retail::V2::GetModelRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::GetModelRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload get_model(name: nil) + # Pass arguments to `get_model` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. The resource name of the {::Google::Cloud::Retail::V2::Model Model} to + # get. Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog}/models/{model_id}` + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Retail::V2::Model] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Retail::V2::Model] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ModelService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::GetModelRequest.new + # + # # Call the get_model method. + # result = client.get_model request + # + # # The returned object is of type Google::Cloud::Retail::V2::Model. + # p result + # + def get_model request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::GetModelRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.get_model.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.get_model.timeout, + metadata: metadata, + retry_policy: @config.rpcs.get_model.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @model_service_stub.call_rpc :get_model, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Pauses the training of an existing model. + # + # @overload pause_model(request, options = nil) + # Pass arguments to `pause_model` via a request object, either of type + # {::Google::Cloud::Retail::V2::PauseModelRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::PauseModelRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload pause_model(name: nil) + # Pass arguments to `pause_model` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. The name of the model to pause. + # Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Retail::V2::Model] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Retail::V2::Model] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ModelService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::PauseModelRequest.new + # + # # Call the pause_model method. + # result = client.pause_model request + # + # # The returned object is of type Google::Cloud::Retail::V2::Model. + # p result + # + def pause_model request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::PauseModelRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.pause_model.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.pause_model.timeout, + metadata: metadata, + retry_policy: @config.rpcs.pause_model.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @model_service_stub.call_rpc :pause_model, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Resumes the training of an existing model. + # + # @overload resume_model(request, options = nil) + # Pass arguments to `resume_model` via a request object, either of type + # {::Google::Cloud::Retail::V2::ResumeModelRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::ResumeModelRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload resume_model(name: nil) + # Pass arguments to `resume_model` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. The name of the model to resume. + # Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Retail::V2::Model] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Retail::V2::Model] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ModelService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::ResumeModelRequest.new + # + # # Call the resume_model method. + # result = client.resume_model request + # + # # The returned object is of type Google::Cloud::Retail::V2::Model. + # p result + # + def resume_model request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ResumeModelRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.resume_model.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.resume_model.timeout, + metadata: metadata, + retry_policy: @config.rpcs.resume_model.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @model_service_stub.call_rpc :resume_model, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Deletes an existing model. + # + # @overload delete_model(request, options = nil) + # Pass arguments to `delete_model` via a request object, either of type + # {::Google::Cloud::Retail::V2::DeleteModelRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::DeleteModelRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload delete_model(name: nil) + # Pass arguments to `delete_model` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. The resource name of the {::Google::Cloud::Retail::V2::Model Model} to + # delete. Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Protobuf::Empty] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Protobuf::Empty] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ModelService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::DeleteModelRequest.new + # + # # Call the delete_model method. + # result = client.delete_model request + # + # # The returned object is of type Google::Protobuf::Empty. + # p result + # + def delete_model request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::DeleteModelRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.delete_model.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.delete_model.timeout, + metadata: metadata, + retry_policy: @config.rpcs.delete_model.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @model_service_stub.call_rpc :delete_model, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists all the models linked to this event store. + # + # @overload list_models(request, options = nil) + # Pass arguments to `list_models` via a request object, either of type + # {::Google::Cloud::Retail::V2::ListModelsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::ListModelsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload list_models(parent: nil, page_size: nil, page_token: nil) + # Pass arguments to `list_models` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. The parent for which to list models. + # Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` + # @param page_size [::Integer] + # Optional. Maximum number of results to return. If unspecified, defaults + # to 50. Max allowed value is 1000. + # @param page_token [::String] + # Optional. A page token, received from a previous `ListModels` + # call. Provide this to retrieve the subsequent page. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Retail::V2::Model>] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::PagedEnumerable<::Google::Cloud::Retail::V2::Model>] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ModelService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::ListModelsRequest.new + # + # # Call the list_models method. + # result = client.list_models request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Cloud::Retail::V2::Model. + # p item + # end + # + def list_models request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ListModelsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.list_models.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.list_models.timeout, + metadata: metadata, + retry_policy: @config.rpcs.list_models.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @model_service_stub.call_rpc :list_models, request, options: options do |response, operation| + response = ::Gapic::PagedEnumerable.new @model_service_stub, :list_models, request, response, operation, options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Update of model metadata. Only fields that + # currently can be updated are: `filtering_option` and + # `periodic_tuning_state`. + # If other values are provided, this API method ignores them. + # + # @overload update_model(request, options = nil) + # Pass arguments to `update_model` via a request object, either of type + # {::Google::Cloud::Retail::V2::UpdateModelRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::UpdateModelRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload update_model(model: nil, update_mask: nil) + # Pass arguments to `update_model` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param model [::Google::Cloud::Retail::V2::Model, ::Hash] + # Required. The body of the updated {::Google::Cloud::Retail::V2::Model Model}. + # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] + # Optional. Indicates which fields in the provided 'model' to + # update. If not set, by default updates all fields. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Retail::V2::Model] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Retail::V2::Model] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ModelService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::UpdateModelRequest.new + # + # # Call the update_model method. + # result = client.update_model request + # + # # The returned object is of type Google::Cloud::Retail::V2::Model. + # p result + # + def update_model request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::UpdateModelRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.update_model.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.model&.name + header_params["model.name"] = request.model.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.update_model.timeout, + metadata: metadata, + retry_policy: @config.rpcs.update_model.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @model_service_stub.call_rpc :update_model, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Tunes an existing model. + # + # @overload tune_model(request, options = nil) + # Pass arguments to `tune_model` via a request object, either of type + # {::Google::Cloud::Retail::V2::TuneModelRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::TuneModelRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload tune_model(name: nil) + # Pass arguments to `tune_model` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. The resource name of the model to tune. + # Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ModelService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::TuneModelRequest.new + # + # # Call the tune_model method. + # result = client.tune_model request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def tune_model request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::TuneModelRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.tune_model.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.tune_model.timeout, + metadata: metadata, + retry_policy: @config.rpcs.tune_model.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @model_service_stub.call_rpc :tune_model, request, options: options do |response, operation| + response = ::Gapic::Operation.new response, @operations_client, options: options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the ModelService API. + # + # This class represents the configuration for ModelService, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::Retail::V2::ModelService::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # create_model to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Retail::V2::ModelService::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.create_model.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Retail::V2::ModelService::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.create_model.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`GRPC::Core::Channel`) a gRPC channel with included credentials + # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object + # * (`nil`) indicating no credentials + # + # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials + # is deprecated. Providing an unvalidated credential configuration to + # Google APIs can compromise the security of your systems and data. + # + # @example + # + # # The recommended way to provide credentials is to use the `make_creds` method + # # on the appropriate credentials class for your environment. + # + # require "googleauth" + # + # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds( + # json_key_io: ::File.open("/path/to/keyfile.json") + # ) + # + # client = ::Google::Cloud::Retail::V2::ModelService::Client.new do |config| + # config.credentials = credentials + # end + # + # @note Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] channel_args + # Extra parameters passed to the gRPC channel. Note: this is ignored if a + # `GRPC::Core::Channel` object is provided as the credential. + # @return [::Hash] + # @!attribute [rw] interceptors + # An array of interceptors that are run before calls are executed. + # @return [::Array<::GRPC::ClientInterceptor>] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional gRPC headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "retail.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) + config_attr :interceptors, nil, ::Array, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration for the channel pool + # @return [::Gapic::ServiceStub::ChannelPool::Configuration] + # + def channel_pool + @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new + end + + ## + # Configuration RPC class for the ModelService API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `create_model` + # @return [::Gapic::Config::Method] + # + attr_reader :create_model + ## + # RPC-specific configuration for `get_model` + # @return [::Gapic::Config::Method] + # + attr_reader :get_model + ## + # RPC-specific configuration for `pause_model` + # @return [::Gapic::Config::Method] + # + attr_reader :pause_model + ## + # RPC-specific configuration for `resume_model` + # @return [::Gapic::Config::Method] + # + attr_reader :resume_model + ## + # RPC-specific configuration for `delete_model` + # @return [::Gapic::Config::Method] + # + attr_reader :delete_model + ## + # RPC-specific configuration for `list_models` + # @return [::Gapic::Config::Method] + # + attr_reader :list_models + ## + # RPC-specific configuration for `update_model` + # @return [::Gapic::Config::Method] + # + attr_reader :update_model + ## + # RPC-specific configuration for `tune_model` + # @return [::Gapic::Config::Method] + # + attr_reader :tune_model + + # @private + def initialize parent_rpcs = nil + create_model_config = parent_rpcs.create_model if parent_rpcs.respond_to? :create_model + @create_model = ::Gapic::Config::Method.new create_model_config + get_model_config = parent_rpcs.get_model if parent_rpcs.respond_to? :get_model + @get_model = ::Gapic::Config::Method.new get_model_config + pause_model_config = parent_rpcs.pause_model if parent_rpcs.respond_to? :pause_model + @pause_model = ::Gapic::Config::Method.new pause_model_config + resume_model_config = parent_rpcs.resume_model if parent_rpcs.respond_to? :resume_model + @resume_model = ::Gapic::Config::Method.new resume_model_config + delete_model_config = parent_rpcs.delete_model if parent_rpcs.respond_to? :delete_model + @delete_model = ::Gapic::Config::Method.new delete_model_config + list_models_config = parent_rpcs.list_models if parent_rpcs.respond_to? :list_models + @list_models = ::Gapic::Config::Method.new list_models_config + update_model_config = parent_rpcs.update_model if parent_rpcs.respond_to? :update_model + @update_model = ::Gapic::Config::Method.new update_model_config + tune_model_config = parent_rpcs.tune_model if parent_rpcs.respond_to? :tune_model + @tune_model = ::Gapic::Config::Method.new tune_model_config + + yield self if block_given? + end + end + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/credentials.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/credentials.rb new file mode 100644 index 000000000000..acf6300e811b --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/credentials.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "googleauth" + +module Google + module Cloud + module Retail + module V2 + module ModelService + # Credentials for the ModelService API. + class Credentials < ::Google::Auth::Credentials + self.scope = [ + "https://www.googleapis.com/auth/cloud-platform" + ] + self.env_vars = [ + "RETAIL_CREDENTIALS", + "RETAIL_KEYFILE", + "GOOGLE_CLOUD_CREDENTIALS", + "GOOGLE_CLOUD_KEYFILE", + "GCLOUD_KEYFILE", + "RETAIL_CREDENTIALS_JSON", + "RETAIL_KEYFILE_JSON", + "GOOGLE_CLOUD_CREDENTIALS_JSON", + "GOOGLE_CLOUD_KEYFILE_JSON", + "GCLOUD_KEYFILE_JSON" + ] + self.paths = [ + "~/.config/google_cloud/application_default_credentials.json" + ] + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/operations.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/operations.rb new file mode 100644 index 000000000000..ae16a84e1ee1 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/operations.rb @@ -0,0 +1,843 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/operation" +require "google/longrunning/operations_pb" + +module Google + module Cloud + module Retail + module V2 + module ModelService + # Service that implements Longrunning Operations API. + class Operations + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" + + # @private + attr_reader :operations_stub + + ## + # Configuration for the ModelService Operations API. + # + # @yield [config] Configure the Operations client. + # @yieldparam config [Operations::Configuration] + # + # @return [Operations::Configuration] + # + def self.configure + @configure ||= Operations::Configuration.new + yield @configure if block_given? + @configure + end + + ## + # Configure the ModelService Operations instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Operations.configure}. + # + # @yield [config] Configure the Operations client. + # @yieldparam config [Operations::Configuration] + # + # @return [Operations::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @operations_stub.universe_domain + end + + ## + # Create a new Operations client object. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Operations::Configuration] + # + def initialize + # These require statements are intentionally placed here to initialize + # the gRPC module only when it's required. + # See https://github.com/googleapis/toolkit/issues/446 + require "gapic/grpc" + require "google/longrunning/operations_services_pb" + + # Create the configuration object + @config = Configuration.new Operations.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + credentials ||= Credentials.default scope: @config.scope + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @operations_stub = ::Gapic::ServiceStub.new( + ::Google::Longrunning::Operations::Stub, + credentials: credentials, + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + channel_args: @config.channel_args, + interceptors: @config.interceptors, + channel_pool_config: @config.channel_pool + ) + + # Used by an LRO wrapper for some methods of this service + @operations_client = self + end + + # Service calls + + ## + # Lists operations that match the specified filter in the request. If the + # server doesn't support this method, it returns `UNIMPLEMENTED`. + # + # @overload list_operations(request, options = nil) + # Pass arguments to `list_operations` via a request object, either of type + # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::ListOperationsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload list_operations(name: nil, filter: nil, page_size: nil, page_token: nil, return_partial_success: nil) + # Pass arguments to `list_operations` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation's parent resource. + # @param filter [::String] + # The standard list filter. + # @param page_size [::Integer] + # The standard list page size. + # @param page_token [::String] + # The standard list page token. + # @param return_partial_success [::Boolean] + # When set to `true`, operations that are reachable are returned as normal, + # and those that are unreachable are returned in the + # [ListOperationsResponse.unreachable] field. + # + # This can only be `true` when reading across collections e.g. when `parent` + # is set to `"projects/example/locations/-"`. + # + # This field is not by default supported and will result in an + # `UNIMPLEMENTED` error if set unless explicitly documented otherwise in + # service or product specific documentation. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::PagedEnumerable<::Gapic::Operation>] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::PagedEnumerable<::Gapic::Operation>] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::ListOperationsRequest.new + # + # # Call the list_operations method. + # result = client.list_operations request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Longrunning::Operation. + # p item + # end + # + def list_operations request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::ListOperationsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.list_operations.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.list_operations.timeout, + metadata: metadata, + retry_policy: @config.rpcs.list_operations.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.call_rpc :list_operations, request, options: options do |response, operation| + wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client } + response = ::Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets the latest state of a long-running operation. Clients can use this + # method to poll the operation result at intervals as recommended by the API + # service. + # + # @overload get_operation(request, options = nil) + # Pass arguments to `get_operation` via a request object, either of type + # {::Google::Longrunning::GetOperationRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::GetOperationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload get_operation(name: nil) + # Pass arguments to `get_operation` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation resource. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::GetOperationRequest.new + # + # # Call the get_operation method. + # result = client.get_operation request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def get_operation request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::GetOperationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.get_operation.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.get_operation.timeout, + metadata: metadata, + retry_policy: @config.rpcs.get_operation.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.call_rpc :get_operation, request, options: options do |response, operation| + response = ::Gapic::Operation.new response, @operations_client, options: options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Deletes a long-running operation. This method indicates that the client is + # no longer interested in the operation result. It does not cancel the + # operation. If the server doesn't support this method, it returns + # `google.rpc.Code.UNIMPLEMENTED`. + # + # @overload delete_operation(request, options = nil) + # Pass arguments to `delete_operation` via a request object, either of type + # {::Google::Longrunning::DeleteOperationRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::DeleteOperationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload delete_operation(name: nil) + # Pass arguments to `delete_operation` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation resource to be deleted. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Protobuf::Empty] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Protobuf::Empty] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::DeleteOperationRequest.new + # + # # Call the delete_operation method. + # result = client.delete_operation request + # + # # The returned object is of type Google::Protobuf::Empty. + # p result + # + def delete_operation request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::DeleteOperationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.delete_operation.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.delete_operation.timeout, + metadata: metadata, + retry_policy: @config.rpcs.delete_operation.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.call_rpc :delete_operation, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Starts asynchronous cancellation on a long-running operation. The server + # makes a best effort to cancel the operation, but success is not + # guaranteed. If the server doesn't support this method, it returns + # `google.rpc.Code.UNIMPLEMENTED`. Clients can use + # Operations.GetOperation or + # other methods to check whether the cancellation succeeded or whether the + # operation completed despite cancellation. On successful cancellation, + # the operation is not deleted; instead, it becomes an operation with + # an {::Google::Longrunning::Operation#error Operation.error} value with a + # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to + # `Code.CANCELLED`. + # + # @overload cancel_operation(request, options = nil) + # Pass arguments to `cancel_operation` via a request object, either of type + # {::Google::Longrunning::CancelOperationRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::CancelOperationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload cancel_operation(name: nil) + # Pass arguments to `cancel_operation` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation resource to be cancelled. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Protobuf::Empty] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Protobuf::Empty] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::CancelOperationRequest.new + # + # # Call the cancel_operation method. + # result = client.cancel_operation request + # + # # The returned object is of type Google::Protobuf::Empty. + # p result + # + def cancel_operation request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::CancelOperationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.cancel_operation.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.cancel_operation.timeout, + metadata: metadata, + retry_policy: @config.rpcs.cancel_operation.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Waits until the specified long-running operation is done or reaches at most + # a specified timeout, returning the latest state. If the operation is + # already done, the latest state is immediately returned. If the timeout + # specified is greater than the default HTTP/RPC timeout, the HTTP/RPC + # timeout is used. If the server does not support this method, it returns + # `google.rpc.Code.UNIMPLEMENTED`. + # Note that this method is on a best-effort basis. It may return the latest + # state before the specified timeout (including immediately), meaning even an + # immediate response is no guarantee that the operation is done. + # + # @overload wait_operation(request, options = nil) + # Pass arguments to `wait_operation` via a request object, either of type + # {::Google::Longrunning::WaitOperationRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::WaitOperationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload wait_operation(name: nil, timeout: nil) + # Pass arguments to `wait_operation` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation resource to wait on. + # @param timeout [::Google::Protobuf::Duration, ::Hash] + # The maximum duration to wait before timing out. If left blank, the wait + # will be at most the time permitted by the underlying HTTP/RPC protocol. + # If RPC context deadline is also specified, the shorter one will be used. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::WaitOperationRequest.new + # + # # Call the wait_operation method. + # result = client.wait_operation request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def wait_operation request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::WaitOperationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.wait_operation.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.wait_operation.timeout, + metadata: metadata, + retry_policy: @config.rpcs.wait_operation.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation| + response = ::Gapic::Operation.new response, @operations_client, options: options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the Operations API. + # + # This class represents the configuration for Operations, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Longrunning::Operations::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # list_operations to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Longrunning::Operations::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.list_operations.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Longrunning::Operations::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.list_operations.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`GRPC::Core::Channel`) a gRPC channel with included credentials + # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object + # * (`nil`) indicating no credentials + # + # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials + # is deprecated. Providing an unvalidated credential configuration to + # Google APIs can compromise the security of your systems and data. + # + # @example + # + # # The recommended way to provide credentials is to use the `make_creds` method + # # on the appropriate credentials class for your environment. + # + # require "googleauth" + # + # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds( + # json_key_io: ::File.open("/path/to/keyfile.json") + # ) + # + # client = ::Google::Longrunning::Operations::Client.new do |config| + # config.credentials = credentials + # end + # + # @note Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] channel_args + # Extra parameters passed to the gRPC channel. Note: this is ignored if a + # `GRPC::Core::Channel` object is provided as the credential. + # @return [::Hash] + # @!attribute [rw] interceptors + # An array of interceptors that are run before calls are executed. + # @return [::Array<::GRPC::ClientInterceptor>] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional gRPC headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "retail.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) + config_attr :interceptors, nil, ::Array, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration for the channel pool + # @return [::Gapic::ServiceStub::ChannelPool::Configuration] + # + def channel_pool + @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new + end + + ## + # Configuration RPC class for the Operations API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `list_operations` + # @return [::Gapic::Config::Method] + # + attr_reader :list_operations + ## + # RPC-specific configuration for `get_operation` + # @return [::Gapic::Config::Method] + # + attr_reader :get_operation + ## + # RPC-specific configuration for `delete_operation` + # @return [::Gapic::Config::Method] + # + attr_reader :delete_operation + ## + # RPC-specific configuration for `cancel_operation` + # @return [::Gapic::Config::Method] + # + attr_reader :cancel_operation + ## + # RPC-specific configuration for `wait_operation` + # @return [::Gapic::Config::Method] + # + attr_reader :wait_operation + + # @private + def initialize parent_rpcs = nil + list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations + @list_operations = ::Gapic::Config::Method.new list_operations_config + get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation + @get_operation = ::Gapic::Config::Method.new get_operation_config + delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation + @delete_operation = ::Gapic::Config::Method.new delete_operation_config + cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation + @cancel_operation = ::Gapic::Config::Method.new cancel_operation_config + wait_operation_config = parent_rpcs.wait_operation if parent_rpcs.respond_to? :wait_operation + @wait_operation = ::Gapic::Config::Method.new wait_operation_config + + yield self if block_given? + end + end + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/paths.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/paths.rb new file mode 100644 index 000000000000..dfac159c4ef5 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/paths.rb @@ -0,0 +1,73 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Retail + module V2 + module ModelService + # Path helper methods for the ModelService API. + module Paths + ## + # Create a fully-qualified Catalog resource string. + # + # The resource will be in the following format: + # + # `projects/{project}/locations/{location}/catalogs/{catalog}` + # + # @param project [String] + # @param location [String] + # @param catalog [String] + # + # @return [::String] + def catalog_path project:, location:, catalog: + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" + + "projects/#{project}/locations/#{location}/catalogs/#{catalog}" + end + + ## + # Create a fully-qualified Model resource string. + # + # The resource will be in the following format: + # + # `projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}` + # + # @param project [String] + # @param location [String] + # @param catalog [String] + # @param model [String] + # + # @return [::String] + def model_path project:, location:, catalog:, model: + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" + raise ::ArgumentError, "catalog cannot contain /" if catalog.to_s.include? "/" + + "projects/#{project}/locations/#{location}/catalogs/#{catalog}/models/#{model}" + end + + extend self + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/rest.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/rest.rb new file mode 100644 index 000000000000..09cc5600da6e --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/rest.rb @@ -0,0 +1,64 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/rest" +require "gapic/config" +require "gapic/config/method" + +require "google/cloud/retail/v2/version" + +require "google/cloud/retail/v2/model_service/credentials" +require "google/cloud/retail/v2/model_service/paths" +require "google/cloud/retail/v2/model_service/rest/operations" +require "google/cloud/retail/v2/model_service/rest/client" + +module Google + module Cloud + module Retail + module V2 + ## + # Service for performing CRUD operations on models. + # Recommendation models contain all the metadata necessary to generate a set of + # models for the `Predict()` API. A model is queried + # indirectly via a ServingConfig, which associates a model with a + # given Placement (e.g. Frequently Bought Together on Home Page). + # + # This service allows you to do the following: + # + # * Initiate training of a model. + # * Pause training of an existing model. + # * List all the available models along with their metadata. + # * Control their tuning schedule. + # + # To load this service and instantiate a REST client: + # + # require "google/cloud/retail/v2/model_service/rest" + # client = ::Google::Cloud::Retail::V2::ModelService::Rest::Client.new + # + module ModelService + # Client for the REST transport + module Rest + end + end + end + end + end +end + +helper_path = ::File.join __dir__, "rest", "helpers.rb" +require "google/cloud/retail/v2/model_service/rest/helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/rest/client.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/rest/client.rb new file mode 100644 index 000000000000..9c772ac0f01c --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/rest/client.rb @@ -0,0 +1,1122 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/cloud/retail/v2/model_service_pb" +require "google/cloud/retail/v2/model_service/rest/service_stub" +require "google/cloud/location/rest" + +module Google + module Cloud + module Retail + module V2 + module ModelService + module Rest + ## + # REST client for the ModelService service. + # + # Service for performing CRUD operations on models. + # Recommendation models contain all the metadata necessary to generate a set of + # models for the `Predict()` API. A model is queried + # indirectly via a ServingConfig, which associates a model with a + # given Placement (e.g. Frequently Bought Together on Home Page). + # + # This service allows you to do the following: + # + # * Initiate training of a model. + # * Pause training of an existing model. + # * List all the available models along with their metadata. + # * Control their tuning schedule. + # + class Client + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" + + include Paths + + # @private + attr_reader :model_service_stub + + ## + # Configure the ModelService Client class. + # + # See {::Google::Cloud::Retail::V2::ModelService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all ModelService clients + # ::Google::Cloud::Retail::V2::ModelService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "Retail", "V2"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config.timeout = 60.0 + default_config.retry_policy = { + initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4] + } + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the ModelService Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Cloud::Retail::V2::ModelService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @model_service_stub.universe_domain + end + + ## + # Create a new ModelService REST client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::Retail::V2::ModelService::Rest::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::Retail::V2::ModelService::Rest::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the ModelService client. + # @yieldparam config [Client::Configuration] + # + def initialize + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @operations_client = ::Google::Cloud::Retail::V2::ModelService::Rest::Operations.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain + end + + @model_service_stub = ::Google::Cloud::Retail::V2::ModelService::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials, + logger: @config.logger + ) + + @model_service_stub.logger(stub: true)&.info do |entry| + entry.set_system_name + entry.set_service + entry.message = "Created client for #{entry.service}" + entry.set_credentials_fields credentials + entry.set "customEndpoint", @config.endpoint if @config.endpoint + entry.set "defaultTimeout", @config.timeout if @config.timeout + entry.set "quotaProject", @quota_project_id if @quota_project_id + end + + @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @model_service_stub.endpoint + config.universe_domain = @model_service_stub.universe_domain + config.logger = @model_service_stub.logger if config.respond_to? :logger= + end + end + + ## + # Get the associated client for long-running operations. + # + # @return [::Google::Cloud::Retail::V2::ModelService::Rest::Operations] + # + attr_reader :operations_client + + ## + # Get the associated client for mix-in of the Locations. + # + # @return [Google::Cloud::Location::Locations::Rest::Client] + # + attr_reader :location_client + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @model_service_stub.logger + end + + # Service calls + + ## + # Creates a new model. + # + # @overload create_model(request, options = nil) + # Pass arguments to `create_model` via a request object, either of type + # {::Google::Cloud::Retail::V2::CreateModelRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::CreateModelRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload create_model(parent: nil, model: nil, dry_run: nil) + # Pass arguments to `create_model` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. The parent resource under which to create the model. Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` + # @param model [::Google::Cloud::Retail::V2::Model, ::Hash] + # Required. The payload of the {::Google::Cloud::Retail::V2::Model Model} to + # create. + # @param dry_run [::Boolean] + # Optional. Whether to run a dry run to validate the request (without + # actually creating the model). + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ModelService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::CreateModelRequest.new + # + # # Call the create_model method. + # result = client.create_model request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def create_model request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::CreateModelRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.create_model.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.create_model.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.create_model.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @model_service_stub.create_model request, options do |result, operation| + result = ::Gapic::Operation.new result, @operations_client, options: options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets a model. + # + # @overload get_model(request, options = nil) + # Pass arguments to `get_model` via a request object, either of type + # {::Google::Cloud::Retail::V2::GetModelRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::GetModelRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload get_model(name: nil) + # Pass arguments to `get_model` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. The resource name of the {::Google::Cloud::Retail::V2::Model Model} to + # get. Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog}/models/{model_id}` + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::Model] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::Model] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ModelService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::GetModelRequest.new + # + # # Call the get_model method. + # result = client.get_model request + # + # # The returned object is of type Google::Cloud::Retail::V2::Model. + # p result + # + def get_model request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::GetModelRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.get_model.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.get_model.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.get_model.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @model_service_stub.get_model request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Pauses the training of an existing model. + # + # @overload pause_model(request, options = nil) + # Pass arguments to `pause_model` via a request object, either of type + # {::Google::Cloud::Retail::V2::PauseModelRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::PauseModelRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload pause_model(name: nil) + # Pass arguments to `pause_model` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. The name of the model to pause. + # Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::Model] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::Model] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ModelService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::PauseModelRequest.new + # + # # Call the pause_model method. + # result = client.pause_model request + # + # # The returned object is of type Google::Cloud::Retail::V2::Model. + # p result + # + def pause_model request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::PauseModelRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.pause_model.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.pause_model.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.pause_model.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @model_service_stub.pause_model request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Resumes the training of an existing model. + # + # @overload resume_model(request, options = nil) + # Pass arguments to `resume_model` via a request object, either of type + # {::Google::Cloud::Retail::V2::ResumeModelRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::ResumeModelRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload resume_model(name: nil) + # Pass arguments to `resume_model` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. The name of the model to resume. + # Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::Model] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::Model] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ModelService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::ResumeModelRequest.new + # + # # Call the resume_model method. + # result = client.resume_model request + # + # # The returned object is of type Google::Cloud::Retail::V2::Model. + # p result + # + def resume_model request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ResumeModelRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.resume_model.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.resume_model.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.resume_model.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @model_service_stub.resume_model request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Deletes an existing model. + # + # @overload delete_model(request, options = nil) + # Pass arguments to `delete_model` via a request object, either of type + # {::Google::Cloud::Retail::V2::DeleteModelRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::DeleteModelRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload delete_model(name: nil) + # Pass arguments to `delete_model` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. The resource name of the {::Google::Cloud::Retail::V2::Model Model} to + # delete. Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Protobuf::Empty] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Protobuf::Empty] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ModelService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::DeleteModelRequest.new + # + # # Call the delete_model method. + # result = client.delete_model request + # + # # The returned object is of type Google::Protobuf::Empty. + # p result + # + def delete_model request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::DeleteModelRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.delete_model.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.delete_model.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.delete_model.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @model_service_stub.delete_model request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists all the models linked to this event store. + # + # @overload list_models(request, options = nil) + # Pass arguments to `list_models` via a request object, either of type + # {::Google::Cloud::Retail::V2::ListModelsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::ListModelsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload list_models(parent: nil, page_size: nil, page_token: nil) + # Pass arguments to `list_models` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. The parent for which to list models. + # Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` + # @param page_size [::Integer] + # Optional. Maximum number of results to return. If unspecified, defaults + # to 50. Max allowed value is 1000. + # @param page_token [::String] + # Optional. A page token, received from a previous `ListModels` + # call. Provide this to retrieve the subsequent page. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Retail::V2::Model>] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Retail::V2::Model>] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ModelService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::ListModelsRequest.new + # + # # Call the list_models method. + # result = client.list_models request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Cloud::Retail::V2::Model. + # p item + # end + # + def list_models request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ListModelsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.list_models.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.list_models.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.list_models.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @model_service_stub.list_models request, options do |result, operation| + result = ::Gapic::Rest::PagedEnumerable.new @model_service_stub, :list_models, "models", request, result, options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Update of model metadata. Only fields that + # currently can be updated are: `filtering_option` and + # `periodic_tuning_state`. + # If other values are provided, this API method ignores them. + # + # @overload update_model(request, options = nil) + # Pass arguments to `update_model` via a request object, either of type + # {::Google::Cloud::Retail::V2::UpdateModelRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::UpdateModelRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload update_model(model: nil, update_mask: nil) + # Pass arguments to `update_model` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param model [::Google::Cloud::Retail::V2::Model, ::Hash] + # Required. The body of the updated {::Google::Cloud::Retail::V2::Model Model}. + # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] + # Optional. Indicates which fields in the provided 'model' to + # update. If not set, by default updates all fields. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::Model] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::Model] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ModelService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::UpdateModelRequest.new + # + # # Call the update_model method. + # result = client.update_model request + # + # # The returned object is of type Google::Cloud::Retail::V2::Model. + # p result + # + def update_model request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::UpdateModelRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.update_model.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.update_model.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.update_model.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @model_service_stub.update_model request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Tunes an existing model. + # + # @overload tune_model(request, options = nil) + # Pass arguments to `tune_model` via a request object, either of type + # {::Google::Cloud::Retail::V2::TuneModelRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::TuneModelRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload tune_model(name: nil) + # Pass arguments to `tune_model` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. The resource name of the model to tune. + # Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ModelService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::TuneModelRequest.new + # + # # Call the tune_model method. + # result = client.tune_model request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def tune_model request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::TuneModelRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.tune_model.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.tune_model.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.tune_model.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @model_service_stub.tune_model request, options do |result, operation| + result = ::Gapic::Operation.new result, @operations_client, options: options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the ModelService REST API. + # + # This class represents the configuration for ModelService REST, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::Retail::V2::ModelService::Rest::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # create_model to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Retail::V2::ModelService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.create_model.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Retail::V2::ModelService::Rest::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.create_model.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`String`) The path to a service account key file in JSON format + # * (`Hash`) A service account key as a Hash + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`nil`) indicating no credentials + # + # Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "retail.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration RPC class for the ModelService API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `create_model` + # @return [::Gapic::Config::Method] + # + attr_reader :create_model + ## + # RPC-specific configuration for `get_model` + # @return [::Gapic::Config::Method] + # + attr_reader :get_model + ## + # RPC-specific configuration for `pause_model` + # @return [::Gapic::Config::Method] + # + attr_reader :pause_model + ## + # RPC-specific configuration for `resume_model` + # @return [::Gapic::Config::Method] + # + attr_reader :resume_model + ## + # RPC-specific configuration for `delete_model` + # @return [::Gapic::Config::Method] + # + attr_reader :delete_model + ## + # RPC-specific configuration for `list_models` + # @return [::Gapic::Config::Method] + # + attr_reader :list_models + ## + # RPC-specific configuration for `update_model` + # @return [::Gapic::Config::Method] + # + attr_reader :update_model + ## + # RPC-specific configuration for `tune_model` + # @return [::Gapic::Config::Method] + # + attr_reader :tune_model + + # @private + def initialize parent_rpcs = nil + create_model_config = parent_rpcs.create_model if parent_rpcs.respond_to? :create_model + @create_model = ::Gapic::Config::Method.new create_model_config + get_model_config = parent_rpcs.get_model if parent_rpcs.respond_to? :get_model + @get_model = ::Gapic::Config::Method.new get_model_config + pause_model_config = parent_rpcs.pause_model if parent_rpcs.respond_to? :pause_model + @pause_model = ::Gapic::Config::Method.new pause_model_config + resume_model_config = parent_rpcs.resume_model if parent_rpcs.respond_to? :resume_model + @resume_model = ::Gapic::Config::Method.new resume_model_config + delete_model_config = parent_rpcs.delete_model if parent_rpcs.respond_to? :delete_model + @delete_model = ::Gapic::Config::Method.new delete_model_config + list_models_config = parent_rpcs.list_models if parent_rpcs.respond_to? :list_models + @list_models = ::Gapic::Config::Method.new list_models_config + update_model_config = parent_rpcs.update_model if parent_rpcs.respond_to? :update_model + @update_model = ::Gapic::Config::Method.new update_model_config + tune_model_config = parent_rpcs.tune_model if parent_rpcs.respond_to? :tune_model + @tune_model = ::Gapic::Config::Method.new tune_model_config + + yield self if block_given? + end + end + end + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/rest/operations.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/rest/operations.rb new file mode 100644 index 000000000000..ec084652ff45 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/rest/operations.rb @@ -0,0 +1,962 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/operation" + +module Google + module Cloud + module Retail + module V2 + module ModelService + module Rest + # Service that implements Longrunning Operations API. + class Operations + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" + + # @private + attr_reader :operations_stub + + ## + # Configuration for the ModelService Operations API. + # + # @yield [config] Configure the Operations client. + # @yieldparam config [Operations::Configuration] + # + # @return [Operations::Configuration] + # + def self.configure + @configure ||= Operations::Configuration.new + yield @configure if block_given? + @configure + end + + ## + # Configure the ModelService Operations instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Operations.configure}. + # + # @yield [config] Configure the Operations client. + # @yieldparam config [Operations::Configuration] + # + # @return [Operations::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @operations_stub.universe_domain + end + + ## + # Create a new Operations client object. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Operations::Configuration] + # + def initialize + # Create the configuration object + @config = Configuration.new Operations.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + credentials ||= Credentials.default scope: @config.scope + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @operations_stub = OperationsServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials + ) + + # Used by an LRO wrapper for some methods of this service + @operations_client = self + end + + # Service calls + + ## + # Lists operations that match the specified filter in the request. If the + # server doesn't support this method, it returns `UNIMPLEMENTED`. + # + # @overload list_operations(request, options = nil) + # Pass arguments to `list_operations` via a request object, either of type + # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::ListOperationsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload list_operations(name: nil, filter: nil, page_size: nil, page_token: nil, return_partial_success: nil) + # Pass arguments to `list_operations` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation's parent resource. + # @param filter [::String] + # The standard list filter. + # @param page_size [::Integer] + # The standard list page size. + # @param page_token [::String] + # The standard list page token. + # @param return_partial_success [::Boolean] + # When set to `true`, operations that are reachable are returned as normal, + # and those that are unreachable are returned in the + # [ListOperationsResponse.unreachable] field. + # + # This can only be `true` when reading across collections e.g. when `parent` + # is set to `"projects/example/locations/-"`. + # + # This field is not by default supported and will result in an + # `UNIMPLEMENTED` error if set unless explicitly documented otherwise in + # service or product specific documentation. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::ListOperationsRequest.new + # + # # Call the list_operations method. + # result = client.list_operations request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Longrunning::Operation. + # p item + # end + # + def list_operations request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::ListOperationsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.list_operations.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.list_operations.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.list_operations.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.list_operations request, options do |result, operation| + result = ::Gapic::Rest::PagedEnumerable.new @operations_stub, :list_operations, "operations", request, result, options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets the latest state of a long-running operation. Clients can use this + # method to poll the operation result at intervals as recommended by the API + # service. + # + # @overload get_operation(request, options = nil) + # Pass arguments to `get_operation` via a request object, either of type + # {::Google::Longrunning::GetOperationRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::GetOperationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload get_operation(name: nil) + # Pass arguments to `get_operation` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation resource. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::GetOperationRequest.new + # + # # Call the get_operation method. + # result = client.get_operation request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def get_operation request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::GetOperationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.get_operation.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.get_operation.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.get_operation.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.get_operation request, options do |result, operation| + result = ::Gapic::Operation.new result, @operations_client, options: options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Deletes a long-running operation. This method indicates that the client is + # no longer interested in the operation result. It does not cancel the + # operation. If the server doesn't support this method, it returns + # `google.rpc.Code.UNIMPLEMENTED`. + # + # @overload delete_operation(request, options = nil) + # Pass arguments to `delete_operation` via a request object, either of type + # {::Google::Longrunning::DeleteOperationRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::DeleteOperationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload delete_operation(name: nil) + # Pass arguments to `delete_operation` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation resource to be deleted. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Protobuf::Empty] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Protobuf::Empty] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::DeleteOperationRequest.new + # + # # Call the delete_operation method. + # result = client.delete_operation request + # + # # The returned object is of type Google::Protobuf::Empty. + # p result + # + def delete_operation request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::DeleteOperationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.delete_operation.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.delete_operation.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.delete_operation.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.delete_operation request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Starts asynchronous cancellation on a long-running operation. The server + # makes a best effort to cancel the operation, but success is not + # guaranteed. If the server doesn't support this method, it returns + # `google.rpc.Code.UNIMPLEMENTED`. Clients can use + # Operations.GetOperation or + # other methods to check whether the cancellation succeeded or whether the + # operation completed despite cancellation. On successful cancellation, + # the operation is not deleted; instead, it becomes an operation with + # an {::Google::Longrunning::Operation#error Operation.error} value with a + # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to + # `Code.CANCELLED`. + # + # @overload cancel_operation(request, options = nil) + # Pass arguments to `cancel_operation` via a request object, either of type + # {::Google::Longrunning::CancelOperationRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::CancelOperationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload cancel_operation(name: nil) + # Pass arguments to `cancel_operation` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation resource to be cancelled. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Protobuf::Empty] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Protobuf::Empty] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::CancelOperationRequest.new + # + # # Call the cancel_operation method. + # result = client.cancel_operation request + # + # # The returned object is of type Google::Protobuf::Empty. + # p result + # + def cancel_operation request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::CancelOperationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.cancel_operation.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.cancel_operation.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.cancel_operation.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.cancel_operation request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the Operations REST API. + # + # This class represents the configuration for Operations REST, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Longrunning::Operations::Rest::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # list_operations to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Longrunning::Operations::Rest::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.list_operations.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Longrunning::Operations::Rest::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.list_operations.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`String`) The path to a service account key file in JSON format + # * (`Hash`) A service account key as a Hash + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`nil`) indicating no credentials + # + # Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "retail.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration RPC class for the Operations API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `list_operations` + # @return [::Gapic::Config::Method] + # + attr_reader :list_operations + ## + # RPC-specific configuration for `get_operation` + # @return [::Gapic::Config::Method] + # + attr_reader :get_operation + ## + # RPC-specific configuration for `delete_operation` + # @return [::Gapic::Config::Method] + # + attr_reader :delete_operation + ## + # RPC-specific configuration for `cancel_operation` + # @return [::Gapic::Config::Method] + # + attr_reader :cancel_operation + + # @private + def initialize parent_rpcs = nil + list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations + @list_operations = ::Gapic::Config::Method.new list_operations_config + get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation + @get_operation = ::Gapic::Config::Method.new get_operation_config + delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation + @delete_operation = ::Gapic::Config::Method.new delete_operation_config + cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation + @cancel_operation = ::Gapic::Config::Method.new cancel_operation_config + + yield self if block_given? + end + end + end + end + + ## + # @private + # REST service stub for the Longrunning Operations API. + # Service stub contains baseline method implementations + # including transcoding, making the REST call, and deserialing the response. + class OperationsServiceStub + def initialize endpoint:, endpoint_template:, universe_domain:, credentials: + # These require statements are intentionally placed here to initialize + # the REST modules only when it's required. + require "gapic/rest" + + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials + end + + ## + # Baseline implementation for the list_operations REST call + # + # @param request_pb [::Google::Longrunning::ListOperationsRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::ListOperationsResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::ListOperationsResponse] + # A result object deserialized from the server's reply + def list_operations request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = OperationsServiceStub.transcode_list_operations_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "list_operations", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::ListOperationsResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the get_operation REST call + # + # @param request_pb [::Google::Longrunning::GetOperationRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::Operation] + # A result object deserialized from the server's reply + def get_operation request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = OperationsServiceStub.transcode_get_operation_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "get_operation", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the delete_operation REST call + # + # @param request_pb [::Google::Longrunning::DeleteOperationRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Protobuf::Empty] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Protobuf::Empty] + # A result object deserialized from the server's reply + def delete_operation request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = OperationsServiceStub.transcode_delete_operation_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "delete_operation", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the cancel_operation REST call + # + # @param request_pb [::Google::Longrunning::CancelOperationRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Protobuf::Empty] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Protobuf::Empty] + # A result object deserialized from the server's reply + def cancel_operation request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = OperationsServiceStub.transcode_cancel_operation_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "cancel_operation", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # @private + # + # GRPC transcoding helper method for the list_operations REST call + # + # @param request_pb [::Google::Longrunning::ListOperationsRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_list_operations_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v2/{name}/operations", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/?$}, false] + ] + ) + .with_bindings( + uri_method: :get, + uri_template: "/v2/{name}/operations", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] + ] + ) + .with_bindings( + uri_method: :get, + uri_template: "/v2/{name}/operations", + matches: [ + ["name", %r{^projects/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the get_operation REST call + # + # @param request_pb [::Google::Longrunning::GetOperationRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_get_operation_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v2/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/operations/[^/]+/?$}, false] + ] + ) + .with_bindings( + uri_method: :get, + uri_template: "/v2/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/branches/[^/]+/operations/[^/]+/?$}, false] + ] + ) + .with_bindings( + uri_method: :get, + uri_template: "/v2/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/operations/[^/]+/?$}, false] + ] + ) + .with_bindings( + uri_method: :get, + uri_template: "/v2/{name}", + matches: [ + ["name", %r{^projects/[^/]+/operations/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the delete_operation REST call + # + # @param request_pb [::Google::Longrunning::DeleteOperationRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_delete_operation_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :delete, + uri_template: "/v1/{name}", + matches: [ + ["name", %r{^operations(?:/(?<__wildcard__>.*))?$}, true] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the cancel_operation REST call + # + # @param request_pb [::Google::Longrunning::CancelOperationRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_cancel_operation_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/{name}:cancel", + body: "*", + matches: [ + ["name", %r{^operations(?:/(?<__wildcard__>.*))?$}, true] + ] + ) + transcoder.transcode request_pb + end + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/rest/service_stub.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/rest/service_stub.rb new file mode 100644 index 000000000000..fec1a150075d --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/rest/service_stub.rb @@ -0,0 +1,574 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/retail/v2/model_service_pb" + +module Google + module Cloud + module Retail + module V2 + module ModelService + module Rest + ## + # REST service stub for the ModelService service. + # Service stub contains baseline method implementations + # including transcoding, making the REST call, and deserialing the response. + # + class ServiceStub + # @private + def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger: + # These require statements are intentionally placed here to initialize + # the REST modules only when it's required. + require "gapic/rest" + + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials, + numeric_enums: true, + service_name: self.class, + raise_faraday_errors: false, + logger: logger + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @client_stub.universe_domain + end + + ## + # The effective endpoint + # + # @return [String] + # + def endpoint + @client_stub.endpoint + end + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger stub: false + stub ? @client_stub.stub_logger : @client_stub.logger + end + + ## + # Baseline implementation for the create_model REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::CreateModelRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::Operation] + # A result object deserialized from the server's reply + def create_model request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_create_model_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "create_model", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the get_model REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::GetModelRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::Model] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::Model] + # A result object deserialized from the server's reply + def get_model request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_get_model_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "get_model", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Retail::V2::Model.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the pause_model REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::PauseModelRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::Model] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::Model] + # A result object deserialized from the server's reply + def pause_model request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_pause_model_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "pause_model", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Retail::V2::Model.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the resume_model REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::ResumeModelRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::Model] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::Model] + # A result object deserialized from the server's reply + def resume_model request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_resume_model_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "resume_model", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Retail::V2::Model.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the delete_model REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::DeleteModelRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Protobuf::Empty] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Protobuf::Empty] + # A result object deserialized from the server's reply + def delete_model request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_delete_model_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "delete_model", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the list_models REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::ListModelsRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::ListModelsResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::ListModelsResponse] + # A result object deserialized from the server's reply + def list_models request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_list_models_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "list_models", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Retail::V2::ListModelsResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the update_model REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::UpdateModelRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::Model] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::Model] + # A result object deserialized from the server's reply + def update_model request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_update_model_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "update_model", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Retail::V2::Model.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the tune_model REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::TuneModelRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::Operation] + # A result object deserialized from the server's reply + def tune_model request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_tune_model_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "tune_model", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # @private + # + # GRPC transcoding helper method for the create_model REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::CreateModelRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_create_model_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v2/{parent}/models", + body: "model", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the get_model REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::GetModelRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_get_model_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v2/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/models/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the pause_model REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::PauseModelRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_pause_model_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v2/{name}:pause", + body: "*", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/models/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the resume_model REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::ResumeModelRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_resume_model_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v2/{name}:resume", + body: "*", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/models/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the delete_model REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::DeleteModelRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_delete_model_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :delete, + uri_template: "/v2/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/models/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the list_models REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::ListModelsRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_list_models_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v2/{parent}/models", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the update_model REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::UpdateModelRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_update_model_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :patch, + uri_template: "/v2/{model.name}", + body: "model", + matches: [ + ["model.name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/models/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the tune_model REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::TuneModelRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_tune_model_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v2/{name}:tune", + body: "*", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/models/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service_pb.rb new file mode 100644 index 000000000000..5b5f20690bb3 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service_pb.rb @@ -0,0 +1,41 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/retail/v2/model_service.proto + +require 'google/protobuf' + +require 'google/api/annotations_pb' +require 'google/api/client_pb' +require 'google/api/field_behavior_pb' +require 'google/api/resource_pb' +require 'google/cloud/retail/v2/model_pb' +require 'google/longrunning/operations_pb' +require 'google/protobuf/empty_pb' +require 'google/protobuf/field_mask_pb' + + +descriptor_data = "\n*google/cloud/retail/v2/model_service.proto\x12\x16google.cloud.retail.v2\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\"google/cloud/retail/v2/model.proto\x1a#google/longrunning/operations.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\"\x94\x01\n\x12\x43reateModelRequest\x12\x35\n\x06parent\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\n\x1dretail.googleapis.com/Catalog\x12\x31\n\x05model\x18\x02 \x01(\x0b\x32\x1d.google.cloud.retail.v2.ModelB\x03\xe0\x41\x02\x12\x14\n\x07\x64ry_run\x18\x03 \x01(\x08\x42\x03\xe0\x41\x01\"}\n\x12UpdateModelRequest\x12\x31\n\x05model\x18\x01 \x01(\x0b\x32\x1d.google.cloud.retail.v2.ModelB\x03\xe0\x41\x02\x12\x34\n\x0bupdate_mask\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMaskB\x03\xe0\x41\x01\"D\n\x0fGetModelRequest\x12\x31\n\x04name\x18\x01 \x01(\tB#\xe0\x41\x02\xfa\x41\x1d\n\x1bretail.googleapis.com/Model\"F\n\x11PauseModelRequest\x12\x31\n\x04name\x18\x01 \x01(\tB#\xe0\x41\x02\xfa\x41\x1d\n\x1bretail.googleapis.com/Model\"\'\n\x12ResumeModelRequest\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x02\"{\n\x11ListModelsRequest\x12\x35\n\x06parent\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\n\x1dretail.googleapis.com/Catalog\x12\x16\n\tpage_size\x18\x02 \x01(\x05\x42\x03\xe0\x41\x01\x12\x17\n\npage_token\x18\x03 \x01(\tB\x03\xe0\x41\x01\"G\n\x12\x44\x65leteModelRequest\x12\x31\n\x04name\x18\x01 \x01(\tB#\xe0\x41\x02\xfa\x41\x1d\n\x1bretail.googleapis.com/Model\"\\\n\x12ListModelsResponse\x12-\n\x06models\x18\x01 \x03(\x0b\x32\x1d.google.cloud.retail.v2.Model\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t\"E\n\x10TuneModelRequest\x12\x31\n\x04name\x18\x01 \x01(\tB#\xe0\x41\x02\xfa\x41\x1d\n\x1bretail.googleapis.com/Model\"$\n\x13\x43reateModelMetadata\x12\r\n\x05model\x18\x01 \x01(\t\"\"\n\x11TuneModelMetadata\x12\r\n\x05model\x18\x01 \x01(\t\"\x13\n\x11TuneModelResponse2\xc5\x0c\n\x0cModelService\x12\xfb\x01\n\x0b\x43reateModel\x12*.google.cloud.retail.v2.CreateModelRequest\x1a\x1d.google.longrunning.Operation\"\xa0\x01\xca\x41J\n\x1cgoogle.cloud.retail.v2.Model\x12*google.cloud.retail.v2.CreateModelMetadata\xda\x41\x0cparent,model\x82\xd3\xe4\x93\x02>\"5/v2/{parent=projects/*/locations/*/catalogs/*}/models:\x05model\x12\x98\x01\n\x08GetModel\x12\'.google.cloud.retail.v2.GetModelRequest\x1a\x1d.google.cloud.retail.v2.Model\"D\xda\x41\x04name\x82\xd3\xe4\x93\x02\x37\x12\x35/v2/{name=projects/*/locations/*/catalogs/*/models/*}\x12\xa5\x01\n\nPauseModel\x12).google.cloud.retail.v2.PauseModelRequest\x1a\x1d.google.cloud.retail.v2.Model\"M\xda\x41\x04name\x82\xd3\xe4\x93\x02@\";/v2/{name=projects/*/locations/*/catalogs/*/models/*}:pause:\x01*\x12\xa8\x01\n\x0bResumeModel\x12*.google.cloud.retail.v2.ResumeModelRequest\x1a\x1d.google.cloud.retail.v2.Model\"N\xda\x41\x04name\x82\xd3\xe4\x93\x02\x41\" ::Google::Protobuf::Value, ::Hash}] + # Additional domain specific parameters for the predictions. + # + # Allowed values: + # + # * `returnProduct`: Boolean. If set to true, the associated product + # object will be returned in the `results.metadata` field in the + # prediction response. + # * `returnScore`: Boolean. If set to true, the prediction 'score' + # corresponding to each returned product will be set in the + # `results.metadata` field in the prediction response. The given + # 'score' indicates the probability of a product being clicked/purchased + # given the user's context and history. + # * `strictFiltering`: Boolean. True by default. If set to false, the service + # will return generic (unfiltered) popular products instead of empty if + # your filter blocks all prediction results. + # * `priceRerankLevel`: String. Default empty. If set to be non-empty, then + # it needs to be one of {'no-price-reranking', 'low-price-reranking', + # 'medium-price-reranking', 'high-price-reranking'}. This gives + # request-level control and adjusts prediction results based on product + # price. + # * `diversityLevel`: String. Default empty. If set to be non-empty, then + # it needs to be one of {'no-diversity', 'low-diversity', + # 'medium-diversity', 'high-diversity', 'auto-diversity'}. This gives + # request-level control and adjusts prediction results based on product + # category. + # * `filterSyntaxV2`: Boolean. False by default. If set to true, the `filter` + # field is interpreteted according to the new, attribute-based syntax. + # @param labels [::Hash{::String => ::String}] + # The labels applied to a resource must meet the following requirements: + # + # * Each resource can have multiple labels, up to a maximum of 64. + # * Each label must be a key-value pair. + # * Keys have a minimum length of 1 character and a maximum length of 63 + # characters and cannot be empty. Values can be empty and have a maximum + # length of 63 characters. + # * Keys and values can contain only lowercase letters, numeric characters, + # underscores, and dashes. All characters must use UTF-8 encoding, and + # international characters are allowed. + # * The key portion of a label must be unique. However, you can use the same + # key with multiple resources. + # * Keys must start with a lowercase letter or international character. + # + # See [Google Cloud + # Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + # for more details. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Retail::V2::PredictResponse] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Retail::V2::PredictResponse] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::PredictionService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::PredictRequest.new + # + # # Call the predict method. + # result = client.predict request + # + # # The returned object is of type Google::Cloud::Retail::V2::PredictResponse. + # p result + # + def predict request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::PredictRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.predict.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.placement + header_params["placement"] = request.placement + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.predict.timeout, + metadata: metadata, + retry_policy: @config.rpcs.predict.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @prediction_service_stub.call_rpc :predict, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the PredictionService API. + # + # This class represents the configuration for PredictionService, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::Retail::V2::PredictionService::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # predict to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Retail::V2::PredictionService::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.predict.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Retail::V2::PredictionService::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.predict.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`GRPC::Core::Channel`) a gRPC channel with included credentials + # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object + # * (`nil`) indicating no credentials + # + # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials + # is deprecated. Providing an unvalidated credential configuration to + # Google APIs can compromise the security of your systems and data. + # + # @example + # + # # The recommended way to provide credentials is to use the `make_creds` method + # # on the appropriate credentials class for your environment. + # + # require "googleauth" + # + # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds( + # json_key_io: ::File.open("/path/to/keyfile.json") + # ) + # + # client = ::Google::Cloud::Retail::V2::PredictionService::Client.new do |config| + # config.credentials = credentials + # end + # + # @note Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] channel_args + # Extra parameters passed to the gRPC channel. Note: this is ignored if a + # `GRPC::Core::Channel` object is provided as the credential. + # @return [::Hash] + # @!attribute [rw] interceptors + # An array of interceptors that are run before calls are executed. + # @return [::Array<::GRPC::ClientInterceptor>] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional gRPC headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "retail.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) + config_attr :interceptors, nil, ::Array, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration for the channel pool + # @return [::Gapic::ServiceStub::ChannelPool::Configuration] + # + def channel_pool + @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new + end + + ## + # Configuration RPC class for the PredictionService API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `predict` + # @return [::Gapic::Config::Method] + # + attr_reader :predict + + # @private + def initialize parent_rpcs = nil + predict_config = parent_rpcs.predict if parent_rpcs.respond_to? :predict + @predict = ::Gapic::Config::Method.new predict_config + + yield self if block_given? + end + end + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/credentials.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/credentials.rb new file mode 100644 index 000000000000..1da276c819f4 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/credentials.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "googleauth" + +module Google + module Cloud + module Retail + module V2 + module PredictionService + # Credentials for the PredictionService API. + class Credentials < ::Google::Auth::Credentials + self.scope = [ + "https://www.googleapis.com/auth/cloud-platform" + ] + self.env_vars = [ + "RETAIL_CREDENTIALS", + "RETAIL_KEYFILE", + "GOOGLE_CLOUD_CREDENTIALS", + "GOOGLE_CLOUD_KEYFILE", + "GCLOUD_KEYFILE", + "RETAIL_CREDENTIALS_JSON", + "RETAIL_KEYFILE_JSON", + "GOOGLE_CLOUD_CREDENTIALS_JSON", + "GOOGLE_CLOUD_KEYFILE_JSON", + "GCLOUD_KEYFILE_JSON" + ] + self.paths = [ + "~/.config/google_cloud/application_default_credentials.json" + ] + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/paths.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/paths.rb new file mode 100644 index 000000000000..26277b36936a --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/paths.rb @@ -0,0 +1,56 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Retail + module V2 + module PredictionService + # Path helper methods for the PredictionService API. + module Paths + ## + # Create a fully-qualified Product resource string. + # + # The resource will be in the following format: + # + # `projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}` + # + # @param project [String] + # @param location [String] + # @param catalog [String] + # @param branch [String] + # @param product [String] + # + # @return [::String] + def product_path project:, location:, catalog:, branch:, product: + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" + raise ::ArgumentError, "catalog cannot contain /" if catalog.to_s.include? "/" + raise ::ArgumentError, "branch cannot contain /" if branch.to_s.include? "/" + + "projects/#{project}/locations/#{location}/catalogs/#{catalog}/branches/#{branch}/products/#{product}" + end + + extend self + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/rest.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/rest.rb new file mode 100644 index 000000000000..351e68db6577 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/rest.rb @@ -0,0 +1,52 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/rest" +require "gapic/config" +require "gapic/config/method" + +require "google/cloud/retail/v2/version" + +require "google/cloud/retail/v2/prediction_service/credentials" +require "google/cloud/retail/v2/prediction_service/paths" +require "google/cloud/retail/v2/prediction_service/rest/client" + +module Google + module Cloud + module Retail + module V2 + ## + # Service for making recommendation prediction. + # + # To load this service and instantiate a REST client: + # + # require "google/cloud/retail/v2/prediction_service/rest" + # client = ::Google::Cloud::Retail::V2::PredictionService::Rest::Client.new + # + module PredictionService + # Client for the REST transport + module Rest + end + end + end + end + end +end + +helper_path = ::File.join __dir__, "rest", "helpers.rb" +require "google/cloud/retail/v2/prediction_service/rest/helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/rest/client.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/rest/client.rb new file mode 100644 index 000000000000..58169840c4a5 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/rest/client.rb @@ -0,0 +1,573 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/cloud/retail/v2/prediction_service_pb" +require "google/cloud/retail/v2/prediction_service/rest/service_stub" +require "google/cloud/location/rest" + +module Google + module Cloud + module Retail + module V2 + module PredictionService + module Rest + ## + # REST client for the PredictionService service. + # + # Service for making recommendation prediction. + # + class Client + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" + + include Paths + + # @private + attr_reader :prediction_service_stub + + ## + # Configure the PredictionService Client class. + # + # See {::Google::Cloud::Retail::V2::PredictionService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all PredictionService clients + # ::Google::Cloud::Retail::V2::PredictionService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "Retail", "V2"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config.timeout = 5.0 + default_config.retry_policy = { + initial_delay: 0.1, max_delay: 5.0, multiplier: 1.3, retry_codes: [14, 4] + } + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the PredictionService Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Cloud::Retail::V2::PredictionService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @prediction_service_stub.universe_domain + end + + ## + # Create a new PredictionService REST client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::Retail::V2::PredictionService::Rest::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::Retail::V2::PredictionService::Rest::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the PredictionService client. + # @yieldparam config [Client::Configuration] + # + def initialize + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @prediction_service_stub = ::Google::Cloud::Retail::V2::PredictionService::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials, + logger: @config.logger + ) + + @prediction_service_stub.logger(stub: true)&.info do |entry| + entry.set_system_name + entry.set_service + entry.message = "Created client for #{entry.service}" + entry.set_credentials_fields credentials + entry.set "customEndpoint", @config.endpoint if @config.endpoint + entry.set "defaultTimeout", @config.timeout if @config.timeout + entry.set "quotaProject", @quota_project_id if @quota_project_id + end + + @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @prediction_service_stub.endpoint + config.universe_domain = @prediction_service_stub.universe_domain + config.logger = @prediction_service_stub.logger if config.respond_to? :logger= + end + end + + ## + # Get the associated client for mix-in of the Locations. + # + # @return [Google::Cloud::Location::Locations::Rest::Client] + # + attr_reader :location_client + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @prediction_service_stub.logger + end + + # Service calls + + ## + # Makes a recommendation prediction. + # + # @overload predict(request, options = nil) + # Pass arguments to `predict` via a request object, either of type + # {::Google::Cloud::Retail::V2::PredictRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::PredictRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload predict(placement: nil, user_event: nil, page_size: nil, page_token: nil, filter: nil, validate_only: nil, params: nil, labels: nil) + # Pass arguments to `predict` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param placement [::String] + # Required. Full resource name of the format: + # `{placement=projects/*/locations/global/catalogs/default_catalog/servingConfigs/*}` + # or + # `{placement=projects/*/locations/global/catalogs/default_catalog/placements/*}`. + # We recommend using the `servingConfigs` resource. `placements` is a legacy + # resource. + # The ID of the Recommendations AI serving config or placement. + # Before you can request predictions from your model, you must create at + # least one serving config or placement for it. For more information, see + # [Manage serving configs] + # (https://cloud.google.com/retail/docs/manage-configs). + # + # The full list of available serving configs can be seen at + # https://console.cloud.google.com/ai/retail/catalogs/default_catalog/configs + # @param user_event [::Google::Cloud::Retail::V2::UserEvent, ::Hash] + # Required. Context about the user, what they are looking at and what action + # they took to trigger the predict request. Note that this user event detail + # won't be ingested to userEvent logs. Thus, a separate userEvent write + # request is required for event logging. + # + # Don't set + # {::Google::Cloud::Retail::V2::UserEvent#visitor_id UserEvent.visitor_id} or + # {::Google::Cloud::Retail::V2::UserInfo#user_id UserInfo.user_id} to the same + # fixed ID for different users. If you are trying to receive non-personalized + # recommendations (not recommended; this can negatively impact model + # performance), instead set + # {::Google::Cloud::Retail::V2::UserEvent#visitor_id UserEvent.visitor_id} to a + # random unique ID and leave + # {::Google::Cloud::Retail::V2::UserInfo#user_id UserInfo.user_id} unset. + # @param page_size [::Integer] + # Maximum number of results to return. Set this property to the number of + # prediction results needed. If zero, the service will choose a reasonable + # default. The maximum allowed value is 100. Values above 100 will be coerced + # to 100. + # @param page_token [::String] + # This field is not used; leave it unset. + # @param filter [::String] + # Filter for restricting prediction results with a length limit of 5,000 + # characters. Accepts values for tags and the `filterOutOfStockItems` flag. + # + # * Tag expressions. Restricts predictions to products that match all of the + # specified tags. Boolean operators `OR` and `NOT` are supported if the + # expression is enclosed in parentheses, and must be separated from the + # tag values by a space. `-"tagA"` is also supported and is equivalent to + # `NOT "tagA"`. Tag values must be double quoted UTF-8 encoded strings + # with a size limit of 1,000 characters. + # + # Note: "Recently viewed" models don't support tag filtering at the + # moment. + # + # * filterOutOfStockItems. Restricts predictions to products that do not + # have a + # stockState value of OUT_OF_STOCK. + # + # Examples: + # + # * tag=("Red" OR "Blue") tag="New-Arrival" tag=(NOT "promotional") + # * filterOutOfStockItems tag=(-"promotional") + # * filterOutOfStockItems + # + # If your filter blocks all prediction results, the API will return *no* + # results. If instead you want empty result sets to return generic + # (unfiltered) popular products, set `strictFiltering` to False in + # `PredictRequest.params`. Note that the API will never return items with + # storageStatus of "EXPIRED" or "DELETED" regardless of filter choices. + # + # If `filterSyntaxV2` is set to true under the `params` field, then + # attribute-based expressions are expected instead of the above described + # tag-based syntax. Examples: + # + # * (colors: ANY("Red", "Blue")) AND NOT (categories: ANY("Phones")) + # * (availability: ANY("IN_STOCK")) AND + # (colors: ANY("Red") OR categories: ANY("Phones")) + # + # For more information, see + # [Filter recommendations](https://cloud.google.com/retail/docs/filter-recs). + # @param validate_only [::Boolean] + # Use validate only mode for this prediction query. If set to true, a + # dummy model will be used that returns arbitrary products. + # Note that the validate only mode should only be used for testing the API, + # or if the model is not ready. + # @param params [::Hash{::String => ::Google::Protobuf::Value, ::Hash}] + # Additional domain specific parameters for the predictions. + # + # Allowed values: + # + # * `returnProduct`: Boolean. If set to true, the associated product + # object will be returned in the `results.metadata` field in the + # prediction response. + # * `returnScore`: Boolean. If set to true, the prediction 'score' + # corresponding to each returned product will be set in the + # `results.metadata` field in the prediction response. The given + # 'score' indicates the probability of a product being clicked/purchased + # given the user's context and history. + # * `strictFiltering`: Boolean. True by default. If set to false, the service + # will return generic (unfiltered) popular products instead of empty if + # your filter blocks all prediction results. + # * `priceRerankLevel`: String. Default empty. If set to be non-empty, then + # it needs to be one of {'no-price-reranking', 'low-price-reranking', + # 'medium-price-reranking', 'high-price-reranking'}. This gives + # request-level control and adjusts prediction results based on product + # price. + # * `diversityLevel`: String. Default empty. If set to be non-empty, then + # it needs to be one of {'no-diversity', 'low-diversity', + # 'medium-diversity', 'high-diversity', 'auto-diversity'}. This gives + # request-level control and adjusts prediction results based on product + # category. + # * `filterSyntaxV2`: Boolean. False by default. If set to true, the `filter` + # field is interpreteted according to the new, attribute-based syntax. + # @param labels [::Hash{::String => ::String}] + # The labels applied to a resource must meet the following requirements: + # + # * Each resource can have multiple labels, up to a maximum of 64. + # * Each label must be a key-value pair. + # * Keys have a minimum length of 1 character and a maximum length of 63 + # characters and cannot be empty. Values can be empty and have a maximum + # length of 63 characters. + # * Keys and values can contain only lowercase letters, numeric characters, + # underscores, and dashes. All characters must use UTF-8 encoding, and + # international characters are allowed. + # * The key portion of a label must be unique. However, you can use the same + # key with multiple resources. + # * Keys must start with a lowercase letter or international character. + # + # See [Google Cloud + # Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + # for more details. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::PredictResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::PredictResponse] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::PredictionService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::PredictRequest.new + # + # # Call the predict method. + # result = client.predict request + # + # # The returned object is of type Google::Cloud::Retail::V2::PredictResponse. + # p result + # + def predict request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::PredictRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.predict.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.predict.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.predict.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @prediction_service_stub.predict request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the PredictionService REST API. + # + # This class represents the configuration for PredictionService REST, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::Retail::V2::PredictionService::Rest::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # predict to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Retail::V2::PredictionService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.predict.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Retail::V2::PredictionService::Rest::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.predict.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`String`) The path to a service account key file in JSON format + # * (`Hash`) A service account key as a Hash + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`nil`) indicating no credentials + # + # Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "retail.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration RPC class for the PredictionService API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `predict` + # @return [::Gapic::Config::Method] + # + attr_reader :predict + + # @private + def initialize parent_rpcs = nil + predict_config = parent_rpcs.predict if parent_rpcs.respond_to? :predict + @predict = ::Gapic::Config::Method.new predict_config + + yield self if block_given? + end + end + end + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/rest/service_stub.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/rest/service_stub.rb new file mode 100644 index 000000000000..4717b50f2d91 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/rest/service_stub.rb @@ -0,0 +1,151 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/retail/v2/prediction_service_pb" + +module Google + module Cloud + module Retail + module V2 + module PredictionService + module Rest + ## + # REST service stub for the PredictionService service. + # Service stub contains baseline method implementations + # including transcoding, making the REST call, and deserialing the response. + # + class ServiceStub + # @private + def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger: + # These require statements are intentionally placed here to initialize + # the REST modules only when it's required. + require "gapic/rest" + + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials, + numeric_enums: true, + service_name: self.class, + raise_faraday_errors: false, + logger: logger + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @client_stub.universe_domain + end + + ## + # The effective endpoint + # + # @return [String] + # + def endpoint + @client_stub.endpoint + end + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger stub: false + stub ? @client_stub.stub_logger : @client_stub.logger + end + + ## + # Baseline implementation for the predict REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::PredictRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::PredictResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::PredictResponse] + # A result object deserialized from the server's reply + def predict request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_predict_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "predict", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Retail::V2::PredictResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # @private + # + # GRPC transcoding helper method for the predict REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::PredictRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_predict_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v2/{placement}:predict", + body: "*", + matches: [ + ["placement", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/placements/[^/]+/?$}, false] + ] + ) + .with_bindings( + uri_method: :post, + uri_template: "/v2/{placement}:predict", + body: "*", + matches: [ + ["placement", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/servingConfigs/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service_pb.rb new file mode 100644 index 000000000000..5953dae20b84 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service_pb.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/retail/v2/prediction_service.proto + +require 'google/protobuf' + +require 'google/api/annotations_pb' +require 'google/api/client_pb' +require 'google/api/field_behavior_pb' +require 'google/api/resource_pb' +require 'google/cloud/retail/v2/user_event_pb' +require 'google/protobuf/struct_pb' + + +descriptor_data = "\n/google/cloud/retail/v2/prediction_service.proto\x12\x16google.cloud.retail.v2\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\'google/cloud/retail/v2/user_event.proto\x1a\x1cgoogle/protobuf/struct.proto\"\xb4\x03\n\x0ePredictRequest\x12\x16\n\tplacement\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12:\n\nuser_event\x18\x02 \x01(\x0b\x32!.google.cloud.retail.v2.UserEventB\x03\xe0\x41\x02\x12\x11\n\tpage_size\x18\x03 \x01(\x05\x12\x16\n\npage_token\x18\x04 \x01(\tB\x02\x18\x01\x12\x0e\n\x06\x66ilter\x18\x05 \x01(\t\x12\x15\n\rvalidate_only\x18\x06 \x01(\x08\x12\x42\n\x06params\x18\x07 \x03(\x0b\x32\x32.google.cloud.retail.v2.PredictRequest.ParamsEntry\x12\x42\n\x06labels\x18\x08 \x03(\x0b\x32\x32.google.cloud.retail.v2.PredictRequest.LabelsEntry\x1a\x45\n\x0bParamsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12%\n\x05value\x18\x02 \x01(\x0b\x32\x16.google.protobuf.Value:\x02\x38\x01\x1a-\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"\xe7\x02\n\x0fPredictResponse\x12I\n\x07results\x18\x01 \x03(\x0b\x32\x38.google.cloud.retail.v2.PredictResponse.PredictionResult\x12\x19\n\x11\x61ttribution_token\x18\x02 \x01(\t\x12\x13\n\x0bmissing_ids\x18\x03 \x03(\t\x12\x15\n\rvalidate_only\x18\x04 \x01(\x08\x1a\xc1\x01\n\x10PredictionResult\x12\n\n\x02id\x18\x01 \x01(\t\x12X\n\x08metadata\x18\x02 \x03(\x0b\x32\x46.google.cloud.retail.v2.PredictResponse.PredictionResult.MetadataEntry\x1aG\n\rMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12%\n\x05value\x18\x02 \x01(\x0b\x32\x16.google.protobuf.Value:\x02\x38\x01\x32\xe1\x02\n\x11PredictionService\x12\x80\x02\n\x07Predict\x12&.google.cloud.retail.v2.PredictRequest\x1a\'.google.cloud.retail.v2.PredictResponse\"\xa3\x01\x82\xd3\xe4\x93\x02\x9c\x01\"F/v2/{placement=projects/*/locations/*/catalogs/*/placements/*}:predict:\x01*ZO\"J/v2/{placement=projects/*/locations/*/catalogs/*/servingConfigs/*}:predict:\x01*\x1aI\xca\x41\x15retail.googleapis.com\xd2\x41.https://www.googleapis.com/auth/cloud-platformB\xc1\x01\n\x1a\x63om.google.cloud.retail.v2B\x16PredictionServiceProtoP\x01Z2cloud.google.com/go/retail/apiv2/retailpb;retailpb\xa2\x02\x06RETAIL\xaa\x02\x16Google.Cloud.Retail.V2\xca\x02\x16Google\\Cloud\\Retail\\V2\xea\x02\x19Google::Cloud::Retail::V2b\x06proto3" + +pool = ::Google::Protobuf::DescriptorPool.generated_pool +pool.add_serialized_file(descriptor_data) + +module Google + module Cloud + module Retail + module V2 + PredictRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.PredictRequest").msgclass + PredictResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.PredictResponse").msgclass + PredictResponse::PredictionResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.PredictResponse.PredictionResult").msgclass + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service_services_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service_services_pb.rb new file mode 100644 index 000000000000..050119438d40 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service_services_pb.rb @@ -0,0 +1,45 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# Source: google/cloud/retail/v2/prediction_service.proto for package 'Google.Cloud.Retail.V2' +# Original file comments: +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +require 'grpc' +require 'google/cloud/retail/v2/prediction_service_pb' + +module Google + module Cloud + module Retail + module V2 + module PredictionService + # Service for making recommendation prediction. + class Service + + include ::GRPC::GenericService + + self.marshal_class_method = :encode + self.unmarshal_class_method = :decode + self.service_name = 'google.cloud.retail.v2.PredictionService' + + # Makes a recommendation prediction. + rpc :Predict, ::Google::Cloud::Retail::V2::PredictRequest, ::Google::Cloud::Retail::V2::PredictResponse + end + + Stub = Service.rpc_stub_class + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_pb.rb new file mode 100644 index 000000000000..fd072d651729 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_pb.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/retail/v2/product.proto + +require 'google/protobuf' + +require 'google/api/field_behavior_pb' +require 'google/api/resource_pb' +require 'google/cloud/retail/v2/common_pb' +require 'google/cloud/retail/v2/promotion_pb' +require 'google/protobuf/duration_pb' +require 'google/protobuf/field_mask_pb' +require 'google/protobuf/timestamp_pb' +require 'google/protobuf/wrappers_pb' + + +descriptor_data = "\n$google/cloud/retail/v2/product.proto\x12\x16google.cloud.retail.v2\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a#google/cloud/retail/v2/common.proto\x1a&google/cloud/retail/v2/promotion.proto\x1a\x1egoogle/protobuf/duration.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1egoogle/protobuf/wrappers.proto\"\xdb\r\n\x07Product\x12\x31\n\x0b\x65xpire_time\x18\x10 \x01(\x0b\x32\x1a.google.protobuf.TimestampH\x00\x12-\n\x03ttl\x18\x11 \x01(\x0b\x32\x19.google.protobuf.DurationB\x03\xe0\x41\x04H\x00\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x05\x12\x0f\n\x02id\x18\x02 \x01(\tB\x03\xe0\x41\x05\x12\x37\n\x04type\x18\x03 \x01(\x0e\x32$.google.cloud.retail.v2.Product.TypeB\x03\xe0\x41\x05\x12\x1a\n\x12primary_product_id\x18\x04 \x01(\t\x12\x1d\n\x15\x63ollection_member_ids\x18\x05 \x03(\t\x12\x0c\n\x04gtin\x18\x06 \x01(\t\x12\x12\n\ncategories\x18\x07 \x03(\t\x12\x12\n\x05title\x18\x08 \x01(\tB\x03\xe0\x41\x02\x12\x0e\n\x06\x62rands\x18\t \x03(\t\x12\x13\n\x0b\x64\x65scription\x18\n \x01(\t\x12\x15\n\rlanguage_code\x18\x0b \x01(\t\x12\x43\n\nattributes\x18\x0c \x03(\x0b\x32/.google.cloud.retail.v2.Product.AttributesEntry\x12\x0c\n\x04tags\x18\r \x03(\t\x12\x35\n\nprice_info\x18\x0e \x01(\x0b\x32!.google.cloud.retail.v2.PriceInfo\x12.\n\x06rating\x18\x0f \x01(\x0b\x32\x1e.google.cloud.retail.v2.Rating\x12\x32\n\x0e\x61vailable_time\x18\x12 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x42\n\x0c\x61vailability\x18\x13 \x01(\x0e\x32,.google.cloud.retail.v2.Product.Availability\x12\x37\n\x12\x61vailable_quantity\x18\x14 \x01(\x0b\x32\x1b.google.protobuf.Int32Value\x12\x41\n\x10\x66ulfillment_info\x18\x15 \x03(\x0b\x32\'.google.cloud.retail.v2.FulfillmentInfo\x12\x0b\n\x03uri\x18\x16 \x01(\t\x12-\n\x06images\x18\x17 \x03(\x0b\x32\x1d.google.cloud.retail.v2.Image\x12\x32\n\x08\x61udience\x18\x18 \x01(\x0b\x32 .google.cloud.retail.v2.Audience\x12\x35\n\ncolor_info\x18\x19 \x01(\x0b\x32!.google.cloud.retail.v2.ColorInfo\x12\r\n\x05sizes\x18\x1a \x03(\t\x12\x11\n\tmaterials\x18\x1b \x03(\t\x12\x10\n\x08patterns\x18\x1c \x03(\t\x12\x12\n\nconditions\x18\x1d \x03(\t\x12\x35\n\npromotions\x18\" \x03(\x0b\x32!.google.cloud.retail.v2.Promotion\x12\x30\n\x0cpublish_time\x18! \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12:\n\x12retrievable_fields\x18\x1e \x01(\x0b\x32\x1a.google.protobuf.FieldMaskB\x02\x18\x01\x12\x36\n\x08variants\x18\x1f \x03(\x0b\x32\x1f.google.cloud.retail.v2.ProductB\x03\xe0\x41\x03\x12\x46\n\x11local_inventories\x18# \x03(\x0b\x32&.google.cloud.retail.v2.LocalInventoryB\x03\xe0\x41\x03\x1aZ\n\x0f\x41ttributesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x36\n\x05value\x18\x02 \x01(\x0b\x32\'.google.cloud.retail.v2.CustomAttribute:\x02\x38\x01\"F\n\x04Type\x12\x14\n\x10TYPE_UNSPECIFIED\x10\x00\x12\x0b\n\x07PRIMARY\x10\x01\x12\x0b\n\x07VARIANT\x10\x02\x12\x0e\n\nCOLLECTION\x10\x03\"i\n\x0c\x41vailability\x12\x1c\n\x18\x41VAILABILITY_UNSPECIFIED\x10\x00\x12\x0c\n\x08IN_STOCK\x10\x01\x12\x10\n\x0cOUT_OF_STOCK\x10\x02\x12\x0c\n\x08PREORDER\x10\x03\x12\r\n\tBACKORDER\x10\x04:\x84\x01\xea\x41\x80\x01\n\x1dretail.googleapis.com/Product\x12_projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}B\x0c\n\nexpirationB\xa6\x02\n\x1a\x63om.google.cloud.retail.v2B\x0cProductProtoP\x01Z2cloud.google.com/go/retail/apiv2/retailpb;retailpb\xa2\x02\x06RETAIL\xaa\x02\x16Google.Cloud.Retail.V2\xca\x02\x16Google\\Cloud\\Retail\\V2\xea\x02\x19Google::Cloud::Retail::V2\xea\x41l\n\x1cretail.googleapis.com/Branch\x12Lprojects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}b\x06proto3" + +pool = ::Google::Protobuf::DescriptorPool.generated_pool +pool.add_serialized_file(descriptor_data) + +module Google + module Cloud + module Retail + module V2 + Product = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Product").msgclass + Product::Type = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Product.Type").enummodule + Product::Availability = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Product.Availability").enummodule + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service.rb new file mode 100644 index 000000000000..b0bca826b962 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/common" +require "gapic/config" +require "gapic/config/method" + +require "google/cloud/retail/v2/version" + +require "google/cloud/retail/v2/product_service/credentials" +require "google/cloud/retail/v2/product_service/paths" +require "google/cloud/retail/v2/product_service/operations" +require "google/cloud/retail/v2/product_service/client" +require "google/cloud/retail/v2/product_service/rest" + +module Google + module Cloud + module Retail + module V2 + ## + # Service for ingesting {::Google::Cloud::Retail::V2::Product Product} information + # of the customer's website. + # + # @example Load this service and instantiate a gRPC client + # + # require "google/cloud/retail/v2/product_service" + # client = ::Google::Cloud::Retail::V2::ProductService::Client.new + # + # @example Load this service and instantiate a REST client + # + # require "google/cloud/retail/v2/product_service/rest" + # client = ::Google::Cloud::Retail::V2::ProductService::Rest::Client.new + # + module ProductService + end + end + end + end +end + +helper_path = ::File.join __dir__, "product_service", "helpers.rb" +require "google/cloud/retail/v2/product_service/helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/client.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/client.rb new file mode 100644 index 000000000000..769fcf4f1fca --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/client.rb @@ -0,0 +1,2239 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/cloud/retail/v2/product_service_pb" +require "google/cloud/location" + +module Google + module Cloud + module Retail + module V2 + module ProductService + ## + # Client for the ProductService service. + # + # Service for ingesting {::Google::Cloud::Retail::V2::Product Product} information + # of the customer's website. + # + class Client + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" + + include Paths + + # @private + attr_reader :product_service_stub + + ## + # Configure the ProductService Client class. + # + # See {::Google::Cloud::Retail::V2::ProductService::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all ProductService clients + # ::Google::Cloud::Retail::V2::ProductService::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "Retail", "V2"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config.timeout = 30.0 + default_config.retry_policy = { + initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [14, 4] + } + + default_config.rpcs.import_products.timeout = 300.0 + default_config.rpcs.import_products.retry_policy = { + initial_delay: 0.1, max_delay: 300.0, multiplier: 1.3, retry_codes: [14, 4] + } + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the ProductService Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Cloud::Retail::V2::ProductService::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @product_service_stub.universe_domain + end + + ## + # Create a new ProductService client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::Retail::V2::ProductService::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::Retail::V2::ProductService::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the ProductService client. + # @yieldparam config [Client::Configuration] + # + def initialize + # These require statements are intentionally placed here to initialize + # the gRPC module only when it's required. + # See https://github.com/googleapis/toolkit/issues/446 + require "gapic/grpc" + require "google/cloud/retail/v2/product_service_services_pb" + + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @operations_client = Operations.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain + end + + @product_service_stub = ::Gapic::ServiceStub.new( + ::Google::Cloud::Retail::V2::ProductService::Stub, + credentials: credentials, + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + channel_args: @config.channel_args, + interceptors: @config.interceptors, + channel_pool_config: @config.channel_pool, + logger: @config.logger + ) + + @product_service_stub.stub_logger&.info do |entry| + entry.set_system_name + entry.set_service + entry.message = "Created client for #{entry.service}" + entry.set_credentials_fields credentials + entry.set "customEndpoint", @config.endpoint if @config.endpoint + entry.set "defaultTimeout", @config.timeout if @config.timeout + entry.set "quotaProject", @quota_project_id if @quota_project_id + end + + @location_client = Google::Cloud::Location::Locations::Client.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @product_service_stub.endpoint + config.universe_domain = @product_service_stub.universe_domain + config.logger = @product_service_stub.logger if config.respond_to? :logger= + end + end + + ## + # Get the associated client for long-running operations. + # + # @return [::Google::Cloud::Retail::V2::ProductService::Operations] + # + attr_reader :operations_client + + ## + # Get the associated client for mix-in of the Locations. + # + # @return [Google::Cloud::Location::Locations::Client] + # + attr_reader :location_client + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @product_service_stub.logger + end + + # Service calls + + ## + # Creates a {::Google::Cloud::Retail::V2::Product Product}. + # + # @overload create_product(request, options = nil) + # Pass arguments to `create_product` via a request object, either of type + # {::Google::Cloud::Retail::V2::CreateProductRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::CreateProductRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload create_product(parent: nil, product: nil, product_id: nil) + # Pass arguments to `create_product` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. The parent catalog resource name, such as + # `projects/*/locations/global/catalogs/default_catalog/branches/default_branch`. + # @param product [::Google::Cloud::Retail::V2::Product, ::Hash] + # Required. The {::Google::Cloud::Retail::V2::Product Product} to create. + # @param product_id [::String] + # Required. The ID to use for the {::Google::Cloud::Retail::V2::Product Product}, + # which will become the final component of the + # {::Google::Cloud::Retail::V2::Product#name Product.name}. + # + # If the caller does not have permission to create the + # {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it + # exists, a PERMISSION_DENIED error is returned. + # + # This field must be unique among all + # {::Google::Cloud::Retail::V2::Product Product}s with the same + # {::Google::Cloud::Retail::V2::CreateProductRequest#parent parent}. Otherwise, an + # ALREADY_EXISTS error is returned. + # + # This field must be a UTF-8 encoded string with a length limit of 128 + # characters. Otherwise, an INVALID_ARGUMENT error is returned. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Retail::V2::Product] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Retail::V2::Product] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ProductService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::CreateProductRequest.new + # + # # Call the create_product method. + # result = client.create_product request + # + # # The returned object is of type Google::Cloud::Retail::V2::Product. + # p result + # + def create_product request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::CreateProductRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.create_product.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.create_product.timeout, + metadata: metadata, + retry_policy: @config.rpcs.create_product.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @product_service_stub.call_rpc :create_product, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets a {::Google::Cloud::Retail::V2::Product Product}. + # + # @overload get_product(request, options = nil) + # Pass arguments to `get_product` via a request object, either of type + # {::Google::Cloud::Retail::V2::GetProductRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::GetProductRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload get_product(name: nil) + # Pass arguments to `get_product` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. Full resource name of {::Google::Cloud::Retail::V2::Product Product}, + # such as + # `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. + # + # If the caller does not have permission to access the + # {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it + # exists, a PERMISSION_DENIED error is returned. + # + # If the requested {::Google::Cloud::Retail::V2::Product Product} does not exist, + # a NOT_FOUND error is returned. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Retail::V2::Product] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Retail::V2::Product] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ProductService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::GetProductRequest.new + # + # # Call the get_product method. + # result = client.get_product request + # + # # The returned object is of type Google::Cloud::Retail::V2::Product. + # p result + # + def get_product request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::GetProductRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.get_product.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.get_product.timeout, + metadata: metadata, + retry_policy: @config.rpcs.get_product.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @product_service_stub.call_rpc :get_product, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets a list of {::Google::Cloud::Retail::V2::Product Product}s. + # + # @overload list_products(request, options = nil) + # Pass arguments to `list_products` via a request object, either of type + # {::Google::Cloud::Retail::V2::ListProductsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::ListProductsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload list_products(parent: nil, page_size: nil, page_token: nil, filter: nil, read_mask: nil) + # Pass arguments to `list_products` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. The parent branch resource name, such as + # `projects/*/locations/global/catalogs/default_catalog/branches/0`. Use + # `default_branch` as the branch ID, to list products under the default + # branch. + # + # If the caller does not have permission to list + # {::Google::Cloud::Retail::V2::Product Product}s under this branch, regardless of + # whether or not this branch exists, a PERMISSION_DENIED error is returned. + # @param page_size [::Integer] + # Maximum number of {::Google::Cloud::Retail::V2::Product Product}s to return. If + # unspecified, defaults to 100. The maximum allowed value is 1000. Values + # above 1000 will be coerced to 1000. + # + # If this field is negative, an INVALID_ARGUMENT error is returned. + # @param page_token [::String] + # A page token + # {::Google::Cloud::Retail::V2::ListProductsResponse#next_page_token ListProductsResponse.next_page_token}, + # received from a previous + # {::Google::Cloud::Retail::V2::ProductService::Client#list_products ProductService.ListProducts} + # call. Provide this to retrieve the subsequent page. + # + # When paginating, all other parameters provided to + # {::Google::Cloud::Retail::V2::ProductService::Client#list_products ProductService.ListProducts} + # must match the call that provided the page token. Otherwise, an + # INVALID_ARGUMENT error is returned. + # @param filter [::String] + # A filter to apply on the list results. Supported features: + # + # * List all the products under the parent branch if + # {::Google::Cloud::Retail::V2::ListProductsRequest#filter filter} is unset. + # * List {::Google::Cloud::Retail::V2::Product::Type::VARIANT Product.Type.VARIANT} + # {::Google::Cloud::Retail::V2::Product Product}s sharing the same + # {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Product.Type.PRIMARY} + # {::Google::Cloud::Retail::V2::Product Product}. For example: + # `primary_product_id = "some_product_id"` + # * List {::Google::Cloud::Retail::V2::Product Product}s bundled in a + # {::Google::Cloud::Retail::V2::Product::Type::COLLECTION Product.Type.COLLECTION} + # {::Google::Cloud::Retail::V2::Product Product}. + # For example: + # `collection_product_id = "some_product_id"` + # * List {::Google::Cloud::Retail::V2::Product Product}s with a partibular type. + # For example: + # `type = "PRIMARY"` + # `type = "VARIANT"` + # `type = "COLLECTION"` + # + # If the field is unrecognizable, an INVALID_ARGUMENT error is returned. + # + # If the specified + # {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Product.Type.PRIMARY} + # {::Google::Cloud::Retail::V2::Product Product} or + # {::Google::Cloud::Retail::V2::Product::Type::COLLECTION Product.Type.COLLECTION} + # {::Google::Cloud::Retail::V2::Product Product} does not exist, a NOT_FOUND error + # is returned. + # @param read_mask [::Google::Protobuf::FieldMask, ::Hash] + # The fields of {::Google::Cloud::Retail::V2::Product Product} to return in the + # responses. If not set or empty, the following fields are returned: + # + # * {::Google::Cloud::Retail::V2::Product#name Product.name} + # * {::Google::Cloud::Retail::V2::Product#id Product.id} + # * {::Google::Cloud::Retail::V2::Product#title Product.title} + # * {::Google::Cloud::Retail::V2::Product#uri Product.uri} + # * {::Google::Cloud::Retail::V2::Product#images Product.images} + # * {::Google::Cloud::Retail::V2::Product#price_info Product.price_info} + # * {::Google::Cloud::Retail::V2::Product#brands Product.brands} + # + # If "*" is provided, all fields are returned. + # {::Google::Cloud::Retail::V2::Product#name Product.name} is always returned no + # matter what mask is set. + # + # If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + # is returned. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Retail::V2::Product>] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::PagedEnumerable<::Google::Cloud::Retail::V2::Product>] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ProductService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::ListProductsRequest.new + # + # # Call the list_products method. + # result = client.list_products request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Cloud::Retail::V2::Product. + # p item + # end + # + def list_products request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ListProductsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.list_products.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.list_products.timeout, + metadata: metadata, + retry_policy: @config.rpcs.list_products.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @product_service_stub.call_rpc :list_products, request, options: options do |response, operation| + response = ::Gapic::PagedEnumerable.new @product_service_stub, :list_products, request, response, operation, options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Updates a {::Google::Cloud::Retail::V2::Product Product}. + # + # @overload update_product(request, options = nil) + # Pass arguments to `update_product` via a request object, either of type + # {::Google::Cloud::Retail::V2::UpdateProductRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::UpdateProductRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload update_product(product: nil, update_mask: nil, allow_missing: nil) + # Pass arguments to `update_product` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param product [::Google::Cloud::Retail::V2::Product, ::Hash] + # Required. The product to update/create. + # + # If the caller does not have permission to update the + # {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it + # exists, a PERMISSION_DENIED error is returned. + # + # If the {::Google::Cloud::Retail::V2::Product Product} to update does not exist + # and + # {::Google::Cloud::Retail::V2::UpdateProductRequest#allow_missing allow_missing} + # is not set, a NOT_FOUND error is returned. + # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] + # Indicates which fields in the provided + # {::Google::Cloud::Retail::V2::Product Product} to update. The immutable and + # output only fields are NOT supported. If not set, all supported fields (the + # fields that are neither immutable nor output only) are updated. + # + # If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + # is returned. + # + # The attribute key can be updated by setting the mask path as + # "attributes.$\\{key_name}". If a key name is present in the mask but not in + # the patching product from the request, this key will be deleted after the + # update. + # @param allow_missing [::Boolean] + # If set to true, and the {::Google::Cloud::Retail::V2::Product Product} is not + # found, a new {::Google::Cloud::Retail::V2::Product Product} will be created. In + # this situation, `update_mask` is ignored. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Retail::V2::Product] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Retail::V2::Product] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ProductService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::UpdateProductRequest.new + # + # # Call the update_product method. + # result = client.update_product request + # + # # The returned object is of type Google::Cloud::Retail::V2::Product. + # p result + # + def update_product request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::UpdateProductRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.update_product.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.product&.name + header_params["product.name"] = request.product.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.update_product.timeout, + metadata: metadata, + retry_policy: @config.rpcs.update_product.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @product_service_stub.call_rpc :update_product, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Deletes a {::Google::Cloud::Retail::V2::Product Product}. + # + # @overload delete_product(request, options = nil) + # Pass arguments to `delete_product` via a request object, either of type + # {::Google::Cloud::Retail::V2::DeleteProductRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::DeleteProductRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload delete_product(name: nil) + # Pass arguments to `delete_product` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. Full resource name of {::Google::Cloud::Retail::V2::Product Product}, + # such as + # `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. + # + # If the caller does not have permission to delete the + # {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it + # exists, a PERMISSION_DENIED error is returned. + # + # If the {::Google::Cloud::Retail::V2::Product Product} to delete does not exist, + # a NOT_FOUND error is returned. + # + # The {::Google::Cloud::Retail::V2::Product Product} to delete can neither be a + # {::Google::Cloud::Retail::V2::Product::Type::COLLECTION Product.Type.COLLECTION} + # {::Google::Cloud::Retail::V2::Product Product} member nor a + # {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Product.Type.PRIMARY} + # {::Google::Cloud::Retail::V2::Product Product} with more than one + # {::Google::Cloud::Retail::V2::Product::Type::VARIANT variants}. Otherwise, an + # INVALID_ARGUMENT error is returned. + # + # All inventory information for the named + # {::Google::Cloud::Retail::V2::Product Product} will be deleted. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Protobuf::Empty] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Protobuf::Empty] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ProductService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::DeleteProductRequest.new + # + # # Call the delete_product method. + # result = client.delete_product request + # + # # The returned object is of type Google::Protobuf::Empty. + # p result + # + def delete_product request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::DeleteProductRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.delete_product.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.delete_product.timeout, + metadata: metadata, + retry_policy: @config.rpcs.delete_product.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @product_service_stub.call_rpc :delete_product, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Permanently deletes all selected {::Google::Cloud::Retail::V2::Product Product}s + # under a branch. + # + # This process is asynchronous. If the request is valid, the removal will be + # enqueued and processed offline. Depending on the number of + # {::Google::Cloud::Retail::V2::Product Product}s, this operation could take hours + # to complete. Before the operation completes, some + # {::Google::Cloud::Retail::V2::Product Product}s may still be returned by + # {::Google::Cloud::Retail::V2::ProductService::Client#get_product ProductService.GetProduct} + # or + # {::Google::Cloud::Retail::V2::ProductService::Client#list_products ProductService.ListProducts}. + # + # Depending on the number of {::Google::Cloud::Retail::V2::Product Product}s, this + # operation could take hours to complete. To get a sample of + # {::Google::Cloud::Retail::V2::Product Product}s that would be deleted, set + # {::Google::Cloud::Retail::V2::PurgeProductsRequest#force PurgeProductsRequest.force} + # to false. + # + # @overload purge_products(request, options = nil) + # Pass arguments to `purge_products` via a request object, either of type + # {::Google::Cloud::Retail::V2::PurgeProductsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::PurgeProductsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload purge_products(parent: nil, filter: nil, force: nil) + # Pass arguments to `purge_products` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. The resource name of the branch under which the products are + # created. The format is + # `projects/${projectId}/locations/global/catalogs/${catalogId}/branches/${branchId}` + # @param filter [::String] + # Required. The filter string to specify the products to be deleted with a + # length limit of 5,000 characters. + # + # Empty string filter is not allowed. "*" implies delete all items in a + # branch. + # + # The eligible fields for filtering are: + # + # * `availability`: Double quoted + # {::Google::Cloud::Retail::V2::Product#availability Product.availability} string. + # * `create_time` : in ISO 8601 "zulu" format. + # + # Supported syntax: + # + # * Comparators (">", "<", ">=", "<=", "="). + # Examples: + # * create_time <= "2015-02-13T17:05:46Z" + # * availability = "IN_STOCK" + # + # * Conjunctions ("AND") + # Examples: + # * create_time <= "2015-02-13T17:05:46Z" AND availability = "PREORDER" + # + # * Disjunctions ("OR") + # Examples: + # * create_time <= "2015-02-13T17:05:46Z" OR availability = "IN_STOCK" + # + # * Can support nested queries. + # Examples: + # * (create_time <= "2015-02-13T17:05:46Z" AND availability = "PREORDER") + # OR (create_time >= "2015-02-14T13:03:32Z" AND availability = "IN_STOCK") + # + # * Filter Limits: + # * Filter should not contain more than 6 conditions. + # * Max nesting depth should not exceed 2 levels. + # + # Examples queries: + # * Delete back order products created before a timestamp. + # create_time <= "2015-02-13T17:05:46Z" OR availability = "BACKORDER" + # @param force [::Boolean] + # Actually perform the purge. + # If `force` is set to false, the method will return the expected purge count + # without deleting any products. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ProductService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::PurgeProductsRequest.new + # + # # Call the purge_products method. + # result = client.purge_products request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def purge_products request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::PurgeProductsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.purge_products.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.purge_products.timeout, + metadata: metadata, + retry_policy: @config.rpcs.purge_products.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @product_service_stub.call_rpc :purge_products, request, options: options do |response, operation| + response = ::Gapic::Operation.new response, @operations_client, options: options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Bulk import of multiple {::Google::Cloud::Retail::V2::Product Product}s. + # + # Request processing may be synchronous. + # Non-existing items are created. + # + # Note that it is possible for a subset of the + # {::Google::Cloud::Retail::V2::Product Product}s to be successfully updated. + # + # @overload import_products(request, options = nil) + # Pass arguments to `import_products` via a request object, either of type + # {::Google::Cloud::Retail::V2::ImportProductsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::ImportProductsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload import_products(parent: nil, request_id: nil, input_config: nil, errors_config: nil, update_mask: nil, reconciliation_mode: nil, notification_pubsub_topic: nil) + # Pass arguments to `import_products` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. + # `projects/1234/locations/global/catalogs/default_catalog/branches/default_branch` + # + # If no updateMask is specified, requires products.create permission. + # If updateMask is specified, requires products.update permission. + # @param request_id [::String] + # Deprecated. This field has no effect. + # @param input_config [::Google::Cloud::Retail::V2::ProductInputConfig, ::Hash] + # Required. The desired input location of the data. + # @param errors_config [::Google::Cloud::Retail::V2::ImportErrorsConfig, ::Hash] + # The desired location of errors incurred during the Import. + # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] + # Indicates which fields in the provided imported `products` to update. If + # not set, all fields are updated. If provided, only the existing product + # fields are updated. Missing products will not be created. + # @param reconciliation_mode [::Google::Cloud::Retail::V2::ImportProductsRequest::ReconciliationMode] + # The mode of reconciliation between existing products and the products to be + # imported. Defaults to + # {::Google::Cloud::Retail::V2::ImportProductsRequest::ReconciliationMode::INCREMENTAL ReconciliationMode.INCREMENTAL}. + # @param notification_pubsub_topic [::String] + # Full Pub/Sub topic name for receiving notification. If this field is set, + # when the import is finished, a notification is sent to + # specified Pub/Sub topic. The message data is JSON string of a + # {::Google::Longrunning::Operation Operation}. + # + # Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. It has + # to be within the same project as + # {::Google::Cloud::Retail::V2::ImportProductsRequest#parent ImportProductsRequest.parent}. + # Make sure that both + # `cloud-retail-customer-data-access@system.gserviceaccount.com` and + # `service-@gcp-sa-retail.iam.gserviceaccount.com` + # have the `pubsub.topics.publish` IAM permission on the topic. + # + # Only supported when + # {::Google::Cloud::Retail::V2::ImportProductsRequest#reconciliation_mode ImportProductsRequest.reconciliation_mode} + # is set to `FULL`. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ProductService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::ImportProductsRequest.new + # + # # Call the import_products method. + # result = client.import_products request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def import_products request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ImportProductsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.import_products.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.import_products.timeout, + metadata: metadata, + retry_policy: @config.rpcs.import_products.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @product_service_stub.call_rpc :import_products, request, options: options do |response, operation| + response = ::Gapic::Operation.new response, @operations_client, options: options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Updates inventory information for a + # {::Google::Cloud::Retail::V2::Product Product} while respecting the last update + # timestamps of each inventory field. + # + # This process is asynchronous and does not require the + # {::Google::Cloud::Retail::V2::Product Product} to exist before updating + # fulfillment information. If the request is valid, the update is enqueued + # and processed downstream. As a consequence, when a response is returned, + # updates are not immediately manifested in the + # {::Google::Cloud::Retail::V2::Product Product} queried by + # {::Google::Cloud::Retail::V2::ProductService::Client#get_product ProductService.GetProduct} + # or + # {::Google::Cloud::Retail::V2::ProductService::Client#list_products ProductService.ListProducts}. + # + # When inventory is updated with + # {::Google::Cloud::Retail::V2::ProductService::Client#create_product ProductService.CreateProduct} + # and + # {::Google::Cloud::Retail::V2::ProductService::Client#update_product ProductService.UpdateProduct}, + # the specified inventory field value(s) overwrite any existing value(s) + # while ignoring the last update time for this field. Furthermore, the last + # update times for the specified inventory fields are overwritten by the + # times of the + # {::Google::Cloud::Retail::V2::ProductService::Client#create_product ProductService.CreateProduct} + # or + # {::Google::Cloud::Retail::V2::ProductService::Client#update_product ProductService.UpdateProduct} + # request. + # + # If no inventory fields are set in + # {::Google::Cloud::Retail::V2::CreateProductRequest#product CreateProductRequest.product}, + # then any pre-existing inventory information for this product is used. + # + # If no inventory fields are set in + # {::Google::Cloud::Retail::V2::SetInventoryRequest#set_mask SetInventoryRequest.set_mask}, + # then any existing inventory information is preserved. + # + # Pre-existing inventory information can only be updated with + # {::Google::Cloud::Retail::V2::ProductService::Client#set_inventory ProductService.SetInventory}, + # {::Google::Cloud::Retail::V2::ProductService::Client#add_fulfillment_places ProductService.AddFulfillmentPlaces}, + # and + # {::Google::Cloud::Retail::V2::ProductService::Client#remove_fulfillment_places ProductService.RemoveFulfillmentPlaces}. + # + # The returned {::Google::Longrunning::Operation Operation}s is obsolete after + # one day, and the GetOperation + # API returns `NOT_FOUND` afterwards. + # + # If conflicting updates are issued, the + # {::Google::Longrunning::Operation Operation}s associated with the stale + # updates are not marked as {::Google::Longrunning::Operation#done done} until + # they are obsolete. + # + # @overload set_inventory(request, options = nil) + # Pass arguments to `set_inventory` via a request object, either of type + # {::Google::Cloud::Retail::V2::SetInventoryRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::SetInventoryRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload set_inventory(inventory: nil, set_mask: nil, set_time: nil, allow_missing: nil) + # Pass arguments to `set_inventory` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param inventory [::Google::Cloud::Retail::V2::Product, ::Hash] + # Required. The inventory information to update. The allowable fields to + # update are: + # + # * {::Google::Cloud::Retail::V2::Product#price_info Product.price_info} + # * {::Google::Cloud::Retail::V2::Product#availability Product.availability} + # * {::Google::Cloud::Retail::V2::Product#available_quantity Product.available_quantity} + # * {::Google::Cloud::Retail::V2::Product#fulfillment_info Product.fulfillment_info} + # The updated inventory fields must be specified in + # {::Google::Cloud::Retail::V2::SetInventoryRequest#set_mask SetInventoryRequest.set_mask}. + # + # If + # {::Google::Cloud::Retail::V2::Product#name SetInventoryRequest.inventory.name} + # is empty or invalid, an INVALID_ARGUMENT error is returned. + # + # If the caller does not have permission to update the + # {::Google::Cloud::Retail::V2::Product Product} named in + # {::Google::Cloud::Retail::V2::Product#name Product.name}, regardless of whether + # or not it exists, a PERMISSION_DENIED error is returned. + # + # If the {::Google::Cloud::Retail::V2::Product Product} to update does not have + # existing inventory information, the provided inventory information will be + # inserted. + # + # If the {::Google::Cloud::Retail::V2::Product Product} to update has existing + # inventory information, the provided inventory information will be merged + # while respecting the last update time for each inventory field, using the + # provided or default value for + # {::Google::Cloud::Retail::V2::SetInventoryRequest#set_time SetInventoryRequest.set_time}. + # + # The caller can replace place IDs for a subset of fulfillment types in the + # following ways: + # + # * Adds "fulfillment_info" in + # {::Google::Cloud::Retail::V2::SetInventoryRequest#set_mask SetInventoryRequest.set_mask} + # * Specifies only the desired fulfillment types and corresponding place IDs + # to update in + # {::Google::Cloud::Retail::V2::Product#fulfillment_info SetInventoryRequest.inventory.fulfillment_info} + # + # The caller can clear all place IDs from a subset of fulfillment types in + # the following ways: + # + # * Adds "fulfillment_info" in + # {::Google::Cloud::Retail::V2::SetInventoryRequest#set_mask SetInventoryRequest.set_mask} + # * Specifies only the desired fulfillment types to clear in + # {::Google::Cloud::Retail::V2::Product#fulfillment_info SetInventoryRequest.inventory.fulfillment_info} + # * Checks that only the desired fulfillment info types have empty + # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids SetInventoryRequest.inventory.fulfillment_info.place_ids} + # + # The last update time is recorded for the following inventory fields: + # * {::Google::Cloud::Retail::V2::Product#price_info Product.price_info} + # * {::Google::Cloud::Retail::V2::Product#availability Product.availability} + # * {::Google::Cloud::Retail::V2::Product#available_quantity Product.available_quantity} + # * {::Google::Cloud::Retail::V2::Product#fulfillment_info Product.fulfillment_info} + # + # If a full overwrite of inventory information while ignoring timestamps is + # needed, + # {::Google::Cloud::Retail::V2::ProductService::Client#update_product ProductService.UpdateProduct} + # should be invoked instead. + # @param set_mask [::Google::Protobuf::FieldMask, ::Hash] + # Indicates which inventory fields in the provided + # {::Google::Cloud::Retail::V2::Product Product} to update. + # + # At least one field must be provided. + # + # If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + # is returned and the entire update will be ignored. + # @param set_time [::Google::Protobuf::Timestamp, ::Hash] + # The time when the request is issued, used to prevent + # out-of-order updates on inventory fields with the last update time + # recorded. If not provided, the internal system time will be used. + # @param allow_missing [::Boolean] + # If set to true, and the {::Google::Cloud::Retail::V2::Product Product} with name + # {::Google::Cloud::Retail::V2::Product#name Product.name} is not found, the + # inventory update will still be processed and retained for at most 1 day + # until the {::Google::Cloud::Retail::V2::Product Product} is created. If set to + # false, a NOT_FOUND error is returned if the + # {::Google::Cloud::Retail::V2::Product Product} is not found. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ProductService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::SetInventoryRequest.new + # + # # Call the set_inventory method. + # result = client.set_inventory request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def set_inventory request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::SetInventoryRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.set_inventory.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.inventory&.name + header_params["inventory.name"] = request.inventory.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.set_inventory.timeout, + metadata: metadata, + retry_policy: @config.rpcs.set_inventory.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @product_service_stub.call_rpc :set_inventory, request, options: options do |response, operation| + response = ::Gapic::Operation.new response, @operations_client, options: options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # We recommend that you use the + # {::Google::Cloud::Retail::V2::ProductService::Client#add_local_inventories ProductService.AddLocalInventories} + # method instead of the + # {::Google::Cloud::Retail::V2::ProductService::Client#add_fulfillment_places ProductService.AddFulfillmentPlaces} + # method. + # {::Google::Cloud::Retail::V2::ProductService::Client#add_local_inventories ProductService.AddLocalInventories} + # achieves the same results but provides more fine-grained control over + # ingesting local inventory data. + # + # Incrementally adds place IDs to + # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids Product.fulfillment_info.place_ids}. + # + # This process is asynchronous and does not require the + # {::Google::Cloud::Retail::V2::Product Product} to exist before updating + # fulfillment information. If the request is valid, the update will be + # enqueued and processed downstream. As a consequence, when a response is + # returned, the added place IDs are not immediately manifested in the + # {::Google::Cloud::Retail::V2::Product Product} queried by + # {::Google::Cloud::Retail::V2::ProductService::Client#get_product ProductService.GetProduct} + # or + # {::Google::Cloud::Retail::V2::ProductService::Client#list_products ProductService.ListProducts}. + # + # The returned {::Google::Longrunning::Operation Operation}s will be obsolete + # after 1 day, and GetOperation + # API will return NOT_FOUND afterwards. + # + # If conflicting updates are issued, the + # {::Google::Longrunning::Operation Operation}s associated with the stale + # updates will not be marked as {::Google::Longrunning::Operation#done done} + # until being obsolete. + # + # @overload add_fulfillment_places(request, options = nil) + # Pass arguments to `add_fulfillment_places` via a request object, either of type + # {::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload add_fulfillment_places(product: nil, type: nil, place_ids: nil, add_time: nil, allow_missing: nil) + # Pass arguments to `add_fulfillment_places` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param product [::String] + # Required. Full resource name of {::Google::Cloud::Retail::V2::Product Product}, + # such as + # `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. + # + # If the caller does not have permission to access the + # {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it + # exists, a PERMISSION_DENIED error is returned. + # @param type [::String] + # Required. The fulfillment type, including commonly used types (such as + # pickup in store and same day delivery), and custom types. + # + # Supported values: + # + # * "pickup-in-store" + # * "ship-to-store" + # * "same-day-delivery" + # * "next-day-delivery" + # * "custom-type-1" + # * "custom-type-2" + # * "custom-type-3" + # * "custom-type-4" + # * "custom-type-5" + # + # If this field is set to an invalid value other than these, an + # INVALID_ARGUMENT error is returned. + # + # This field directly corresponds to + # {::Google::Cloud::Retail::V2::FulfillmentInfo#type Product.fulfillment_info.type}. + # @param place_ids [::Array<::String>] + # Required. The IDs for this + # {::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest#type type}, such as + # the store IDs for "pickup-in-store" or the region IDs for + # "same-day-delivery" to be added for this + # {::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest#type type}. Duplicate + # IDs will be automatically ignored. + # + # At least 1 value is required, and a maximum of 2000 values are allowed. + # Each value must be a string with a length limit of 10 characters, matching + # the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an + # INVALID_ARGUMENT error is returned. + # + # If the total number of place IDs exceeds 2000 for this + # {::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest#type type} after + # adding, then the update will be rejected. + # @param add_time [::Google::Protobuf::Timestamp, ::Hash] + # The time when the fulfillment updates are issued, used to prevent + # out-of-order updates on fulfillment information. If not provided, the + # internal system time will be used. + # @param allow_missing [::Boolean] + # If set to true, and the {::Google::Cloud::Retail::V2::Product Product} is not + # found, the fulfillment information will still be processed and retained for + # at most 1 day and processed once the + # {::Google::Cloud::Retail::V2::Product Product} is created. If set to false, a + # NOT_FOUND error is returned if the + # {::Google::Cloud::Retail::V2::Product Product} is not found. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ProductService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest.new + # + # # Call the add_fulfillment_places method. + # result = client.add_fulfillment_places request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def add_fulfillment_places request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.add_fulfillment_places.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.product + header_params["product"] = request.product + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.add_fulfillment_places.timeout, + metadata: metadata, + retry_policy: @config.rpcs.add_fulfillment_places.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @product_service_stub.call_rpc :add_fulfillment_places, request, options: options do |response, operation| + response = ::Gapic::Operation.new response, @operations_client, options: options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # We recommend that you use the + # {::Google::Cloud::Retail::V2::ProductService::Client#remove_local_inventories ProductService.RemoveLocalInventories} + # method instead of the + # {::Google::Cloud::Retail::V2::ProductService::Client#remove_fulfillment_places ProductService.RemoveFulfillmentPlaces} + # method. + # {::Google::Cloud::Retail::V2::ProductService::Client#remove_local_inventories ProductService.RemoveLocalInventories} + # achieves the same results but provides more fine-grained control over + # ingesting local inventory data. + # + # Incrementally removes place IDs from a + # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids Product.fulfillment_info.place_ids}. + # + # This process is asynchronous and does not require the + # {::Google::Cloud::Retail::V2::Product Product} to exist before updating + # fulfillment information. If the request is valid, the update will be + # enqueued and processed downstream. As a consequence, when a response is + # returned, the removed place IDs are not immediately manifested in the + # {::Google::Cloud::Retail::V2::Product Product} queried by + # {::Google::Cloud::Retail::V2::ProductService::Client#get_product ProductService.GetProduct} + # or + # {::Google::Cloud::Retail::V2::ProductService::Client#list_products ProductService.ListProducts}. + # + # The returned {::Google::Longrunning::Operation Operation}s will be obsolete + # after 1 day, and GetOperation + # API will return NOT_FOUND afterwards. + # + # If conflicting updates are issued, the + # {::Google::Longrunning::Operation Operation}s associated with the stale + # updates will not be marked as {::Google::Longrunning::Operation#done done} + # until being obsolete. + # + # @overload remove_fulfillment_places(request, options = nil) + # Pass arguments to `remove_fulfillment_places` via a request object, either of type + # {::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload remove_fulfillment_places(product: nil, type: nil, place_ids: nil, remove_time: nil, allow_missing: nil) + # Pass arguments to `remove_fulfillment_places` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param product [::String] + # Required. Full resource name of {::Google::Cloud::Retail::V2::Product Product}, + # such as + # `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. + # + # If the caller does not have permission to access the + # {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it + # exists, a PERMISSION_DENIED error is returned. + # @param type [::String] + # Required. The fulfillment type, including commonly used types (such as + # pickup in store and same day delivery), and custom types. + # + # Supported values: + # + # * "pickup-in-store" + # * "ship-to-store" + # * "same-day-delivery" + # * "next-day-delivery" + # * "custom-type-1" + # * "custom-type-2" + # * "custom-type-3" + # * "custom-type-4" + # * "custom-type-5" + # + # If this field is set to an invalid value other than these, an + # INVALID_ARGUMENT error is returned. + # + # This field directly corresponds to + # {::Google::Cloud::Retail::V2::FulfillmentInfo#type Product.fulfillment_info.type}. + # @param place_ids [::Array<::String>] + # Required. The IDs for this + # {::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest#type type}, such as + # the store IDs for "pickup-in-store" or the region IDs for + # "same-day-delivery", to be removed for this + # {::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest#type type}. + # + # At least 1 value is required, and a maximum of 2000 values are allowed. + # Each value must be a string with a length limit of 10 characters, matching + # the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an + # INVALID_ARGUMENT error is returned. + # @param remove_time [::Google::Protobuf::Timestamp, ::Hash] + # The time when the fulfillment updates are issued, used to prevent + # out-of-order updates on fulfillment information. If not provided, the + # internal system time will be used. + # @param allow_missing [::Boolean] + # If set to true, and the {::Google::Cloud::Retail::V2::Product Product} is not + # found, the fulfillment information will still be processed and retained for + # at most 1 day and processed once the + # {::Google::Cloud::Retail::V2::Product Product} is created. If set to false, a + # NOT_FOUND error is returned if the + # {::Google::Cloud::Retail::V2::Product Product} is not found. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ProductService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest.new + # + # # Call the remove_fulfillment_places method. + # result = client.remove_fulfillment_places request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def remove_fulfillment_places request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.remove_fulfillment_places.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.product + header_params["product"] = request.product + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.remove_fulfillment_places.timeout, + metadata: metadata, + retry_policy: @config.rpcs.remove_fulfillment_places.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @product_service_stub.call_rpc :remove_fulfillment_places, request, options: options do |response, operation| + response = ::Gapic::Operation.new response, @operations_client, options: options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Updates local inventory information for a + # {::Google::Cloud::Retail::V2::Product Product} at a list of places, while + # respecting the last update timestamps of each inventory field. + # + # This process is asynchronous and does not require the + # {::Google::Cloud::Retail::V2::Product Product} to exist before updating + # inventory information. If the request is valid, the update will be enqueued + # and processed downstream. As a consequence, when a response is returned, + # updates are not immediately manifested in the + # {::Google::Cloud::Retail::V2::Product Product} queried by + # {::Google::Cloud::Retail::V2::ProductService::Client#get_product ProductService.GetProduct} + # or + # {::Google::Cloud::Retail::V2::ProductService::Client#list_products ProductService.ListProducts}. + # + # Local inventory information can only be modified using this method. + # {::Google::Cloud::Retail::V2::ProductService::Client#create_product ProductService.CreateProduct} + # and + # {::Google::Cloud::Retail::V2::ProductService::Client#update_product ProductService.UpdateProduct} + # has no effect on local inventories. + # + # The returned {::Google::Longrunning::Operation Operation}s will be obsolete + # after 1 day, and GetOperation + # API will return NOT_FOUND afterwards. + # + # If conflicting updates are issued, the + # {::Google::Longrunning::Operation Operation}s associated with the stale + # updates will not be marked as {::Google::Longrunning::Operation#done done} + # until being obsolete. + # + # @overload add_local_inventories(request, options = nil) + # Pass arguments to `add_local_inventories` via a request object, either of type + # {::Google::Cloud::Retail::V2::AddLocalInventoriesRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::AddLocalInventoriesRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload add_local_inventories(product: nil, local_inventories: nil, add_mask: nil, add_time: nil, allow_missing: nil) + # Pass arguments to `add_local_inventories` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param product [::String] + # Required. Full resource name of {::Google::Cloud::Retail::V2::Product Product}, + # such as + # `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. + # + # If the caller does not have permission to access the + # {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it + # exists, a PERMISSION_DENIED error is returned. + # @param local_inventories [::Array<::Google::Cloud::Retail::V2::LocalInventory, ::Hash>] + # Required. A list of inventory information at difference places. Each place + # is identified by its place ID. At most 3000 inventories are allowed per + # request. + # @param add_mask [::Google::Protobuf::FieldMask, ::Hash] + # Indicates which inventory fields in the provided list of + # {::Google::Cloud::Retail::V2::LocalInventory LocalInventory} to update. The + # field is updated to the provided value. + # + # If a field is set while the place does not have a previous local inventory, + # the local inventory at that store is created. + # + # If a field is set while the value of that field is not provided, the + # original field value, if it exists, is deleted. + # + # If the mask is not set or set with empty paths, all inventory fields will + # be updated. + # + # If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + # is returned and the entire update will be ignored. + # @param add_time [::Google::Protobuf::Timestamp, ::Hash] + # The time when the inventory updates are issued. Used to prevent + # out-of-order updates on local inventory fields. If not provided, the + # internal system time will be used. + # @param allow_missing [::Boolean] + # If set to true, and the {::Google::Cloud::Retail::V2::Product Product} is not + # found, the local inventory will still be processed and retained for at most + # 1 day and processed once the {::Google::Cloud::Retail::V2::Product Product} is + # created. If set to false, a NOT_FOUND error is returned if the + # {::Google::Cloud::Retail::V2::Product Product} is not found. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ProductService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::AddLocalInventoriesRequest.new + # + # # Call the add_local_inventories method. + # result = client.add_local_inventories request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def add_local_inventories request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::AddLocalInventoriesRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.add_local_inventories.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.product + header_params["product"] = request.product + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.add_local_inventories.timeout, + metadata: metadata, + retry_policy: @config.rpcs.add_local_inventories.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @product_service_stub.call_rpc :add_local_inventories, request, options: options do |response, operation| + response = ::Gapic::Operation.new response, @operations_client, options: options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Remove local inventory information for a + # {::Google::Cloud::Retail::V2::Product Product} at a list of places at a removal + # timestamp. + # + # This process is asynchronous. If the request is valid, the removal will be + # enqueued and processed downstream. As a consequence, when a response is + # returned, removals are not immediately manifested in the + # {::Google::Cloud::Retail::V2::Product Product} queried by + # {::Google::Cloud::Retail::V2::ProductService::Client#get_product ProductService.GetProduct} + # or + # {::Google::Cloud::Retail::V2::ProductService::Client#list_products ProductService.ListProducts}. + # + # Local inventory information can only be removed using this method. + # {::Google::Cloud::Retail::V2::ProductService::Client#create_product ProductService.CreateProduct} + # and + # {::Google::Cloud::Retail::V2::ProductService::Client#update_product ProductService.UpdateProduct} + # has no effect on local inventories. + # + # The returned {::Google::Longrunning::Operation Operation}s will be obsolete + # after 1 day, and GetOperation + # API will return NOT_FOUND afterwards. + # + # If conflicting updates are issued, the + # {::Google::Longrunning::Operation Operation}s associated with the stale + # updates will not be marked as {::Google::Longrunning::Operation#done done} + # until being obsolete. + # + # @overload remove_local_inventories(request, options = nil) + # Pass arguments to `remove_local_inventories` via a request object, either of type + # {::Google::Cloud::Retail::V2::RemoveLocalInventoriesRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::RemoveLocalInventoriesRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload remove_local_inventories(product: nil, place_ids: nil, remove_time: nil, allow_missing: nil) + # Pass arguments to `remove_local_inventories` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param product [::String] + # Required. Full resource name of {::Google::Cloud::Retail::V2::Product Product}, + # such as + # `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. + # + # If the caller does not have permission to access the + # {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it + # exists, a PERMISSION_DENIED error is returned. + # @param place_ids [::Array<::String>] + # Required. A list of place IDs to have their inventory deleted. + # At most 3000 place IDs are allowed per request. + # @param remove_time [::Google::Protobuf::Timestamp, ::Hash] + # The time when the inventory deletions are issued. Used to prevent + # out-of-order updates and deletions on local inventory fields. If not + # provided, the internal system time will be used. + # @param allow_missing [::Boolean] + # If set to true, and the {::Google::Cloud::Retail::V2::Product Product} is not + # found, the local inventory removal request will still be processed and + # retained for at most 1 day and processed once the + # {::Google::Cloud::Retail::V2::Product Product} is created. If set to false, a + # NOT_FOUND error is returned if the + # {::Google::Cloud::Retail::V2::Product Product} is not found. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ProductService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::RemoveLocalInventoriesRequest.new + # + # # Call the remove_local_inventories method. + # result = client.remove_local_inventories request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def remove_local_inventories request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::RemoveLocalInventoriesRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.remove_local_inventories.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.product + header_params["product"] = request.product + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.remove_local_inventories.timeout, + metadata: metadata, + retry_policy: @config.rpcs.remove_local_inventories.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @product_service_stub.call_rpc :remove_local_inventories, request, options: options do |response, operation| + response = ::Gapic::Operation.new response, @operations_client, options: options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the ProductService API. + # + # This class represents the configuration for ProductService, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::Retail::V2::ProductService::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # create_product to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Retail::V2::ProductService::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.create_product.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Retail::V2::ProductService::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.create_product.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`GRPC::Core::Channel`) a gRPC channel with included credentials + # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object + # * (`nil`) indicating no credentials + # + # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials + # is deprecated. Providing an unvalidated credential configuration to + # Google APIs can compromise the security of your systems and data. + # + # @example + # + # # The recommended way to provide credentials is to use the `make_creds` method + # # on the appropriate credentials class for your environment. + # + # require "googleauth" + # + # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds( + # json_key_io: ::File.open("/path/to/keyfile.json") + # ) + # + # client = ::Google::Cloud::Retail::V2::ProductService::Client.new do |config| + # config.credentials = credentials + # end + # + # @note Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] channel_args + # Extra parameters passed to the gRPC channel. Note: this is ignored if a + # `GRPC::Core::Channel` object is provided as the credential. + # @return [::Hash] + # @!attribute [rw] interceptors + # An array of interceptors that are run before calls are executed. + # @return [::Array<::GRPC::ClientInterceptor>] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional gRPC headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "retail.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) + config_attr :interceptors, nil, ::Array, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration for the channel pool + # @return [::Gapic::ServiceStub::ChannelPool::Configuration] + # + def channel_pool + @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new + end + + ## + # Configuration RPC class for the ProductService API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `create_product` + # @return [::Gapic::Config::Method] + # + attr_reader :create_product + ## + # RPC-specific configuration for `get_product` + # @return [::Gapic::Config::Method] + # + attr_reader :get_product + ## + # RPC-specific configuration for `list_products` + # @return [::Gapic::Config::Method] + # + attr_reader :list_products + ## + # RPC-specific configuration for `update_product` + # @return [::Gapic::Config::Method] + # + attr_reader :update_product + ## + # RPC-specific configuration for `delete_product` + # @return [::Gapic::Config::Method] + # + attr_reader :delete_product + ## + # RPC-specific configuration for `purge_products` + # @return [::Gapic::Config::Method] + # + attr_reader :purge_products + ## + # RPC-specific configuration for `import_products` + # @return [::Gapic::Config::Method] + # + attr_reader :import_products + ## + # RPC-specific configuration for `set_inventory` + # @return [::Gapic::Config::Method] + # + attr_reader :set_inventory + ## + # RPC-specific configuration for `add_fulfillment_places` + # @return [::Gapic::Config::Method] + # + attr_reader :add_fulfillment_places + ## + # RPC-specific configuration for `remove_fulfillment_places` + # @return [::Gapic::Config::Method] + # + attr_reader :remove_fulfillment_places + ## + # RPC-specific configuration for `add_local_inventories` + # @return [::Gapic::Config::Method] + # + attr_reader :add_local_inventories + ## + # RPC-specific configuration for `remove_local_inventories` + # @return [::Gapic::Config::Method] + # + attr_reader :remove_local_inventories + + # @private + def initialize parent_rpcs = nil + create_product_config = parent_rpcs.create_product if parent_rpcs.respond_to? :create_product + @create_product = ::Gapic::Config::Method.new create_product_config + get_product_config = parent_rpcs.get_product if parent_rpcs.respond_to? :get_product + @get_product = ::Gapic::Config::Method.new get_product_config + list_products_config = parent_rpcs.list_products if parent_rpcs.respond_to? :list_products + @list_products = ::Gapic::Config::Method.new list_products_config + update_product_config = parent_rpcs.update_product if parent_rpcs.respond_to? :update_product + @update_product = ::Gapic::Config::Method.new update_product_config + delete_product_config = parent_rpcs.delete_product if parent_rpcs.respond_to? :delete_product + @delete_product = ::Gapic::Config::Method.new delete_product_config + purge_products_config = parent_rpcs.purge_products if parent_rpcs.respond_to? :purge_products + @purge_products = ::Gapic::Config::Method.new purge_products_config + import_products_config = parent_rpcs.import_products if parent_rpcs.respond_to? :import_products + @import_products = ::Gapic::Config::Method.new import_products_config + set_inventory_config = parent_rpcs.set_inventory if parent_rpcs.respond_to? :set_inventory + @set_inventory = ::Gapic::Config::Method.new set_inventory_config + add_fulfillment_places_config = parent_rpcs.add_fulfillment_places if parent_rpcs.respond_to? :add_fulfillment_places + @add_fulfillment_places = ::Gapic::Config::Method.new add_fulfillment_places_config + remove_fulfillment_places_config = parent_rpcs.remove_fulfillment_places if parent_rpcs.respond_to? :remove_fulfillment_places + @remove_fulfillment_places = ::Gapic::Config::Method.new remove_fulfillment_places_config + add_local_inventories_config = parent_rpcs.add_local_inventories if parent_rpcs.respond_to? :add_local_inventories + @add_local_inventories = ::Gapic::Config::Method.new add_local_inventories_config + remove_local_inventories_config = parent_rpcs.remove_local_inventories if parent_rpcs.respond_to? :remove_local_inventories + @remove_local_inventories = ::Gapic::Config::Method.new remove_local_inventories_config + + yield self if block_given? + end + end + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/credentials.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/credentials.rb new file mode 100644 index 000000000000..1a4d7700391f --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/credentials.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "googleauth" + +module Google + module Cloud + module Retail + module V2 + module ProductService + # Credentials for the ProductService API. + class Credentials < ::Google::Auth::Credentials + self.scope = [ + "https://www.googleapis.com/auth/cloud-platform" + ] + self.env_vars = [ + "RETAIL_CREDENTIALS", + "RETAIL_KEYFILE", + "GOOGLE_CLOUD_CREDENTIALS", + "GOOGLE_CLOUD_KEYFILE", + "GCLOUD_KEYFILE", + "RETAIL_CREDENTIALS_JSON", + "RETAIL_KEYFILE_JSON", + "GOOGLE_CLOUD_CREDENTIALS_JSON", + "GOOGLE_CLOUD_KEYFILE_JSON", + "GCLOUD_KEYFILE_JSON" + ] + self.paths = [ + "~/.config/google_cloud/application_default_credentials.json" + ] + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/operations.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/operations.rb new file mode 100644 index 000000000000..73c2f7ea2412 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/operations.rb @@ -0,0 +1,843 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/operation" +require "google/longrunning/operations_pb" + +module Google + module Cloud + module Retail + module V2 + module ProductService + # Service that implements Longrunning Operations API. + class Operations + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" + + # @private + attr_reader :operations_stub + + ## + # Configuration for the ProductService Operations API. + # + # @yield [config] Configure the Operations client. + # @yieldparam config [Operations::Configuration] + # + # @return [Operations::Configuration] + # + def self.configure + @configure ||= Operations::Configuration.new + yield @configure if block_given? + @configure + end + + ## + # Configure the ProductService Operations instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Operations.configure}. + # + # @yield [config] Configure the Operations client. + # @yieldparam config [Operations::Configuration] + # + # @return [Operations::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @operations_stub.universe_domain + end + + ## + # Create a new Operations client object. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Operations::Configuration] + # + def initialize + # These require statements are intentionally placed here to initialize + # the gRPC module only when it's required. + # See https://github.com/googleapis/toolkit/issues/446 + require "gapic/grpc" + require "google/longrunning/operations_services_pb" + + # Create the configuration object + @config = Configuration.new Operations.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + credentials ||= Credentials.default scope: @config.scope + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @operations_stub = ::Gapic::ServiceStub.new( + ::Google::Longrunning::Operations::Stub, + credentials: credentials, + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + channel_args: @config.channel_args, + interceptors: @config.interceptors, + channel_pool_config: @config.channel_pool + ) + + # Used by an LRO wrapper for some methods of this service + @operations_client = self + end + + # Service calls + + ## + # Lists operations that match the specified filter in the request. If the + # server doesn't support this method, it returns `UNIMPLEMENTED`. + # + # @overload list_operations(request, options = nil) + # Pass arguments to `list_operations` via a request object, either of type + # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::ListOperationsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload list_operations(name: nil, filter: nil, page_size: nil, page_token: nil, return_partial_success: nil) + # Pass arguments to `list_operations` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation's parent resource. + # @param filter [::String] + # The standard list filter. + # @param page_size [::Integer] + # The standard list page size. + # @param page_token [::String] + # The standard list page token. + # @param return_partial_success [::Boolean] + # When set to `true`, operations that are reachable are returned as normal, + # and those that are unreachable are returned in the + # [ListOperationsResponse.unreachable] field. + # + # This can only be `true` when reading across collections e.g. when `parent` + # is set to `"projects/example/locations/-"`. + # + # This field is not by default supported and will result in an + # `UNIMPLEMENTED` error if set unless explicitly documented otherwise in + # service or product specific documentation. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::PagedEnumerable<::Gapic::Operation>] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::PagedEnumerable<::Gapic::Operation>] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::ListOperationsRequest.new + # + # # Call the list_operations method. + # result = client.list_operations request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Longrunning::Operation. + # p item + # end + # + def list_operations request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::ListOperationsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.list_operations.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.list_operations.timeout, + metadata: metadata, + retry_policy: @config.rpcs.list_operations.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.call_rpc :list_operations, request, options: options do |response, operation| + wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client } + response = ::Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets the latest state of a long-running operation. Clients can use this + # method to poll the operation result at intervals as recommended by the API + # service. + # + # @overload get_operation(request, options = nil) + # Pass arguments to `get_operation` via a request object, either of type + # {::Google::Longrunning::GetOperationRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::GetOperationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload get_operation(name: nil) + # Pass arguments to `get_operation` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation resource. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::GetOperationRequest.new + # + # # Call the get_operation method. + # result = client.get_operation request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def get_operation request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::GetOperationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.get_operation.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.get_operation.timeout, + metadata: metadata, + retry_policy: @config.rpcs.get_operation.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.call_rpc :get_operation, request, options: options do |response, operation| + response = ::Gapic::Operation.new response, @operations_client, options: options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Deletes a long-running operation. This method indicates that the client is + # no longer interested in the operation result. It does not cancel the + # operation. If the server doesn't support this method, it returns + # `google.rpc.Code.UNIMPLEMENTED`. + # + # @overload delete_operation(request, options = nil) + # Pass arguments to `delete_operation` via a request object, either of type + # {::Google::Longrunning::DeleteOperationRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::DeleteOperationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload delete_operation(name: nil) + # Pass arguments to `delete_operation` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation resource to be deleted. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Protobuf::Empty] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Protobuf::Empty] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::DeleteOperationRequest.new + # + # # Call the delete_operation method. + # result = client.delete_operation request + # + # # The returned object is of type Google::Protobuf::Empty. + # p result + # + def delete_operation request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::DeleteOperationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.delete_operation.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.delete_operation.timeout, + metadata: metadata, + retry_policy: @config.rpcs.delete_operation.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.call_rpc :delete_operation, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Starts asynchronous cancellation on a long-running operation. The server + # makes a best effort to cancel the operation, but success is not + # guaranteed. If the server doesn't support this method, it returns + # `google.rpc.Code.UNIMPLEMENTED`. Clients can use + # Operations.GetOperation or + # other methods to check whether the cancellation succeeded or whether the + # operation completed despite cancellation. On successful cancellation, + # the operation is not deleted; instead, it becomes an operation with + # an {::Google::Longrunning::Operation#error Operation.error} value with a + # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to + # `Code.CANCELLED`. + # + # @overload cancel_operation(request, options = nil) + # Pass arguments to `cancel_operation` via a request object, either of type + # {::Google::Longrunning::CancelOperationRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::CancelOperationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload cancel_operation(name: nil) + # Pass arguments to `cancel_operation` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation resource to be cancelled. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Protobuf::Empty] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Protobuf::Empty] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::CancelOperationRequest.new + # + # # Call the cancel_operation method. + # result = client.cancel_operation request + # + # # The returned object is of type Google::Protobuf::Empty. + # p result + # + def cancel_operation request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::CancelOperationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.cancel_operation.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.cancel_operation.timeout, + metadata: metadata, + retry_policy: @config.rpcs.cancel_operation.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Waits until the specified long-running operation is done or reaches at most + # a specified timeout, returning the latest state. If the operation is + # already done, the latest state is immediately returned. If the timeout + # specified is greater than the default HTTP/RPC timeout, the HTTP/RPC + # timeout is used. If the server does not support this method, it returns + # `google.rpc.Code.UNIMPLEMENTED`. + # Note that this method is on a best-effort basis. It may return the latest + # state before the specified timeout (including immediately), meaning even an + # immediate response is no guarantee that the operation is done. + # + # @overload wait_operation(request, options = nil) + # Pass arguments to `wait_operation` via a request object, either of type + # {::Google::Longrunning::WaitOperationRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::WaitOperationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload wait_operation(name: nil, timeout: nil) + # Pass arguments to `wait_operation` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation resource to wait on. + # @param timeout [::Google::Protobuf::Duration, ::Hash] + # The maximum duration to wait before timing out. If left blank, the wait + # will be at most the time permitted by the underlying HTTP/RPC protocol. + # If RPC context deadline is also specified, the shorter one will be used. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::WaitOperationRequest.new + # + # # Call the wait_operation method. + # result = client.wait_operation request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def wait_operation request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::WaitOperationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.wait_operation.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.wait_operation.timeout, + metadata: metadata, + retry_policy: @config.rpcs.wait_operation.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation| + response = ::Gapic::Operation.new response, @operations_client, options: options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the Operations API. + # + # This class represents the configuration for Operations, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Longrunning::Operations::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # list_operations to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Longrunning::Operations::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.list_operations.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Longrunning::Operations::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.list_operations.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`GRPC::Core::Channel`) a gRPC channel with included credentials + # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object + # * (`nil`) indicating no credentials + # + # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials + # is deprecated. Providing an unvalidated credential configuration to + # Google APIs can compromise the security of your systems and data. + # + # @example + # + # # The recommended way to provide credentials is to use the `make_creds` method + # # on the appropriate credentials class for your environment. + # + # require "googleauth" + # + # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds( + # json_key_io: ::File.open("/path/to/keyfile.json") + # ) + # + # client = ::Google::Longrunning::Operations::Client.new do |config| + # config.credentials = credentials + # end + # + # @note Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] channel_args + # Extra parameters passed to the gRPC channel. Note: this is ignored if a + # `GRPC::Core::Channel` object is provided as the credential. + # @return [::Hash] + # @!attribute [rw] interceptors + # An array of interceptors that are run before calls are executed. + # @return [::Array<::GRPC::ClientInterceptor>] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional gRPC headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "retail.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) + config_attr :interceptors, nil, ::Array, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration for the channel pool + # @return [::Gapic::ServiceStub::ChannelPool::Configuration] + # + def channel_pool + @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new + end + + ## + # Configuration RPC class for the Operations API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `list_operations` + # @return [::Gapic::Config::Method] + # + attr_reader :list_operations + ## + # RPC-specific configuration for `get_operation` + # @return [::Gapic::Config::Method] + # + attr_reader :get_operation + ## + # RPC-specific configuration for `delete_operation` + # @return [::Gapic::Config::Method] + # + attr_reader :delete_operation + ## + # RPC-specific configuration for `cancel_operation` + # @return [::Gapic::Config::Method] + # + attr_reader :cancel_operation + ## + # RPC-specific configuration for `wait_operation` + # @return [::Gapic::Config::Method] + # + attr_reader :wait_operation + + # @private + def initialize parent_rpcs = nil + list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations + @list_operations = ::Gapic::Config::Method.new list_operations_config + get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation + @get_operation = ::Gapic::Config::Method.new get_operation_config + delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation + @delete_operation = ::Gapic::Config::Method.new delete_operation_config + cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation + @cancel_operation = ::Gapic::Config::Method.new cancel_operation_config + wait_operation_config = parent_rpcs.wait_operation if parent_rpcs.respond_to? :wait_operation + @wait_operation = ::Gapic::Config::Method.new wait_operation_config + + yield self if block_given? + end + end + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/paths.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/paths.rb new file mode 100644 index 000000000000..c0f4efbe2230 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/paths.rb @@ -0,0 +1,77 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Retail + module V2 + module ProductService + # Path helper methods for the ProductService API. + module Paths + ## + # Create a fully-qualified Branch resource string. + # + # The resource will be in the following format: + # + # `projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}` + # + # @param project [String] + # @param location [String] + # @param catalog [String] + # @param branch [String] + # + # @return [::String] + def branch_path project:, location:, catalog:, branch: + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" + raise ::ArgumentError, "catalog cannot contain /" if catalog.to_s.include? "/" + + "projects/#{project}/locations/#{location}/catalogs/#{catalog}/branches/#{branch}" + end + + ## + # Create a fully-qualified Product resource string. + # + # The resource will be in the following format: + # + # `projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}` + # + # @param project [String] + # @param location [String] + # @param catalog [String] + # @param branch [String] + # @param product [String] + # + # @return [::String] + def product_path project:, location:, catalog:, branch:, product: + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" + raise ::ArgumentError, "catalog cannot contain /" if catalog.to_s.include? "/" + raise ::ArgumentError, "branch cannot contain /" if branch.to_s.include? "/" + + "projects/#{project}/locations/#{location}/catalogs/#{catalog}/branches/#{branch}/products/#{product}" + end + + extend self + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/rest.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/rest.rb new file mode 100644 index 000000000000..1a50a1c1e9fd --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/rest.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/rest" +require "gapic/config" +require "gapic/config/method" + +require "google/cloud/retail/v2/version" + +require "google/cloud/retail/v2/product_service/credentials" +require "google/cloud/retail/v2/product_service/paths" +require "google/cloud/retail/v2/product_service/rest/operations" +require "google/cloud/retail/v2/product_service/rest/client" + +module Google + module Cloud + module Retail + module V2 + ## + # Service for ingesting {::Google::Cloud::Retail::V2::Product Product} information + # of the customer's website. + # + # To load this service and instantiate a REST client: + # + # require "google/cloud/retail/v2/product_service/rest" + # client = ::Google::Cloud::Retail::V2::ProductService::Rest::Client.new + # + module ProductService + # Client for the REST transport + module Rest + end + end + end + end + end +end + +helper_path = ::File.join __dir__, "rest", "helpers.rb" +require "google/cloud/retail/v2/product_service/rest/helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/rest/client.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/rest/client.rb new file mode 100644 index 000000000000..489f7e6ccebb --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/rest/client.rb @@ -0,0 +1,2112 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/cloud/retail/v2/product_service_pb" +require "google/cloud/retail/v2/product_service/rest/service_stub" +require "google/cloud/location/rest" + +module Google + module Cloud + module Retail + module V2 + module ProductService + module Rest + ## + # REST client for the ProductService service. + # + # Service for ingesting {::Google::Cloud::Retail::V2::Product Product} information + # of the customer's website. + # + class Client + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" + + include Paths + + # @private + attr_reader :product_service_stub + + ## + # Configure the ProductService Client class. + # + # See {::Google::Cloud::Retail::V2::ProductService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all ProductService clients + # ::Google::Cloud::Retail::V2::ProductService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "Retail", "V2"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config.timeout = 30.0 + default_config.retry_policy = { + initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [14, 4] + } + + default_config.rpcs.import_products.timeout = 300.0 + default_config.rpcs.import_products.retry_policy = { + initial_delay: 0.1, max_delay: 300.0, multiplier: 1.3, retry_codes: [14, 4] + } + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the ProductService Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Cloud::Retail::V2::ProductService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @product_service_stub.universe_domain + end + + ## + # Create a new ProductService REST client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::Retail::V2::ProductService::Rest::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::Retail::V2::ProductService::Rest::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the ProductService client. + # @yieldparam config [Client::Configuration] + # + def initialize + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @operations_client = ::Google::Cloud::Retail::V2::ProductService::Rest::Operations.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain + end + + @product_service_stub = ::Google::Cloud::Retail::V2::ProductService::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials, + logger: @config.logger + ) + + @product_service_stub.logger(stub: true)&.info do |entry| + entry.set_system_name + entry.set_service + entry.message = "Created client for #{entry.service}" + entry.set_credentials_fields credentials + entry.set "customEndpoint", @config.endpoint if @config.endpoint + entry.set "defaultTimeout", @config.timeout if @config.timeout + entry.set "quotaProject", @quota_project_id if @quota_project_id + end + + @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @product_service_stub.endpoint + config.universe_domain = @product_service_stub.universe_domain + config.logger = @product_service_stub.logger if config.respond_to? :logger= + end + end + + ## + # Get the associated client for long-running operations. + # + # @return [::Google::Cloud::Retail::V2::ProductService::Rest::Operations] + # + attr_reader :operations_client + + ## + # Get the associated client for mix-in of the Locations. + # + # @return [Google::Cloud::Location::Locations::Rest::Client] + # + attr_reader :location_client + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @product_service_stub.logger + end + + # Service calls + + ## + # Creates a {::Google::Cloud::Retail::V2::Product Product}. + # + # @overload create_product(request, options = nil) + # Pass arguments to `create_product` via a request object, either of type + # {::Google::Cloud::Retail::V2::CreateProductRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::CreateProductRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload create_product(parent: nil, product: nil, product_id: nil) + # Pass arguments to `create_product` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. The parent catalog resource name, such as + # `projects/*/locations/global/catalogs/default_catalog/branches/default_branch`. + # @param product [::Google::Cloud::Retail::V2::Product, ::Hash] + # Required. The {::Google::Cloud::Retail::V2::Product Product} to create. + # @param product_id [::String] + # Required. The ID to use for the {::Google::Cloud::Retail::V2::Product Product}, + # which will become the final component of the + # {::Google::Cloud::Retail::V2::Product#name Product.name}. + # + # If the caller does not have permission to create the + # {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it + # exists, a PERMISSION_DENIED error is returned. + # + # This field must be unique among all + # {::Google::Cloud::Retail::V2::Product Product}s with the same + # {::Google::Cloud::Retail::V2::CreateProductRequest#parent parent}. Otherwise, an + # ALREADY_EXISTS error is returned. + # + # This field must be a UTF-8 encoded string with a length limit of 128 + # characters. Otherwise, an INVALID_ARGUMENT error is returned. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::Product] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::Product] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ProductService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::CreateProductRequest.new + # + # # Call the create_product method. + # result = client.create_product request + # + # # The returned object is of type Google::Cloud::Retail::V2::Product. + # p result + # + def create_product request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::CreateProductRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.create_product.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.create_product.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.create_product.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @product_service_stub.create_product request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets a {::Google::Cloud::Retail::V2::Product Product}. + # + # @overload get_product(request, options = nil) + # Pass arguments to `get_product` via a request object, either of type + # {::Google::Cloud::Retail::V2::GetProductRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::GetProductRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload get_product(name: nil) + # Pass arguments to `get_product` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. Full resource name of {::Google::Cloud::Retail::V2::Product Product}, + # such as + # `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. + # + # If the caller does not have permission to access the + # {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it + # exists, a PERMISSION_DENIED error is returned. + # + # If the requested {::Google::Cloud::Retail::V2::Product Product} does not exist, + # a NOT_FOUND error is returned. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::Product] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::Product] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ProductService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::GetProductRequest.new + # + # # Call the get_product method. + # result = client.get_product request + # + # # The returned object is of type Google::Cloud::Retail::V2::Product. + # p result + # + def get_product request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::GetProductRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.get_product.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.get_product.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.get_product.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @product_service_stub.get_product request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets a list of {::Google::Cloud::Retail::V2::Product Product}s. + # + # @overload list_products(request, options = nil) + # Pass arguments to `list_products` via a request object, either of type + # {::Google::Cloud::Retail::V2::ListProductsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::ListProductsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload list_products(parent: nil, page_size: nil, page_token: nil, filter: nil, read_mask: nil) + # Pass arguments to `list_products` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. The parent branch resource name, such as + # `projects/*/locations/global/catalogs/default_catalog/branches/0`. Use + # `default_branch` as the branch ID, to list products under the default + # branch. + # + # If the caller does not have permission to list + # {::Google::Cloud::Retail::V2::Product Product}s under this branch, regardless of + # whether or not this branch exists, a PERMISSION_DENIED error is returned. + # @param page_size [::Integer] + # Maximum number of {::Google::Cloud::Retail::V2::Product Product}s to return. If + # unspecified, defaults to 100. The maximum allowed value is 1000. Values + # above 1000 will be coerced to 1000. + # + # If this field is negative, an INVALID_ARGUMENT error is returned. + # @param page_token [::String] + # A page token + # {::Google::Cloud::Retail::V2::ListProductsResponse#next_page_token ListProductsResponse.next_page_token}, + # received from a previous + # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#list_products ProductService.ListProducts} + # call. Provide this to retrieve the subsequent page. + # + # When paginating, all other parameters provided to + # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#list_products ProductService.ListProducts} + # must match the call that provided the page token. Otherwise, an + # INVALID_ARGUMENT error is returned. + # @param filter [::String] + # A filter to apply on the list results. Supported features: + # + # * List all the products under the parent branch if + # {::Google::Cloud::Retail::V2::ListProductsRequest#filter filter} is unset. + # * List {::Google::Cloud::Retail::V2::Product::Type::VARIANT Product.Type.VARIANT} + # {::Google::Cloud::Retail::V2::Product Product}s sharing the same + # {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Product.Type.PRIMARY} + # {::Google::Cloud::Retail::V2::Product Product}. For example: + # `primary_product_id = "some_product_id"` + # * List {::Google::Cloud::Retail::V2::Product Product}s bundled in a + # {::Google::Cloud::Retail::V2::Product::Type::COLLECTION Product.Type.COLLECTION} + # {::Google::Cloud::Retail::V2::Product Product}. + # For example: + # `collection_product_id = "some_product_id"` + # * List {::Google::Cloud::Retail::V2::Product Product}s with a partibular type. + # For example: + # `type = "PRIMARY"` + # `type = "VARIANT"` + # `type = "COLLECTION"` + # + # If the field is unrecognizable, an INVALID_ARGUMENT error is returned. + # + # If the specified + # {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Product.Type.PRIMARY} + # {::Google::Cloud::Retail::V2::Product Product} or + # {::Google::Cloud::Retail::V2::Product::Type::COLLECTION Product.Type.COLLECTION} + # {::Google::Cloud::Retail::V2::Product Product} does not exist, a NOT_FOUND error + # is returned. + # @param read_mask [::Google::Protobuf::FieldMask, ::Hash] + # The fields of {::Google::Cloud::Retail::V2::Product Product} to return in the + # responses. If not set or empty, the following fields are returned: + # + # * {::Google::Cloud::Retail::V2::Product#name Product.name} + # * {::Google::Cloud::Retail::V2::Product#id Product.id} + # * {::Google::Cloud::Retail::V2::Product#title Product.title} + # * {::Google::Cloud::Retail::V2::Product#uri Product.uri} + # * {::Google::Cloud::Retail::V2::Product#images Product.images} + # * {::Google::Cloud::Retail::V2::Product#price_info Product.price_info} + # * {::Google::Cloud::Retail::V2::Product#brands Product.brands} + # + # If "*" is provided, all fields are returned. + # {::Google::Cloud::Retail::V2::Product#name Product.name} is always returned no + # matter what mask is set. + # + # If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + # is returned. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Retail::V2::Product>] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Retail::V2::Product>] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ProductService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::ListProductsRequest.new + # + # # Call the list_products method. + # result = client.list_products request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Cloud::Retail::V2::Product. + # p item + # end + # + def list_products request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ListProductsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.list_products.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.list_products.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.list_products.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @product_service_stub.list_products request, options do |result, operation| + result = ::Gapic::Rest::PagedEnumerable.new @product_service_stub, :list_products, "products", request, result, options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Updates a {::Google::Cloud::Retail::V2::Product Product}. + # + # @overload update_product(request, options = nil) + # Pass arguments to `update_product` via a request object, either of type + # {::Google::Cloud::Retail::V2::UpdateProductRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::UpdateProductRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload update_product(product: nil, update_mask: nil, allow_missing: nil) + # Pass arguments to `update_product` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param product [::Google::Cloud::Retail::V2::Product, ::Hash] + # Required. The product to update/create. + # + # If the caller does not have permission to update the + # {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it + # exists, a PERMISSION_DENIED error is returned. + # + # If the {::Google::Cloud::Retail::V2::Product Product} to update does not exist + # and + # {::Google::Cloud::Retail::V2::UpdateProductRequest#allow_missing allow_missing} + # is not set, a NOT_FOUND error is returned. + # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] + # Indicates which fields in the provided + # {::Google::Cloud::Retail::V2::Product Product} to update. The immutable and + # output only fields are NOT supported. If not set, all supported fields (the + # fields that are neither immutable nor output only) are updated. + # + # If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + # is returned. + # + # The attribute key can be updated by setting the mask path as + # "attributes.$\\{key_name}". If a key name is present in the mask but not in + # the patching product from the request, this key will be deleted after the + # update. + # @param allow_missing [::Boolean] + # If set to true, and the {::Google::Cloud::Retail::V2::Product Product} is not + # found, a new {::Google::Cloud::Retail::V2::Product Product} will be created. In + # this situation, `update_mask` is ignored. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::Product] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::Product] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ProductService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::UpdateProductRequest.new + # + # # Call the update_product method. + # result = client.update_product request + # + # # The returned object is of type Google::Cloud::Retail::V2::Product. + # p result + # + def update_product request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::UpdateProductRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.update_product.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.update_product.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.update_product.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @product_service_stub.update_product request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Deletes a {::Google::Cloud::Retail::V2::Product Product}. + # + # @overload delete_product(request, options = nil) + # Pass arguments to `delete_product` via a request object, either of type + # {::Google::Cloud::Retail::V2::DeleteProductRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::DeleteProductRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload delete_product(name: nil) + # Pass arguments to `delete_product` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. Full resource name of {::Google::Cloud::Retail::V2::Product Product}, + # such as + # `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. + # + # If the caller does not have permission to delete the + # {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it + # exists, a PERMISSION_DENIED error is returned. + # + # If the {::Google::Cloud::Retail::V2::Product Product} to delete does not exist, + # a NOT_FOUND error is returned. + # + # The {::Google::Cloud::Retail::V2::Product Product} to delete can neither be a + # {::Google::Cloud::Retail::V2::Product::Type::COLLECTION Product.Type.COLLECTION} + # {::Google::Cloud::Retail::V2::Product Product} member nor a + # {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Product.Type.PRIMARY} + # {::Google::Cloud::Retail::V2::Product Product} with more than one + # {::Google::Cloud::Retail::V2::Product::Type::VARIANT variants}. Otherwise, an + # INVALID_ARGUMENT error is returned. + # + # All inventory information for the named + # {::Google::Cloud::Retail::V2::Product Product} will be deleted. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Protobuf::Empty] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Protobuf::Empty] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ProductService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::DeleteProductRequest.new + # + # # Call the delete_product method. + # result = client.delete_product request + # + # # The returned object is of type Google::Protobuf::Empty. + # p result + # + def delete_product request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::DeleteProductRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.delete_product.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.delete_product.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.delete_product.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @product_service_stub.delete_product request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Permanently deletes all selected {::Google::Cloud::Retail::V2::Product Product}s + # under a branch. + # + # This process is asynchronous. If the request is valid, the removal will be + # enqueued and processed offline. Depending on the number of + # {::Google::Cloud::Retail::V2::Product Product}s, this operation could take hours + # to complete. Before the operation completes, some + # {::Google::Cloud::Retail::V2::Product Product}s may still be returned by + # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#get_product ProductService.GetProduct} + # or + # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#list_products ProductService.ListProducts}. + # + # Depending on the number of {::Google::Cloud::Retail::V2::Product Product}s, this + # operation could take hours to complete. To get a sample of + # {::Google::Cloud::Retail::V2::Product Product}s that would be deleted, set + # {::Google::Cloud::Retail::V2::PurgeProductsRequest#force PurgeProductsRequest.force} + # to false. + # + # @overload purge_products(request, options = nil) + # Pass arguments to `purge_products` via a request object, either of type + # {::Google::Cloud::Retail::V2::PurgeProductsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::PurgeProductsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload purge_products(parent: nil, filter: nil, force: nil) + # Pass arguments to `purge_products` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. The resource name of the branch under which the products are + # created. The format is + # `projects/${projectId}/locations/global/catalogs/${catalogId}/branches/${branchId}` + # @param filter [::String] + # Required. The filter string to specify the products to be deleted with a + # length limit of 5,000 characters. + # + # Empty string filter is not allowed. "*" implies delete all items in a + # branch. + # + # The eligible fields for filtering are: + # + # * `availability`: Double quoted + # {::Google::Cloud::Retail::V2::Product#availability Product.availability} string. + # * `create_time` : in ISO 8601 "zulu" format. + # + # Supported syntax: + # + # * Comparators (">", "<", ">=", "<=", "="). + # Examples: + # * create_time <= "2015-02-13T17:05:46Z" + # * availability = "IN_STOCK" + # + # * Conjunctions ("AND") + # Examples: + # * create_time <= "2015-02-13T17:05:46Z" AND availability = "PREORDER" + # + # * Disjunctions ("OR") + # Examples: + # * create_time <= "2015-02-13T17:05:46Z" OR availability = "IN_STOCK" + # + # * Can support nested queries. + # Examples: + # * (create_time <= "2015-02-13T17:05:46Z" AND availability = "PREORDER") + # OR (create_time >= "2015-02-14T13:03:32Z" AND availability = "IN_STOCK") + # + # * Filter Limits: + # * Filter should not contain more than 6 conditions. + # * Max nesting depth should not exceed 2 levels. + # + # Examples queries: + # * Delete back order products created before a timestamp. + # create_time <= "2015-02-13T17:05:46Z" OR availability = "BACKORDER" + # @param force [::Boolean] + # Actually perform the purge. + # If `force` is set to false, the method will return the expected purge count + # without deleting any products. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ProductService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::PurgeProductsRequest.new + # + # # Call the purge_products method. + # result = client.purge_products request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def purge_products request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::PurgeProductsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.purge_products.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.purge_products.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.purge_products.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @product_service_stub.purge_products request, options do |result, operation| + result = ::Gapic::Operation.new result, @operations_client, options: options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Bulk import of multiple {::Google::Cloud::Retail::V2::Product Product}s. + # + # Request processing may be synchronous. + # Non-existing items are created. + # + # Note that it is possible for a subset of the + # {::Google::Cloud::Retail::V2::Product Product}s to be successfully updated. + # + # @overload import_products(request, options = nil) + # Pass arguments to `import_products` via a request object, either of type + # {::Google::Cloud::Retail::V2::ImportProductsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::ImportProductsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload import_products(parent: nil, request_id: nil, input_config: nil, errors_config: nil, update_mask: nil, reconciliation_mode: nil, notification_pubsub_topic: nil) + # Pass arguments to `import_products` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. + # `projects/1234/locations/global/catalogs/default_catalog/branches/default_branch` + # + # If no updateMask is specified, requires products.create permission. + # If updateMask is specified, requires products.update permission. + # @param request_id [::String] + # Deprecated. This field has no effect. + # @param input_config [::Google::Cloud::Retail::V2::ProductInputConfig, ::Hash] + # Required. The desired input location of the data. + # @param errors_config [::Google::Cloud::Retail::V2::ImportErrorsConfig, ::Hash] + # The desired location of errors incurred during the Import. + # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] + # Indicates which fields in the provided imported `products` to update. If + # not set, all fields are updated. If provided, only the existing product + # fields are updated. Missing products will not be created. + # @param reconciliation_mode [::Google::Cloud::Retail::V2::ImportProductsRequest::ReconciliationMode] + # The mode of reconciliation between existing products and the products to be + # imported. Defaults to + # {::Google::Cloud::Retail::V2::ImportProductsRequest::ReconciliationMode::INCREMENTAL ReconciliationMode.INCREMENTAL}. + # @param notification_pubsub_topic [::String] + # Full Pub/Sub topic name for receiving notification. If this field is set, + # when the import is finished, a notification is sent to + # specified Pub/Sub topic. The message data is JSON string of a + # {::Google::Longrunning::Operation Operation}. + # + # Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. It has + # to be within the same project as + # {::Google::Cloud::Retail::V2::ImportProductsRequest#parent ImportProductsRequest.parent}. + # Make sure that both + # `cloud-retail-customer-data-access@system.gserviceaccount.com` and + # `service-@gcp-sa-retail.iam.gserviceaccount.com` + # have the `pubsub.topics.publish` IAM permission on the topic. + # + # Only supported when + # {::Google::Cloud::Retail::V2::ImportProductsRequest#reconciliation_mode ImportProductsRequest.reconciliation_mode} + # is set to `FULL`. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ProductService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::ImportProductsRequest.new + # + # # Call the import_products method. + # result = client.import_products request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def import_products request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ImportProductsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.import_products.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.import_products.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.import_products.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @product_service_stub.import_products request, options do |result, operation| + result = ::Gapic::Operation.new result, @operations_client, options: options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Updates inventory information for a + # {::Google::Cloud::Retail::V2::Product Product} while respecting the last update + # timestamps of each inventory field. + # + # This process is asynchronous and does not require the + # {::Google::Cloud::Retail::V2::Product Product} to exist before updating + # fulfillment information. If the request is valid, the update is enqueued + # and processed downstream. As a consequence, when a response is returned, + # updates are not immediately manifested in the + # {::Google::Cloud::Retail::V2::Product Product} queried by + # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#get_product ProductService.GetProduct} + # or + # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#list_products ProductService.ListProducts}. + # + # When inventory is updated with + # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#create_product ProductService.CreateProduct} + # and + # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#update_product ProductService.UpdateProduct}, + # the specified inventory field value(s) overwrite any existing value(s) + # while ignoring the last update time for this field. Furthermore, the last + # update times for the specified inventory fields are overwritten by the + # times of the + # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#create_product ProductService.CreateProduct} + # or + # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#update_product ProductService.UpdateProduct} + # request. + # + # If no inventory fields are set in + # {::Google::Cloud::Retail::V2::CreateProductRequest#product CreateProductRequest.product}, + # then any pre-existing inventory information for this product is used. + # + # If no inventory fields are set in + # {::Google::Cloud::Retail::V2::SetInventoryRequest#set_mask SetInventoryRequest.set_mask}, + # then any existing inventory information is preserved. + # + # Pre-existing inventory information can only be updated with + # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#set_inventory ProductService.SetInventory}, + # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#add_fulfillment_places ProductService.AddFulfillmentPlaces}, + # and + # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#remove_fulfillment_places ProductService.RemoveFulfillmentPlaces}. + # + # The returned {::Google::Longrunning::Operation Operation}s is obsolete after + # one day, and the GetOperation + # API returns `NOT_FOUND` afterwards. + # + # If conflicting updates are issued, the + # {::Google::Longrunning::Operation Operation}s associated with the stale + # updates are not marked as {::Google::Longrunning::Operation#done done} until + # they are obsolete. + # + # @overload set_inventory(request, options = nil) + # Pass arguments to `set_inventory` via a request object, either of type + # {::Google::Cloud::Retail::V2::SetInventoryRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::SetInventoryRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload set_inventory(inventory: nil, set_mask: nil, set_time: nil, allow_missing: nil) + # Pass arguments to `set_inventory` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param inventory [::Google::Cloud::Retail::V2::Product, ::Hash] + # Required. The inventory information to update. The allowable fields to + # update are: + # + # * {::Google::Cloud::Retail::V2::Product#price_info Product.price_info} + # * {::Google::Cloud::Retail::V2::Product#availability Product.availability} + # * {::Google::Cloud::Retail::V2::Product#available_quantity Product.available_quantity} + # * {::Google::Cloud::Retail::V2::Product#fulfillment_info Product.fulfillment_info} + # The updated inventory fields must be specified in + # {::Google::Cloud::Retail::V2::SetInventoryRequest#set_mask SetInventoryRequest.set_mask}. + # + # If + # {::Google::Cloud::Retail::V2::Product#name SetInventoryRequest.inventory.name} + # is empty or invalid, an INVALID_ARGUMENT error is returned. + # + # If the caller does not have permission to update the + # {::Google::Cloud::Retail::V2::Product Product} named in + # {::Google::Cloud::Retail::V2::Product#name Product.name}, regardless of whether + # or not it exists, a PERMISSION_DENIED error is returned. + # + # If the {::Google::Cloud::Retail::V2::Product Product} to update does not have + # existing inventory information, the provided inventory information will be + # inserted. + # + # If the {::Google::Cloud::Retail::V2::Product Product} to update has existing + # inventory information, the provided inventory information will be merged + # while respecting the last update time for each inventory field, using the + # provided or default value for + # {::Google::Cloud::Retail::V2::SetInventoryRequest#set_time SetInventoryRequest.set_time}. + # + # The caller can replace place IDs for a subset of fulfillment types in the + # following ways: + # + # * Adds "fulfillment_info" in + # {::Google::Cloud::Retail::V2::SetInventoryRequest#set_mask SetInventoryRequest.set_mask} + # * Specifies only the desired fulfillment types and corresponding place IDs + # to update in + # {::Google::Cloud::Retail::V2::Product#fulfillment_info SetInventoryRequest.inventory.fulfillment_info} + # + # The caller can clear all place IDs from a subset of fulfillment types in + # the following ways: + # + # * Adds "fulfillment_info" in + # {::Google::Cloud::Retail::V2::SetInventoryRequest#set_mask SetInventoryRequest.set_mask} + # * Specifies only the desired fulfillment types to clear in + # {::Google::Cloud::Retail::V2::Product#fulfillment_info SetInventoryRequest.inventory.fulfillment_info} + # * Checks that only the desired fulfillment info types have empty + # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids SetInventoryRequest.inventory.fulfillment_info.place_ids} + # + # The last update time is recorded for the following inventory fields: + # * {::Google::Cloud::Retail::V2::Product#price_info Product.price_info} + # * {::Google::Cloud::Retail::V2::Product#availability Product.availability} + # * {::Google::Cloud::Retail::V2::Product#available_quantity Product.available_quantity} + # * {::Google::Cloud::Retail::V2::Product#fulfillment_info Product.fulfillment_info} + # + # If a full overwrite of inventory information while ignoring timestamps is + # needed, + # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#update_product ProductService.UpdateProduct} + # should be invoked instead. + # @param set_mask [::Google::Protobuf::FieldMask, ::Hash] + # Indicates which inventory fields in the provided + # {::Google::Cloud::Retail::V2::Product Product} to update. + # + # At least one field must be provided. + # + # If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + # is returned and the entire update will be ignored. + # @param set_time [::Google::Protobuf::Timestamp, ::Hash] + # The time when the request is issued, used to prevent + # out-of-order updates on inventory fields with the last update time + # recorded. If not provided, the internal system time will be used. + # @param allow_missing [::Boolean] + # If set to true, and the {::Google::Cloud::Retail::V2::Product Product} with name + # {::Google::Cloud::Retail::V2::Product#name Product.name} is not found, the + # inventory update will still be processed and retained for at most 1 day + # until the {::Google::Cloud::Retail::V2::Product Product} is created. If set to + # false, a NOT_FOUND error is returned if the + # {::Google::Cloud::Retail::V2::Product Product} is not found. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ProductService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::SetInventoryRequest.new + # + # # Call the set_inventory method. + # result = client.set_inventory request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def set_inventory request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::SetInventoryRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.set_inventory.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.set_inventory.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.set_inventory.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @product_service_stub.set_inventory request, options do |result, operation| + result = ::Gapic::Operation.new result, @operations_client, options: options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # We recommend that you use the + # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#add_local_inventories ProductService.AddLocalInventories} + # method instead of the + # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#add_fulfillment_places ProductService.AddFulfillmentPlaces} + # method. + # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#add_local_inventories ProductService.AddLocalInventories} + # achieves the same results but provides more fine-grained control over + # ingesting local inventory data. + # + # Incrementally adds place IDs to + # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids Product.fulfillment_info.place_ids}. + # + # This process is asynchronous and does not require the + # {::Google::Cloud::Retail::V2::Product Product} to exist before updating + # fulfillment information. If the request is valid, the update will be + # enqueued and processed downstream. As a consequence, when a response is + # returned, the added place IDs are not immediately manifested in the + # {::Google::Cloud::Retail::V2::Product Product} queried by + # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#get_product ProductService.GetProduct} + # or + # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#list_products ProductService.ListProducts}. + # + # The returned {::Google::Longrunning::Operation Operation}s will be obsolete + # after 1 day, and GetOperation + # API will return NOT_FOUND afterwards. + # + # If conflicting updates are issued, the + # {::Google::Longrunning::Operation Operation}s associated with the stale + # updates will not be marked as {::Google::Longrunning::Operation#done done} + # until being obsolete. + # + # @overload add_fulfillment_places(request, options = nil) + # Pass arguments to `add_fulfillment_places` via a request object, either of type + # {::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload add_fulfillment_places(product: nil, type: nil, place_ids: nil, add_time: nil, allow_missing: nil) + # Pass arguments to `add_fulfillment_places` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param product [::String] + # Required. Full resource name of {::Google::Cloud::Retail::V2::Product Product}, + # such as + # `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. + # + # If the caller does not have permission to access the + # {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it + # exists, a PERMISSION_DENIED error is returned. + # @param type [::String] + # Required. The fulfillment type, including commonly used types (such as + # pickup in store and same day delivery), and custom types. + # + # Supported values: + # + # * "pickup-in-store" + # * "ship-to-store" + # * "same-day-delivery" + # * "next-day-delivery" + # * "custom-type-1" + # * "custom-type-2" + # * "custom-type-3" + # * "custom-type-4" + # * "custom-type-5" + # + # If this field is set to an invalid value other than these, an + # INVALID_ARGUMENT error is returned. + # + # This field directly corresponds to + # {::Google::Cloud::Retail::V2::FulfillmentInfo#type Product.fulfillment_info.type}. + # @param place_ids [::Array<::String>] + # Required. The IDs for this + # {::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest#type type}, such as + # the store IDs for "pickup-in-store" or the region IDs for + # "same-day-delivery" to be added for this + # {::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest#type type}. Duplicate + # IDs will be automatically ignored. + # + # At least 1 value is required, and a maximum of 2000 values are allowed. + # Each value must be a string with a length limit of 10 characters, matching + # the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an + # INVALID_ARGUMENT error is returned. + # + # If the total number of place IDs exceeds 2000 for this + # {::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest#type type} after + # adding, then the update will be rejected. + # @param add_time [::Google::Protobuf::Timestamp, ::Hash] + # The time when the fulfillment updates are issued, used to prevent + # out-of-order updates on fulfillment information. If not provided, the + # internal system time will be used. + # @param allow_missing [::Boolean] + # If set to true, and the {::Google::Cloud::Retail::V2::Product Product} is not + # found, the fulfillment information will still be processed and retained for + # at most 1 day and processed once the + # {::Google::Cloud::Retail::V2::Product Product} is created. If set to false, a + # NOT_FOUND error is returned if the + # {::Google::Cloud::Retail::V2::Product Product} is not found. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ProductService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest.new + # + # # Call the add_fulfillment_places method. + # result = client.add_fulfillment_places request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def add_fulfillment_places request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.add_fulfillment_places.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.add_fulfillment_places.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.add_fulfillment_places.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @product_service_stub.add_fulfillment_places request, options do |result, operation| + result = ::Gapic::Operation.new result, @operations_client, options: options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # We recommend that you use the + # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#remove_local_inventories ProductService.RemoveLocalInventories} + # method instead of the + # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#remove_fulfillment_places ProductService.RemoveFulfillmentPlaces} + # method. + # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#remove_local_inventories ProductService.RemoveLocalInventories} + # achieves the same results but provides more fine-grained control over + # ingesting local inventory data. + # + # Incrementally removes place IDs from a + # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids Product.fulfillment_info.place_ids}. + # + # This process is asynchronous and does not require the + # {::Google::Cloud::Retail::V2::Product Product} to exist before updating + # fulfillment information. If the request is valid, the update will be + # enqueued and processed downstream. As a consequence, when a response is + # returned, the removed place IDs are not immediately manifested in the + # {::Google::Cloud::Retail::V2::Product Product} queried by + # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#get_product ProductService.GetProduct} + # or + # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#list_products ProductService.ListProducts}. + # + # The returned {::Google::Longrunning::Operation Operation}s will be obsolete + # after 1 day, and GetOperation + # API will return NOT_FOUND afterwards. + # + # If conflicting updates are issued, the + # {::Google::Longrunning::Operation Operation}s associated with the stale + # updates will not be marked as {::Google::Longrunning::Operation#done done} + # until being obsolete. + # + # @overload remove_fulfillment_places(request, options = nil) + # Pass arguments to `remove_fulfillment_places` via a request object, either of type + # {::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload remove_fulfillment_places(product: nil, type: nil, place_ids: nil, remove_time: nil, allow_missing: nil) + # Pass arguments to `remove_fulfillment_places` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param product [::String] + # Required. Full resource name of {::Google::Cloud::Retail::V2::Product Product}, + # such as + # `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. + # + # If the caller does not have permission to access the + # {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it + # exists, a PERMISSION_DENIED error is returned. + # @param type [::String] + # Required. The fulfillment type, including commonly used types (such as + # pickup in store and same day delivery), and custom types. + # + # Supported values: + # + # * "pickup-in-store" + # * "ship-to-store" + # * "same-day-delivery" + # * "next-day-delivery" + # * "custom-type-1" + # * "custom-type-2" + # * "custom-type-3" + # * "custom-type-4" + # * "custom-type-5" + # + # If this field is set to an invalid value other than these, an + # INVALID_ARGUMENT error is returned. + # + # This field directly corresponds to + # {::Google::Cloud::Retail::V2::FulfillmentInfo#type Product.fulfillment_info.type}. + # @param place_ids [::Array<::String>] + # Required. The IDs for this + # {::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest#type type}, such as + # the store IDs for "pickup-in-store" or the region IDs for + # "same-day-delivery", to be removed for this + # {::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest#type type}. + # + # At least 1 value is required, and a maximum of 2000 values are allowed. + # Each value must be a string with a length limit of 10 characters, matching + # the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an + # INVALID_ARGUMENT error is returned. + # @param remove_time [::Google::Protobuf::Timestamp, ::Hash] + # The time when the fulfillment updates are issued, used to prevent + # out-of-order updates on fulfillment information. If not provided, the + # internal system time will be used. + # @param allow_missing [::Boolean] + # If set to true, and the {::Google::Cloud::Retail::V2::Product Product} is not + # found, the fulfillment information will still be processed and retained for + # at most 1 day and processed once the + # {::Google::Cloud::Retail::V2::Product Product} is created. If set to false, a + # NOT_FOUND error is returned if the + # {::Google::Cloud::Retail::V2::Product Product} is not found. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ProductService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest.new + # + # # Call the remove_fulfillment_places method. + # result = client.remove_fulfillment_places request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def remove_fulfillment_places request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.remove_fulfillment_places.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.remove_fulfillment_places.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.remove_fulfillment_places.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @product_service_stub.remove_fulfillment_places request, options do |result, operation| + result = ::Gapic::Operation.new result, @operations_client, options: options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Updates local inventory information for a + # {::Google::Cloud::Retail::V2::Product Product} at a list of places, while + # respecting the last update timestamps of each inventory field. + # + # This process is asynchronous and does not require the + # {::Google::Cloud::Retail::V2::Product Product} to exist before updating + # inventory information. If the request is valid, the update will be enqueued + # and processed downstream. As a consequence, when a response is returned, + # updates are not immediately manifested in the + # {::Google::Cloud::Retail::V2::Product Product} queried by + # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#get_product ProductService.GetProduct} + # or + # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#list_products ProductService.ListProducts}. + # + # Local inventory information can only be modified using this method. + # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#create_product ProductService.CreateProduct} + # and + # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#update_product ProductService.UpdateProduct} + # has no effect on local inventories. + # + # The returned {::Google::Longrunning::Operation Operation}s will be obsolete + # after 1 day, and GetOperation + # API will return NOT_FOUND afterwards. + # + # If conflicting updates are issued, the + # {::Google::Longrunning::Operation Operation}s associated with the stale + # updates will not be marked as {::Google::Longrunning::Operation#done done} + # until being obsolete. + # + # @overload add_local_inventories(request, options = nil) + # Pass arguments to `add_local_inventories` via a request object, either of type + # {::Google::Cloud::Retail::V2::AddLocalInventoriesRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::AddLocalInventoriesRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload add_local_inventories(product: nil, local_inventories: nil, add_mask: nil, add_time: nil, allow_missing: nil) + # Pass arguments to `add_local_inventories` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param product [::String] + # Required. Full resource name of {::Google::Cloud::Retail::V2::Product Product}, + # such as + # `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. + # + # If the caller does not have permission to access the + # {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it + # exists, a PERMISSION_DENIED error is returned. + # @param local_inventories [::Array<::Google::Cloud::Retail::V2::LocalInventory, ::Hash>] + # Required. A list of inventory information at difference places. Each place + # is identified by its place ID. At most 3000 inventories are allowed per + # request. + # @param add_mask [::Google::Protobuf::FieldMask, ::Hash] + # Indicates which inventory fields in the provided list of + # {::Google::Cloud::Retail::V2::LocalInventory LocalInventory} to update. The + # field is updated to the provided value. + # + # If a field is set while the place does not have a previous local inventory, + # the local inventory at that store is created. + # + # If a field is set while the value of that field is not provided, the + # original field value, if it exists, is deleted. + # + # If the mask is not set or set with empty paths, all inventory fields will + # be updated. + # + # If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + # is returned and the entire update will be ignored. + # @param add_time [::Google::Protobuf::Timestamp, ::Hash] + # The time when the inventory updates are issued. Used to prevent + # out-of-order updates on local inventory fields. If not provided, the + # internal system time will be used. + # @param allow_missing [::Boolean] + # If set to true, and the {::Google::Cloud::Retail::V2::Product Product} is not + # found, the local inventory will still be processed and retained for at most + # 1 day and processed once the {::Google::Cloud::Retail::V2::Product Product} is + # created. If set to false, a NOT_FOUND error is returned if the + # {::Google::Cloud::Retail::V2::Product Product} is not found. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ProductService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::AddLocalInventoriesRequest.new + # + # # Call the add_local_inventories method. + # result = client.add_local_inventories request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def add_local_inventories request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::AddLocalInventoriesRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.add_local_inventories.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.add_local_inventories.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.add_local_inventories.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @product_service_stub.add_local_inventories request, options do |result, operation| + result = ::Gapic::Operation.new result, @operations_client, options: options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Remove local inventory information for a + # {::Google::Cloud::Retail::V2::Product Product} at a list of places at a removal + # timestamp. + # + # This process is asynchronous. If the request is valid, the removal will be + # enqueued and processed downstream. As a consequence, when a response is + # returned, removals are not immediately manifested in the + # {::Google::Cloud::Retail::V2::Product Product} queried by + # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#get_product ProductService.GetProduct} + # or + # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#list_products ProductService.ListProducts}. + # + # Local inventory information can only be removed using this method. + # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#create_product ProductService.CreateProduct} + # and + # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#update_product ProductService.UpdateProduct} + # has no effect on local inventories. + # + # The returned {::Google::Longrunning::Operation Operation}s will be obsolete + # after 1 day, and GetOperation + # API will return NOT_FOUND afterwards. + # + # If conflicting updates are issued, the + # {::Google::Longrunning::Operation Operation}s associated with the stale + # updates will not be marked as {::Google::Longrunning::Operation#done done} + # until being obsolete. + # + # @overload remove_local_inventories(request, options = nil) + # Pass arguments to `remove_local_inventories` via a request object, either of type + # {::Google::Cloud::Retail::V2::RemoveLocalInventoriesRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::RemoveLocalInventoriesRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload remove_local_inventories(product: nil, place_ids: nil, remove_time: nil, allow_missing: nil) + # Pass arguments to `remove_local_inventories` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param product [::String] + # Required. Full resource name of {::Google::Cloud::Retail::V2::Product Product}, + # such as + # `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. + # + # If the caller does not have permission to access the + # {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it + # exists, a PERMISSION_DENIED error is returned. + # @param place_ids [::Array<::String>] + # Required. A list of place IDs to have their inventory deleted. + # At most 3000 place IDs are allowed per request. + # @param remove_time [::Google::Protobuf::Timestamp, ::Hash] + # The time when the inventory deletions are issued. Used to prevent + # out-of-order updates and deletions on local inventory fields. If not + # provided, the internal system time will be used. + # @param allow_missing [::Boolean] + # If set to true, and the {::Google::Cloud::Retail::V2::Product Product} is not + # found, the local inventory removal request will still be processed and + # retained for at most 1 day and processed once the + # {::Google::Cloud::Retail::V2::Product Product} is created. If set to false, a + # NOT_FOUND error is returned if the + # {::Google::Cloud::Retail::V2::Product Product} is not found. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ProductService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::RemoveLocalInventoriesRequest.new + # + # # Call the remove_local_inventories method. + # result = client.remove_local_inventories request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def remove_local_inventories request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::RemoveLocalInventoriesRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.remove_local_inventories.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.remove_local_inventories.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.remove_local_inventories.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @product_service_stub.remove_local_inventories request, options do |result, operation| + result = ::Gapic::Operation.new result, @operations_client, options: options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the ProductService REST API. + # + # This class represents the configuration for ProductService REST, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::Retail::V2::ProductService::Rest::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # create_product to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Retail::V2::ProductService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.create_product.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Retail::V2::ProductService::Rest::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.create_product.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`String`) The path to a service account key file in JSON format + # * (`Hash`) A service account key as a Hash + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`nil`) indicating no credentials + # + # Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "retail.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration RPC class for the ProductService API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `create_product` + # @return [::Gapic::Config::Method] + # + attr_reader :create_product + ## + # RPC-specific configuration for `get_product` + # @return [::Gapic::Config::Method] + # + attr_reader :get_product + ## + # RPC-specific configuration for `list_products` + # @return [::Gapic::Config::Method] + # + attr_reader :list_products + ## + # RPC-specific configuration for `update_product` + # @return [::Gapic::Config::Method] + # + attr_reader :update_product + ## + # RPC-specific configuration for `delete_product` + # @return [::Gapic::Config::Method] + # + attr_reader :delete_product + ## + # RPC-specific configuration for `purge_products` + # @return [::Gapic::Config::Method] + # + attr_reader :purge_products + ## + # RPC-specific configuration for `import_products` + # @return [::Gapic::Config::Method] + # + attr_reader :import_products + ## + # RPC-specific configuration for `set_inventory` + # @return [::Gapic::Config::Method] + # + attr_reader :set_inventory + ## + # RPC-specific configuration for `add_fulfillment_places` + # @return [::Gapic::Config::Method] + # + attr_reader :add_fulfillment_places + ## + # RPC-specific configuration for `remove_fulfillment_places` + # @return [::Gapic::Config::Method] + # + attr_reader :remove_fulfillment_places + ## + # RPC-specific configuration for `add_local_inventories` + # @return [::Gapic::Config::Method] + # + attr_reader :add_local_inventories + ## + # RPC-specific configuration for `remove_local_inventories` + # @return [::Gapic::Config::Method] + # + attr_reader :remove_local_inventories + + # @private + def initialize parent_rpcs = nil + create_product_config = parent_rpcs.create_product if parent_rpcs.respond_to? :create_product + @create_product = ::Gapic::Config::Method.new create_product_config + get_product_config = parent_rpcs.get_product if parent_rpcs.respond_to? :get_product + @get_product = ::Gapic::Config::Method.new get_product_config + list_products_config = parent_rpcs.list_products if parent_rpcs.respond_to? :list_products + @list_products = ::Gapic::Config::Method.new list_products_config + update_product_config = parent_rpcs.update_product if parent_rpcs.respond_to? :update_product + @update_product = ::Gapic::Config::Method.new update_product_config + delete_product_config = parent_rpcs.delete_product if parent_rpcs.respond_to? :delete_product + @delete_product = ::Gapic::Config::Method.new delete_product_config + purge_products_config = parent_rpcs.purge_products if parent_rpcs.respond_to? :purge_products + @purge_products = ::Gapic::Config::Method.new purge_products_config + import_products_config = parent_rpcs.import_products if parent_rpcs.respond_to? :import_products + @import_products = ::Gapic::Config::Method.new import_products_config + set_inventory_config = parent_rpcs.set_inventory if parent_rpcs.respond_to? :set_inventory + @set_inventory = ::Gapic::Config::Method.new set_inventory_config + add_fulfillment_places_config = parent_rpcs.add_fulfillment_places if parent_rpcs.respond_to? :add_fulfillment_places + @add_fulfillment_places = ::Gapic::Config::Method.new add_fulfillment_places_config + remove_fulfillment_places_config = parent_rpcs.remove_fulfillment_places if parent_rpcs.respond_to? :remove_fulfillment_places + @remove_fulfillment_places = ::Gapic::Config::Method.new remove_fulfillment_places_config + add_local_inventories_config = parent_rpcs.add_local_inventories if parent_rpcs.respond_to? :add_local_inventories + @add_local_inventories = ::Gapic::Config::Method.new add_local_inventories_config + remove_local_inventories_config = parent_rpcs.remove_local_inventories if parent_rpcs.respond_to? :remove_local_inventories + @remove_local_inventories = ::Gapic::Config::Method.new remove_local_inventories_config + + yield self if block_given? + end + end + end + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/rest/operations.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/rest/operations.rb new file mode 100644 index 000000000000..f14d649ba52d --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/rest/operations.rb @@ -0,0 +1,962 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/operation" + +module Google + module Cloud + module Retail + module V2 + module ProductService + module Rest + # Service that implements Longrunning Operations API. + class Operations + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" + + # @private + attr_reader :operations_stub + + ## + # Configuration for the ProductService Operations API. + # + # @yield [config] Configure the Operations client. + # @yieldparam config [Operations::Configuration] + # + # @return [Operations::Configuration] + # + def self.configure + @configure ||= Operations::Configuration.new + yield @configure if block_given? + @configure + end + + ## + # Configure the ProductService Operations instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Operations.configure}. + # + # @yield [config] Configure the Operations client. + # @yieldparam config [Operations::Configuration] + # + # @return [Operations::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @operations_stub.universe_domain + end + + ## + # Create a new Operations client object. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Operations::Configuration] + # + def initialize + # Create the configuration object + @config = Configuration.new Operations.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + credentials ||= Credentials.default scope: @config.scope + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @operations_stub = OperationsServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials + ) + + # Used by an LRO wrapper for some methods of this service + @operations_client = self + end + + # Service calls + + ## + # Lists operations that match the specified filter in the request. If the + # server doesn't support this method, it returns `UNIMPLEMENTED`. + # + # @overload list_operations(request, options = nil) + # Pass arguments to `list_operations` via a request object, either of type + # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::ListOperationsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload list_operations(name: nil, filter: nil, page_size: nil, page_token: nil, return_partial_success: nil) + # Pass arguments to `list_operations` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation's parent resource. + # @param filter [::String] + # The standard list filter. + # @param page_size [::Integer] + # The standard list page size. + # @param page_token [::String] + # The standard list page token. + # @param return_partial_success [::Boolean] + # When set to `true`, operations that are reachable are returned as normal, + # and those that are unreachable are returned in the + # [ListOperationsResponse.unreachable] field. + # + # This can only be `true` when reading across collections e.g. when `parent` + # is set to `"projects/example/locations/-"`. + # + # This field is not by default supported and will result in an + # `UNIMPLEMENTED` error if set unless explicitly documented otherwise in + # service or product specific documentation. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::ListOperationsRequest.new + # + # # Call the list_operations method. + # result = client.list_operations request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Longrunning::Operation. + # p item + # end + # + def list_operations request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::ListOperationsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.list_operations.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.list_operations.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.list_operations.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.list_operations request, options do |result, operation| + result = ::Gapic::Rest::PagedEnumerable.new @operations_stub, :list_operations, "operations", request, result, options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets the latest state of a long-running operation. Clients can use this + # method to poll the operation result at intervals as recommended by the API + # service. + # + # @overload get_operation(request, options = nil) + # Pass arguments to `get_operation` via a request object, either of type + # {::Google::Longrunning::GetOperationRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::GetOperationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload get_operation(name: nil) + # Pass arguments to `get_operation` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation resource. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::GetOperationRequest.new + # + # # Call the get_operation method. + # result = client.get_operation request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def get_operation request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::GetOperationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.get_operation.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.get_operation.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.get_operation.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.get_operation request, options do |result, operation| + result = ::Gapic::Operation.new result, @operations_client, options: options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Deletes a long-running operation. This method indicates that the client is + # no longer interested in the operation result. It does not cancel the + # operation. If the server doesn't support this method, it returns + # `google.rpc.Code.UNIMPLEMENTED`. + # + # @overload delete_operation(request, options = nil) + # Pass arguments to `delete_operation` via a request object, either of type + # {::Google::Longrunning::DeleteOperationRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::DeleteOperationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload delete_operation(name: nil) + # Pass arguments to `delete_operation` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation resource to be deleted. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Protobuf::Empty] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Protobuf::Empty] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::DeleteOperationRequest.new + # + # # Call the delete_operation method. + # result = client.delete_operation request + # + # # The returned object is of type Google::Protobuf::Empty. + # p result + # + def delete_operation request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::DeleteOperationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.delete_operation.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.delete_operation.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.delete_operation.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.delete_operation request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Starts asynchronous cancellation on a long-running operation. The server + # makes a best effort to cancel the operation, but success is not + # guaranteed. If the server doesn't support this method, it returns + # `google.rpc.Code.UNIMPLEMENTED`. Clients can use + # Operations.GetOperation or + # other methods to check whether the cancellation succeeded or whether the + # operation completed despite cancellation. On successful cancellation, + # the operation is not deleted; instead, it becomes an operation with + # an {::Google::Longrunning::Operation#error Operation.error} value with a + # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to + # `Code.CANCELLED`. + # + # @overload cancel_operation(request, options = nil) + # Pass arguments to `cancel_operation` via a request object, either of type + # {::Google::Longrunning::CancelOperationRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::CancelOperationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload cancel_operation(name: nil) + # Pass arguments to `cancel_operation` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation resource to be cancelled. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Protobuf::Empty] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Protobuf::Empty] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::CancelOperationRequest.new + # + # # Call the cancel_operation method. + # result = client.cancel_operation request + # + # # The returned object is of type Google::Protobuf::Empty. + # p result + # + def cancel_operation request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::CancelOperationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.cancel_operation.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.cancel_operation.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.cancel_operation.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.cancel_operation request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the Operations REST API. + # + # This class represents the configuration for Operations REST, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Longrunning::Operations::Rest::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # list_operations to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Longrunning::Operations::Rest::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.list_operations.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Longrunning::Operations::Rest::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.list_operations.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`String`) The path to a service account key file in JSON format + # * (`Hash`) A service account key as a Hash + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`nil`) indicating no credentials + # + # Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "retail.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration RPC class for the Operations API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `list_operations` + # @return [::Gapic::Config::Method] + # + attr_reader :list_operations + ## + # RPC-specific configuration for `get_operation` + # @return [::Gapic::Config::Method] + # + attr_reader :get_operation + ## + # RPC-specific configuration for `delete_operation` + # @return [::Gapic::Config::Method] + # + attr_reader :delete_operation + ## + # RPC-specific configuration for `cancel_operation` + # @return [::Gapic::Config::Method] + # + attr_reader :cancel_operation + + # @private + def initialize parent_rpcs = nil + list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations + @list_operations = ::Gapic::Config::Method.new list_operations_config + get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation + @get_operation = ::Gapic::Config::Method.new get_operation_config + delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation + @delete_operation = ::Gapic::Config::Method.new delete_operation_config + cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation + @cancel_operation = ::Gapic::Config::Method.new cancel_operation_config + + yield self if block_given? + end + end + end + end + + ## + # @private + # REST service stub for the Longrunning Operations API. + # Service stub contains baseline method implementations + # including transcoding, making the REST call, and deserialing the response. + class OperationsServiceStub + def initialize endpoint:, endpoint_template:, universe_domain:, credentials: + # These require statements are intentionally placed here to initialize + # the REST modules only when it's required. + require "gapic/rest" + + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials + end + + ## + # Baseline implementation for the list_operations REST call + # + # @param request_pb [::Google::Longrunning::ListOperationsRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::ListOperationsResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::ListOperationsResponse] + # A result object deserialized from the server's reply + def list_operations request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = OperationsServiceStub.transcode_list_operations_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "list_operations", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::ListOperationsResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the get_operation REST call + # + # @param request_pb [::Google::Longrunning::GetOperationRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::Operation] + # A result object deserialized from the server's reply + def get_operation request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = OperationsServiceStub.transcode_get_operation_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "get_operation", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the delete_operation REST call + # + # @param request_pb [::Google::Longrunning::DeleteOperationRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Protobuf::Empty] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Protobuf::Empty] + # A result object deserialized from the server's reply + def delete_operation request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = OperationsServiceStub.transcode_delete_operation_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "delete_operation", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the cancel_operation REST call + # + # @param request_pb [::Google::Longrunning::CancelOperationRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Protobuf::Empty] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Protobuf::Empty] + # A result object deserialized from the server's reply + def cancel_operation request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = OperationsServiceStub.transcode_cancel_operation_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "cancel_operation", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # @private + # + # GRPC transcoding helper method for the list_operations REST call + # + # @param request_pb [::Google::Longrunning::ListOperationsRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_list_operations_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v2/{name}/operations", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/?$}, false] + ] + ) + .with_bindings( + uri_method: :get, + uri_template: "/v2/{name}/operations", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] + ] + ) + .with_bindings( + uri_method: :get, + uri_template: "/v2/{name}/operations", + matches: [ + ["name", %r{^projects/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the get_operation REST call + # + # @param request_pb [::Google::Longrunning::GetOperationRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_get_operation_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v2/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/operations/[^/]+/?$}, false] + ] + ) + .with_bindings( + uri_method: :get, + uri_template: "/v2/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/branches/[^/]+/operations/[^/]+/?$}, false] + ] + ) + .with_bindings( + uri_method: :get, + uri_template: "/v2/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/operations/[^/]+/?$}, false] + ] + ) + .with_bindings( + uri_method: :get, + uri_template: "/v2/{name}", + matches: [ + ["name", %r{^projects/[^/]+/operations/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the delete_operation REST call + # + # @param request_pb [::Google::Longrunning::DeleteOperationRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_delete_operation_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :delete, + uri_template: "/v1/{name}", + matches: [ + ["name", %r{^operations(?:/(?<__wildcard__>.*))?$}, true] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the cancel_operation REST call + # + # @param request_pb [::Google::Longrunning::CancelOperationRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_cancel_operation_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/{name}:cancel", + body: "*", + matches: [ + ["name", %r{^operations(?:/(?<__wildcard__>.*))?$}, true] + ] + ) + transcoder.transcode request_pb + end + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/rest/service_stub.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/rest/service_stub.rb new file mode 100644 index 000000000000..164a945f0191 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/rest/service_stub.rb @@ -0,0 +1,822 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/retail/v2/product_service_pb" + +module Google + module Cloud + module Retail + module V2 + module ProductService + module Rest + ## + # REST service stub for the ProductService service. + # Service stub contains baseline method implementations + # including transcoding, making the REST call, and deserialing the response. + # + class ServiceStub + # @private + def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger: + # These require statements are intentionally placed here to initialize + # the REST modules only when it's required. + require "gapic/rest" + + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials, + numeric_enums: true, + service_name: self.class, + raise_faraday_errors: false, + logger: logger + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @client_stub.universe_domain + end + + ## + # The effective endpoint + # + # @return [String] + # + def endpoint + @client_stub.endpoint + end + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger stub: false + stub ? @client_stub.stub_logger : @client_stub.logger + end + + ## + # Baseline implementation for the create_product REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::CreateProductRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::Product] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::Product] + # A result object deserialized from the server's reply + def create_product request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_create_product_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "create_product", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Retail::V2::Product.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the get_product REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::GetProductRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::Product] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::Product] + # A result object deserialized from the server's reply + def get_product request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_get_product_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "get_product", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Retail::V2::Product.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the list_products REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::ListProductsRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::ListProductsResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::ListProductsResponse] + # A result object deserialized from the server's reply + def list_products request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_list_products_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "list_products", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Retail::V2::ListProductsResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the update_product REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::UpdateProductRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::Product] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::Product] + # A result object deserialized from the server's reply + def update_product request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_update_product_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "update_product", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Retail::V2::Product.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the delete_product REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::DeleteProductRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Protobuf::Empty] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Protobuf::Empty] + # A result object deserialized from the server's reply + def delete_product request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_delete_product_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "delete_product", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the purge_products REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::PurgeProductsRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::Operation] + # A result object deserialized from the server's reply + def purge_products request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_purge_products_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "purge_products", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the import_products REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::ImportProductsRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::Operation] + # A result object deserialized from the server's reply + def import_products request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_import_products_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "import_products", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the set_inventory REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::SetInventoryRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::Operation] + # A result object deserialized from the server's reply + def set_inventory request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_set_inventory_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "set_inventory", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the add_fulfillment_places REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::Operation] + # A result object deserialized from the server's reply + def add_fulfillment_places request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_add_fulfillment_places_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "add_fulfillment_places", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the remove_fulfillment_places REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::Operation] + # A result object deserialized from the server's reply + def remove_fulfillment_places request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_remove_fulfillment_places_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "remove_fulfillment_places", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the add_local_inventories REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::AddLocalInventoriesRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::Operation] + # A result object deserialized from the server's reply + def add_local_inventories request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_add_local_inventories_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "add_local_inventories", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the remove_local_inventories REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::RemoveLocalInventoriesRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::Operation] + # A result object deserialized from the server's reply + def remove_local_inventories request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_remove_local_inventories_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "remove_local_inventories", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # @private + # + # GRPC transcoding helper method for the create_product REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::CreateProductRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_create_product_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v2/{parent}/products", + body: "product", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/branches/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the get_product REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::GetProductRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_get_product_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v2/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/branches/[^/]+/products(?:/(?<__wildcard__>.*))?$}, true] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the list_products REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::ListProductsRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_list_products_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v2/{parent}/products", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/branches/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the update_product REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::UpdateProductRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_update_product_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :patch, + uri_template: "/v2/{product.name}", + body: "product", + matches: [ + ["product.name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/branches/[^/]+/products(?:/(?<__wildcard__>.*))?$}, true] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the delete_product REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::DeleteProductRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_delete_product_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :delete, + uri_template: "/v2/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/branches/[^/]+/products(?:/(?<__wildcard__>.*))?$}, true] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the purge_products REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::PurgeProductsRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_purge_products_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v2/{parent}/products:purge", + body: "*", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/branches/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the import_products REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::ImportProductsRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_import_products_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v2/{parent}/products:import", + body: "*", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/branches/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the set_inventory REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::SetInventoryRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_set_inventory_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v2/{inventory.name}:setInventory", + body: "*", + matches: [ + ["inventory.name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/branches/[^/]+/products(?:/(?<__wildcard__>.*))?$}, true] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the add_fulfillment_places REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_add_fulfillment_places_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v2/{product}:addFulfillmentPlaces", + body: "*", + matches: [ + ["product", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/branches/[^/]+/products(?:/(?<__wildcard__>.*))?$}, true] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the remove_fulfillment_places REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_remove_fulfillment_places_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v2/{product}:removeFulfillmentPlaces", + body: "*", + matches: [ + ["product", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/branches/[^/]+/products(?:/(?<__wildcard__>.*))?$}, true] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the add_local_inventories REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::AddLocalInventoriesRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_add_local_inventories_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v2/{product}:addLocalInventories", + body: "*", + matches: [ + ["product", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/branches/[^/]+/products(?:/(?<__wildcard__>.*))?$}, true] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the remove_local_inventories REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::RemoveLocalInventoriesRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_remove_local_inventories_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v2/{product}:removeLocalInventories", + body: "*", + matches: [ + ["product", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/branches/[^/]+/products(?:/(?<__wildcard__>.*))?$}, true] + ] + ) + transcoder.transcode request_pb + end + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service_pb.rb new file mode 100644 index 000000000000..aee2b57676bc --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service_pb.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/retail/v2/product_service.proto + +require 'google/protobuf' + +require 'google/api/annotations_pb' +require 'google/api/client_pb' +require 'google/api/field_behavior_pb' +require 'google/api/resource_pb' +require 'google/cloud/retail/v2/common_pb' +require 'google/cloud/retail/v2/import_config_pb' +require 'google/cloud/retail/v2/product_pb' +require 'google/cloud/retail/v2/purge_config_pb' +require 'google/longrunning/operations_pb' +require 'google/protobuf/empty_pb' +require 'google/protobuf/field_mask_pb' +require 'google/protobuf/timestamp_pb' + + +descriptor_data = "\n,google/cloud/retail/v2/product_service.proto\x12\x16google.cloud.retail.v2\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a#google/cloud/retail/v2/common.proto\x1a*google/cloud/retail/v2/import_config.proto\x1a$google/cloud/retail/v2/product.proto\x1a)google/cloud/retail/v2/purge_config.proto\x1a#google/longrunning/operations.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\x9c\x01\n\x14\x43reateProductRequest\x12\x34\n\x06parent\x18\x01 \x01(\tB$\xe0\x41\x02\xfa\x41\x1e\n\x1cretail.googleapis.com/Branch\x12\x35\n\x07product\x18\x02 \x01(\x0b\x32\x1f.google.cloud.retail.v2.ProductB\x03\xe0\x41\x02\x12\x17\n\nproduct_id\x18\x03 \x01(\tB\x03\xe0\x41\x02\"H\n\x11GetProductRequest\x12\x33\n\x04name\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\n\x1dretail.googleapis.com/Product\"\x95\x01\n\x14UpdateProductRequest\x12\x35\n\x07product\x18\x01 \x01(\x0b\x32\x1f.google.cloud.retail.v2.ProductB\x03\xe0\x41\x02\x12/\n\x0bupdate_mask\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMask\x12\x15\n\rallow_missing\x18\x03 \x01(\x08\"K\n\x14\x44\x65leteProductRequest\x12\x33\n\x04name\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\n\x1dretail.googleapis.com/Product\"\xb1\x01\n\x13ListProductsRequest\x12\x34\n\x06parent\x18\x01 \x01(\tB$\xe0\x41\x02\xfa\x41\x1e\n\x1cretail.googleapis.com/Branch\x12\x11\n\tpage_size\x18\x02 \x01(\x05\x12\x12\n\npage_token\x18\x03 \x01(\t\x12\x0e\n\x06\x66ilter\x18\x04 \x01(\t\x12-\n\tread_mask\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.FieldMask\"b\n\x14ListProductsResponse\x12\x31\n\x08products\x18\x01 \x03(\x0b\x32\x1f.google.cloud.retail.v2.Product\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t\"\xc1\x01\n\x13SetInventoryRequest\x12\x37\n\tinventory\x18\x01 \x01(\x0b\x32\x1f.google.cloud.retail.v2.ProductB\x03\xe0\x41\x02\x12,\n\x08set_mask\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMask\x12,\n\x08set_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x15\n\rallow_missing\x18\x04 \x01(\x08\"\x16\n\x14SetInventoryMetadata\"\x16\n\x14SetInventoryResponse\"\xc5\x01\n\x1b\x41\x64\x64\x46ulfillmentPlacesRequest\x12\x36\n\x07product\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\n\x1dretail.googleapis.com/Product\x12\x11\n\x04type\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\x16\n\tplace_ids\x18\x03 \x03(\tB\x03\xe0\x41\x02\x12,\n\x08\x61\x64\x64_time\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x15\n\rallow_missing\x18\x05 \x01(\x08\"\x1e\n\x1c\x41\x64\x64\x46ulfillmentPlacesMetadata\"\x1e\n\x1c\x41\x64\x64\x46ulfillmentPlacesResponse\"\x8f\x02\n\x1a\x41\x64\x64LocalInventoriesRequest\x12\x36\n\x07product\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\n\x1dretail.googleapis.com/Product\x12\x46\n\x11local_inventories\x18\x02 \x03(\x0b\x32&.google.cloud.retail.v2.LocalInventoryB\x03\xe0\x41\x02\x12,\n\x08\x61\x64\x64_mask\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.FieldMask\x12,\n\x08\x61\x64\x64_time\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x15\n\rallow_missing\x18\x06 \x01(\x08\"\x1d\n\x1b\x41\x64\x64LocalInventoriesMetadata\"\x1d\n\x1b\x41\x64\x64LocalInventoriesResponse\"\xb7\x01\n\x1dRemoveLocalInventoriesRequest\x12\x36\n\x07product\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\n\x1dretail.googleapis.com/Product\x12\x16\n\tplace_ids\x18\x02 \x03(\tB\x03\xe0\x41\x02\x12/\n\x0bremove_time\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x15\n\rallow_missing\x18\x03 \x01(\x08\" \n\x1eRemoveLocalInventoriesMetadata\" \n\x1eRemoveLocalInventoriesResponse\"\xcb\x01\n\x1eRemoveFulfillmentPlacesRequest\x12\x36\n\x07product\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\n\x1dretail.googleapis.com/Product\x12\x11\n\x04type\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\x16\n\tplace_ids\x18\x03 \x03(\tB\x03\xe0\x41\x02\x12/\n\x0bremove_time\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x15\n\rallow_missing\x18\x05 \x01(\x08\"!\n\x1fRemoveFulfillmentPlacesMetadata\"!\n\x1fRemoveFulfillmentPlacesResponse2\xc2\x19\n\x0eProductService\x12\xcf\x01\n\rCreateProduct\x12,.google.cloud.retail.v2.CreateProductRequest\x1a\x1f.google.cloud.retail.v2.Product\"o\xda\x41\x19parent,product,product_id\x82\xd3\xe4\x93\x02M\"B/v2/{parent=projects/*/locations/*/catalogs/*/branches/*}/products:\x07product\x12\xac\x01\n\nGetProduct\x12).google.cloud.retail.v2.GetProductRequest\x1a\x1f.google.cloud.retail.v2.Product\"R\xda\x41\x04name\x82\xd3\xe4\x93\x02\x45\x12\x43/v2/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}\x12\xbe\x01\n\x0cListProducts\x12+.google.cloud.retail.v2.ListProductsRequest\x1a,.google.cloud.retail.v2.ListProductsResponse\"S\xda\x41\x06parent\x82\xd3\xe4\x93\x02\x44\x12\x42/v2/{parent=projects/*/locations/*/catalogs/*/branches/*}/products\x12\xd2\x01\n\rUpdateProduct\x12,.google.cloud.retail.v2.UpdateProductRequest\x1a\x1f.google.cloud.retail.v2.Product\"r\xda\x41\x13product,update_mask\x82\xd3\xe4\x93\x02V2K/v2/{product.name=projects/*/locations/*/catalogs/*/branches/*/products/**}:\x07product\x12\xa9\x01\n\rDeleteProduct\x12,.google.cloud.retail.v2.DeleteProductRequest\x1a\x16.google.protobuf.Empty\"R\xda\x41\x04name\x82\xd3\xe4\x93\x02\x45*C/v2/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}\x12\x91\x02\n\rPurgeProducts\x12,.google.cloud.retail.v2.PurgeProductsRequest\x1a\x1d.google.longrunning.Operation\"\xb2\x01\xca\x41\\\n,google.cloud.retail.v2.PurgeProductsResponse\x12,google.cloud.retail.v2.PurgeProductsMetadata\x82\xd3\xe4\x93\x02M\"H/v2/{parent=projects/*/locations/*/catalogs/*/branches/*}/products:purge:\x01*\x12\x8e\x02\n\x0eImportProducts\x12-.google.cloud.retail.v2.ImportProductsRequest\x1a\x1d.google.longrunning.Operation\"\xad\x01\xca\x41V\n-google.cloud.retail.v2.ImportProductsResponse\x12%google.cloud.retail.v2.ImportMetadata\x82\xd3\xe4\x93\x02N\"I/v2/{parent=projects/*/locations/*/catalogs/*/branches/*}/products:import:\x01*\x12\xb4\x02\n\x0cSetInventory\x12+.google.cloud.retail.v2.SetInventoryRequest\x1a\x1d.google.longrunning.Operation\"\xd7\x01\xca\x41Z\n+google.cloud.retail.v2.SetInventoryResponse\x12+google.cloud.retail.v2.SetInventoryMetadata\xda\x41\x12inventory,set_mask\x82\xd3\xe4\x93\x02_\"Z/v2/{inventory.name=projects/*/locations/*/catalogs/*/branches/*/products/**}:setInventory:\x01*\x12\xca\x02\n\x14\x41\x64\x64\x46ulfillmentPlaces\x12\x33.google.cloud.retail.v2.AddFulfillmentPlacesRequest\x1a\x1d.google.longrunning.Operation\"\xdd\x01\xca\x41j\n3google.cloud.retail.v2.AddFulfillmentPlacesResponse\x12\x33google.cloud.retail.v2.AddFulfillmentPlacesMetadata\xda\x41\x07product\x82\xd3\xe4\x93\x02`\"[/v2/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:addFulfillmentPlaces:\x01*\x12\xd9\x02\n\x17RemoveFulfillmentPlaces\x12\x36.google.cloud.retail.v2.RemoveFulfillmentPlacesRequest\x1a\x1d.google.longrunning.Operation\"\xe6\x01\xca\x41p\n6google.cloud.retail.v2.RemoveFulfillmentPlacesResponse\x12\x36google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata\xda\x41\x07product\x82\xd3\xe4\x93\x02\x63\"^/v2/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:removeFulfillmentPlaces:\x01*\x12\xc5\x02\n\x13\x41\x64\x64LocalInventories\x12\x32.google.cloud.retail.v2.AddLocalInventoriesRequest\x1a\x1d.google.longrunning.Operation\"\xda\x01\xca\x41h\n2google.cloud.retail.v2.AddLocalInventoriesResponse\x12\x32google.cloud.retail.v2.AddLocalInventoriesMetadata\xda\x41\x07product\x82\xd3\xe4\x93\x02_\"Z/v2/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:addLocalInventories:\x01*\x12\xd4\x02\n\x16RemoveLocalInventories\x12\x35.google.cloud.retail.v2.RemoveLocalInventoriesRequest\x1a\x1d.google.longrunning.Operation\"\xe3\x01\xca\x41n\n5google.cloud.retail.v2.RemoveLocalInventoriesResponse\x12\x35google.cloud.retail.v2.RemoveLocalInventoriesMetadata\xda\x41\x07product\x82\xd3\xe4\x93\x02\x62\"]/v2/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:removeLocalInventories:\x01*\x1aI\xca\x41\x15retail.googleapis.com\xd2\x41.https://www.googleapis.com/auth/cloud-platformB\xbe\x01\n\x1a\x63om.google.cloud.retail.v2B\x13ProductServiceProtoP\x01Z2cloud.google.com/go/retail/apiv2/retailpb;retailpb\xa2\x02\x06RETAIL\xaa\x02\x16Google.Cloud.Retail.V2\xca\x02\x16Google\\Cloud\\Retail\\V2\xea\x02\x19Google::Cloud::Retail::V2b\x06proto3" + +pool = ::Google::Protobuf::DescriptorPool.generated_pool +pool.add_serialized_file(descriptor_data) + +module Google + module Cloud + module Retail + module V2 + CreateProductRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CreateProductRequest").msgclass + GetProductRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.GetProductRequest").msgclass + UpdateProductRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.UpdateProductRequest").msgclass + DeleteProductRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.DeleteProductRequest").msgclass + ListProductsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ListProductsRequest").msgclass + ListProductsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ListProductsResponse").msgclass + SetInventoryRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SetInventoryRequest").msgclass + SetInventoryMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SetInventoryMetadata").msgclass + SetInventoryResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SetInventoryResponse").msgclass + AddFulfillmentPlacesRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.AddFulfillmentPlacesRequest").msgclass + AddFulfillmentPlacesMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.AddFulfillmentPlacesMetadata").msgclass + AddFulfillmentPlacesResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.AddFulfillmentPlacesResponse").msgclass + AddLocalInventoriesRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.AddLocalInventoriesRequest").msgclass + AddLocalInventoriesMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.AddLocalInventoriesMetadata").msgclass + AddLocalInventoriesResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.AddLocalInventoriesResponse").msgclass + RemoveLocalInventoriesRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.RemoveLocalInventoriesRequest").msgclass + RemoveLocalInventoriesMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.RemoveLocalInventoriesMetadata").msgclass + RemoveLocalInventoriesResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.RemoveLocalInventoriesResponse").msgclass + RemoveFulfillmentPlacesRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.RemoveFulfillmentPlacesRequest").msgclass + RemoveFulfillmentPlacesMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata").msgclass + RemoveFulfillmentPlacesResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.RemoveFulfillmentPlacesResponse").msgclass + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service_services_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service_services_pb.rb new file mode 100644 index 000000000000..5ae098e9d214 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service_services_pb.rb @@ -0,0 +1,248 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# Source: google/cloud/retail/v2/product_service.proto for package 'Google.Cloud.Retail.V2' +# Original file comments: +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +require 'grpc' +require 'google/cloud/retail/v2/product_service_pb' + +module Google + module Cloud + module Retail + module V2 + module ProductService + # Service for ingesting [Product][google.cloud.retail.v2.Product] information + # of the customer's website. + class Service + + include ::GRPC::GenericService + + self.marshal_class_method = :encode + self.unmarshal_class_method = :decode + self.service_name = 'google.cloud.retail.v2.ProductService' + + # Creates a [Product][google.cloud.retail.v2.Product]. + rpc :CreateProduct, ::Google::Cloud::Retail::V2::CreateProductRequest, ::Google::Cloud::Retail::V2::Product + # Gets a [Product][google.cloud.retail.v2.Product]. + rpc :GetProduct, ::Google::Cloud::Retail::V2::GetProductRequest, ::Google::Cloud::Retail::V2::Product + # Gets a list of [Product][google.cloud.retail.v2.Product]s. + rpc :ListProducts, ::Google::Cloud::Retail::V2::ListProductsRequest, ::Google::Cloud::Retail::V2::ListProductsResponse + # Updates a [Product][google.cloud.retail.v2.Product]. + rpc :UpdateProduct, ::Google::Cloud::Retail::V2::UpdateProductRequest, ::Google::Cloud::Retail::V2::Product + # Deletes a [Product][google.cloud.retail.v2.Product]. + rpc :DeleteProduct, ::Google::Cloud::Retail::V2::DeleteProductRequest, ::Google::Protobuf::Empty + # Permanently deletes all selected [Product][google.cloud.retail.v2.Product]s + # under a branch. + # + # This process is asynchronous. If the request is valid, the removal will be + # enqueued and processed offline. Depending on the number of + # [Product][google.cloud.retail.v2.Product]s, this operation could take hours + # to complete. Before the operation completes, some + # [Product][google.cloud.retail.v2.Product]s may still be returned by + # [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] + # or + # [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. + # + # Depending on the number of [Product][google.cloud.retail.v2.Product]s, this + # operation could take hours to complete. To get a sample of + # [Product][google.cloud.retail.v2.Product]s that would be deleted, set + # [PurgeProductsRequest.force][google.cloud.retail.v2.PurgeProductsRequest.force] + # to false. + rpc :PurgeProducts, ::Google::Cloud::Retail::V2::PurgeProductsRequest, ::Google::Longrunning::Operation + # Bulk import of multiple [Product][google.cloud.retail.v2.Product]s. + # + # Request processing may be synchronous. + # Non-existing items are created. + # + # Note that it is possible for a subset of the + # [Product][google.cloud.retail.v2.Product]s to be successfully updated. + rpc :ImportProducts, ::Google::Cloud::Retail::V2::ImportProductsRequest, ::Google::Longrunning::Operation + # Updates inventory information for a + # [Product][google.cloud.retail.v2.Product] while respecting the last update + # timestamps of each inventory field. + # + # This process is asynchronous and does not require the + # [Product][google.cloud.retail.v2.Product] to exist before updating + # fulfillment information. If the request is valid, the update is enqueued + # and processed downstream. As a consequence, when a response is returned, + # updates are not immediately manifested in the + # [Product][google.cloud.retail.v2.Product] queried by + # [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] + # or + # [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. + # + # When inventory is updated with + # [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] + # and + # [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct], + # the specified inventory field value(s) overwrite any existing value(s) + # while ignoring the last update time for this field. Furthermore, the last + # update times for the specified inventory fields are overwritten by the + # times of the + # [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] + # or + # [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] + # request. + # + # If no inventory fields are set in + # [CreateProductRequest.product][google.cloud.retail.v2.CreateProductRequest.product], + # then any pre-existing inventory information for this product is used. + # + # If no inventory fields are set in + # [SetInventoryRequest.set_mask][google.cloud.retail.v2.SetInventoryRequest.set_mask], + # then any existing inventory information is preserved. + # + # Pre-existing inventory information can only be updated with + # [ProductService.SetInventory][google.cloud.retail.v2.ProductService.SetInventory], + # [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces], + # and + # [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]. + # + # The returned [Operation][google.longrunning.Operation]s is obsolete after + # one day, and the [GetOperation][google.longrunning.Operations.GetOperation] + # API returns `NOT_FOUND` afterwards. + # + # If conflicting updates are issued, the + # [Operation][google.longrunning.Operation]s associated with the stale + # updates are not marked as [done][google.longrunning.Operation.done] until + # they are obsolete. + rpc :SetInventory, ::Google::Cloud::Retail::V2::SetInventoryRequest, ::Google::Longrunning::Operation + # We recommend that you use the + # [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories] + # method instead of the + # [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces] + # method. + # [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories] + # achieves the same results but provides more fine-grained control over + # ingesting local inventory data. + # + # Incrementally adds place IDs to + # [Product.fulfillment_info.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]. + # + # This process is asynchronous and does not require the + # [Product][google.cloud.retail.v2.Product] to exist before updating + # fulfillment information. If the request is valid, the update will be + # enqueued and processed downstream. As a consequence, when a response is + # returned, the added place IDs are not immediately manifested in the + # [Product][google.cloud.retail.v2.Product] queried by + # [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] + # or + # [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. + # + # The returned [Operation][google.longrunning.Operation]s will be obsolete + # after 1 day, and [GetOperation][google.longrunning.Operations.GetOperation] + # API will return NOT_FOUND afterwards. + # + # If conflicting updates are issued, the + # [Operation][google.longrunning.Operation]s associated with the stale + # updates will not be marked as [done][google.longrunning.Operation.done] + # until being obsolete. + rpc :AddFulfillmentPlaces, ::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest, ::Google::Longrunning::Operation + # We recommend that you use the + # [ProductService.RemoveLocalInventories][google.cloud.retail.v2.ProductService.RemoveLocalInventories] + # method instead of the + # [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces] + # method. + # [ProductService.RemoveLocalInventories][google.cloud.retail.v2.ProductService.RemoveLocalInventories] + # achieves the same results but provides more fine-grained control over + # ingesting local inventory data. + # + # Incrementally removes place IDs from a + # [Product.fulfillment_info.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]. + # + # This process is asynchronous and does not require the + # [Product][google.cloud.retail.v2.Product] to exist before updating + # fulfillment information. If the request is valid, the update will be + # enqueued and processed downstream. As a consequence, when a response is + # returned, the removed place IDs are not immediately manifested in the + # [Product][google.cloud.retail.v2.Product] queried by + # [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] + # or + # [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. + # + # The returned [Operation][google.longrunning.Operation]s will be obsolete + # after 1 day, and [GetOperation][google.longrunning.Operations.GetOperation] + # API will return NOT_FOUND afterwards. + # + # If conflicting updates are issued, the + # [Operation][google.longrunning.Operation]s associated with the stale + # updates will not be marked as [done][google.longrunning.Operation.done] + # until being obsolete. + rpc :RemoveFulfillmentPlaces, ::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest, ::Google::Longrunning::Operation + # Updates local inventory information for a + # [Product][google.cloud.retail.v2.Product] at a list of places, while + # respecting the last update timestamps of each inventory field. + # + # This process is asynchronous and does not require the + # [Product][google.cloud.retail.v2.Product] to exist before updating + # inventory information. If the request is valid, the update will be enqueued + # and processed downstream. As a consequence, when a response is returned, + # updates are not immediately manifested in the + # [Product][google.cloud.retail.v2.Product] queried by + # [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] + # or + # [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. + # + # Local inventory information can only be modified using this method. + # [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] + # and + # [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] + # has no effect on local inventories. + # + # The returned [Operation][google.longrunning.Operation]s will be obsolete + # after 1 day, and [GetOperation][google.longrunning.Operations.GetOperation] + # API will return NOT_FOUND afterwards. + # + # If conflicting updates are issued, the + # [Operation][google.longrunning.Operation]s associated with the stale + # updates will not be marked as [done][google.longrunning.Operation.done] + # until being obsolete. + rpc :AddLocalInventories, ::Google::Cloud::Retail::V2::AddLocalInventoriesRequest, ::Google::Longrunning::Operation + # Remove local inventory information for a + # [Product][google.cloud.retail.v2.Product] at a list of places at a removal + # timestamp. + # + # This process is asynchronous. If the request is valid, the removal will be + # enqueued and processed downstream. As a consequence, when a response is + # returned, removals are not immediately manifested in the + # [Product][google.cloud.retail.v2.Product] queried by + # [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] + # or + # [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. + # + # Local inventory information can only be removed using this method. + # [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] + # and + # [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] + # has no effect on local inventories. + # + # The returned [Operation][google.longrunning.Operation]s will be obsolete + # after 1 day, and [GetOperation][google.longrunning.Operations.GetOperation] + # API will return NOT_FOUND afterwards. + # + # If conflicting updates are issued, the + # [Operation][google.longrunning.Operation]s associated with the stale + # updates will not be marked as [done][google.longrunning.Operation.done] + # until being obsolete. + rpc :RemoveLocalInventories, ::Google::Cloud::Retail::V2::RemoveLocalInventoriesRequest, ::Google::Longrunning::Operation + end + + Stub = Service.rpc_stub_class + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/promotion_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/promotion_pb.rb new file mode 100644 index 000000000000..ae0f81f377b7 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/promotion_pb.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/retail/v2/promotion.proto + +require 'google/protobuf' + + +descriptor_data = "\n&google/cloud/retail/v2/promotion.proto\x12\x16google.cloud.retail.v2\"!\n\tPromotion\x12\x14\n\x0cpromotion_id\x18\x01 \x01(\tB\xb9\x01\n\x1a\x63om.google.cloud.retail.v2B\x0ePromotionProtoP\x01Z2cloud.google.com/go/retail/apiv2/retailpb;retailpb\xa2\x02\x06RETAIL\xaa\x02\x16Google.Cloud.Retail.V2\xca\x02\x16Google\\Cloud\\Retail\\V2\xea\x02\x19Google::Cloud::Retail::V2b\x06proto3" + +pool = ::Google::Protobuf::DescriptorPool.generated_pool +pool.add_serialized_file(descriptor_data) + +module Google + module Cloud + module Retail + module V2 + Promotion = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Promotion").msgclass + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/purge_config_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/purge_config_pb.rb new file mode 100644 index 000000000000..786696cf2180 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/purge_config_pb.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/retail/v2/purge_config.proto + +require 'google/protobuf' + +require 'google/api/field_behavior_pb' +require 'google/api/resource_pb' +require 'google/protobuf/timestamp_pb' + + +descriptor_data = "\n)google/cloud/retail/v2/purge_config.proto\x12\x16google.cloud.retail.v2\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\x0f\n\rPurgeMetadata\"\xa7\x01\n\x15PurgeProductsMetadata\x12/\n\x0b\x63reate_time\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12/\n\x0bupdate_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x15\n\rsuccess_count\x18\x03 \x01(\x03\x12\x15\n\rfailure_count\x18\x04 \x01(\x03\"p\n\x14PurgeProductsRequest\x12\x34\n\x06parent\x18\x01 \x01(\tB$\xe0\x41\x02\xfa\x41\x1e\n\x1cretail.googleapis.com/Branch\x12\x13\n\x06\x66ilter\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\r\n\x05\x66orce\x18\x03 \x01(\x08\"f\n\x15PurgeProductsResponse\x12\x13\n\x0bpurge_count\x18\x01 \x01(\x03\x12\x38\n\x0cpurge_sample\x18\x02 \x03(\tB\"\xfa\x41\x1f\n\x1dretail.googleapis.com/Product\"s\n\x16PurgeUserEventsRequest\x12\x35\n\x06parent\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\n\x1dretail.googleapis.com/Catalog\x12\x13\n\x06\x66ilter\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\r\n\x05\x66orce\x18\x03 \x01(\x08\"6\n\x17PurgeUserEventsResponse\x12\x1b\n\x13purged_events_count\x18\x01 \x01(\x03\x42\xbb\x01\n\x1a\x63om.google.cloud.retail.v2B\x10PurgeConfigProtoP\x01Z2cloud.google.com/go/retail/apiv2/retailpb;retailpb\xa2\x02\x06RETAIL\xaa\x02\x16Google.Cloud.Retail.V2\xca\x02\x16Google\\Cloud\\Retail\\V2\xea\x02\x19Google::Cloud::Retail::V2b\x06proto3" + +pool = ::Google::Protobuf::DescriptorPool.generated_pool +pool.add_serialized_file(descriptor_data) + +module Google + module Cloud + module Retail + module V2 + PurgeMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.PurgeMetadata").msgclass + PurgeProductsMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.PurgeProductsMetadata").msgclass + PurgeProductsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.PurgeProductsRequest").msgclass + PurgeProductsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.PurgeProductsResponse").msgclass + PurgeUserEventsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.PurgeUserEventsRequest").msgclass + PurgeUserEventsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.PurgeUserEventsResponse").msgclass + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/rest.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/rest.rb new file mode 100644 index 000000000000..47b06c36e7ba --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/rest.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/retail/v2/analytics_service/rest" +require "google/cloud/retail/v2/catalog_service/rest" +require "google/cloud/retail/v2/completion_service/rest" +require "google/cloud/retail/v2/control_service/rest" +require "google/cloud/retail/v2/search_service/rest" +require "google/cloud/retail/v2/conversational_search_service/rest" +require "google/cloud/retail/v2/generative_question_service/rest" +require "google/cloud/retail/v2/model_service/rest" +require "google/cloud/retail/v2/prediction_service/rest" +require "google/cloud/retail/v2/product_service/rest" +require "google/cloud/retail/v2/serving_config_service/rest" +require "google/cloud/retail/v2/user_event_service/rest" +require "google/cloud/retail/v2/version" + +module Google + module Cloud + module Retail + ## + # To load just the REST part of this package, including all its services, and instantiate a REST client: + # + # @example + # + # require "google/cloud/retail/v2/rest" + # client = ::Google::Cloud::Retail::V2::AnalyticsService::Rest::Client.new + # + module V2 + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/safety_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/safety_pb.rb new file mode 100644 index 000000000000..9cf4cbf18eaa --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/safety_pb.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/retail/v2/safety.proto + +require 'google/protobuf' + +require 'google/api/field_behavior_pb' + + +descriptor_data = "\n#google/cloud/retail/v2/safety.proto\x12\x16google.cloud.retail.v2\x1a\x1fgoogle/api/field_behavior.proto\"\xd5\x03\n\rSafetySetting\x12\x36\n\x08\x63\x61tegory\x18\x01 \x01(\x0e\x32$.google.cloud.retail.v2.HarmCategory\x12K\n\tthreshold\x18\x02 \x01(\x0e\x32\x38.google.cloud.retail.v2.SafetySetting.HarmBlockThreshold\x12J\n\x06method\x18\x03 \x01(\x0e\x32\x35.google.cloud.retail.v2.SafetySetting.HarmBlockMethodB\x03\xe0\x41\x01\"\x9d\x01\n\x12HarmBlockThreshold\x12$\n HARM_BLOCK_THRESHOLD_UNSPECIFIED\x10\x00\x12\x17\n\x13\x42LOCK_LOW_AND_ABOVE\x10\x01\x12\x1a\n\x16\x42LOCK_MEDIUM_AND_ABOVE\x10\x02\x12\x13\n\x0f\x42LOCK_ONLY_HIGH\x10\x03\x12\x0e\n\nBLOCK_NONE\x10\x04\x12\x07\n\x03OFF\x10\x05\"S\n\x0fHarmBlockMethod\x12!\n\x1dHARM_BLOCK_METHOD_UNSPECIFIED\x10\x00\x12\x0c\n\x08SEVERITY\x10\x01\x12\x0f\n\x0bPROBABILITY\x10\x02*\xd7\x01\n\x0cHarmCategory\x12\x1d\n\x19HARM_CATEGORY_UNSPECIFIED\x10\x00\x12\x1d\n\x19HARM_CATEGORY_HATE_SPEECH\x10\x01\x12#\n\x1fHARM_CATEGORY_DANGEROUS_CONTENT\x10\x02\x12\x1c\n\x18HARM_CATEGORY_HARASSMENT\x10\x03\x12#\n\x1fHARM_CATEGORY_SEXUALLY_EXPLICIT\x10\x04\x12!\n\x1dHARM_CATEGORY_CIVIC_INTEGRITY\x10\x05\x42\xb6\x01\n\x1a\x63om.google.cloud.retail.v2B\x0bSafetyProtoP\x01Z2cloud.google.com/go/retail/apiv2/retailpb;retailpb\xa2\x02\x06RETAIL\xaa\x02\x16Google.Cloud.Retail.V2\xca\x02\x16Google\\Cloud\\Retail\\V2\xea\x02\x19Google::Cloud::Retail::V2b\x06proto3" + +pool = ::Google::Protobuf::DescriptorPool.generated_pool +pool.add_serialized_file(descriptor_data) + +module Google + module Cloud + module Retail + module V2 + SafetySetting = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SafetySetting").msgclass + SafetySetting::HarmBlockThreshold = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SafetySetting.HarmBlockThreshold").enummodule + SafetySetting::HarmBlockMethod = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SafetySetting.HarmBlockMethod").enummodule + HarmCategory = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.HarmCategory").enummodule + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service.rb new file mode 100644 index 000000000000..dae214f30163 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service.rb @@ -0,0 +1,58 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/common" +require "gapic/config" +require "gapic/config/method" + +require "google/cloud/retail/v2/version" + +require "google/cloud/retail/v2/search_service/credentials" +require "google/cloud/retail/v2/search_service/paths" +require "google/cloud/retail/v2/search_service/client" +require "google/cloud/retail/v2/search_service/rest" + +module Google + module Cloud + module Retail + module V2 + ## + # Service for search. + # + # This feature is only available for users who have Retail Search enabled. + # Enable Retail Search on Cloud Console before using this feature. + # + # @example Load this service and instantiate a gRPC client + # + # require "google/cloud/retail/v2/search_service" + # client = ::Google::Cloud::Retail::V2::SearchService::Client.new + # + # @example Load this service and instantiate a REST client + # + # require "google/cloud/retail/v2/search_service/rest" + # client = ::Google::Cloud::Retail::V2::SearchService::Rest::Client.new + # + module SearchService + end + end + end + end +end + +helper_path = ::File.join __dir__, "search_service", "helpers.rb" +require "google/cloud/retail/v2/search_service/helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/client.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/client.rb new file mode 100644 index 000000000000..7dcd0044183f --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/client.rb @@ -0,0 +1,789 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/cloud/retail/v2/search_service_pb" +require "google/cloud/location" + +module Google + module Cloud + module Retail + module V2 + module SearchService + ## + # Client for the SearchService service. + # + # Service for search. + # + # This feature is only available for users who have Retail Search enabled. + # Enable Retail Search on Cloud Console before using this feature. + # + class Client + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" + + include Paths + + # @private + attr_reader :search_service_stub + + ## + # Configure the SearchService Client class. + # + # See {::Google::Cloud::Retail::V2::SearchService::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all SearchService clients + # ::Google::Cloud::Retail::V2::SearchService::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "Retail", "V2"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config.timeout = 5.0 + default_config.retry_policy = { + initial_delay: 0.1, max_delay: 5.0, multiplier: 1.3, retry_codes: [14, 4] + } + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the SearchService Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Cloud::Retail::V2::SearchService::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @search_service_stub.universe_domain + end + + ## + # Create a new SearchService client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::Retail::V2::SearchService::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::Retail::V2::SearchService::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the SearchService client. + # @yieldparam config [Client::Configuration] + # + def initialize + # These require statements are intentionally placed here to initialize + # the gRPC module only when it's required. + # See https://github.com/googleapis/toolkit/issues/446 + require "gapic/grpc" + require "google/cloud/retail/v2/search_service_services_pb" + + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @search_service_stub = ::Gapic::ServiceStub.new( + ::Google::Cloud::Retail::V2::SearchService::Stub, + credentials: credentials, + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + channel_args: @config.channel_args, + interceptors: @config.interceptors, + channel_pool_config: @config.channel_pool, + logger: @config.logger + ) + + @search_service_stub.stub_logger&.info do |entry| + entry.set_system_name + entry.set_service + entry.message = "Created client for #{entry.service}" + entry.set_credentials_fields credentials + entry.set "customEndpoint", @config.endpoint if @config.endpoint + entry.set "defaultTimeout", @config.timeout if @config.timeout + entry.set "quotaProject", @quota_project_id if @quota_project_id + end + + @location_client = Google::Cloud::Location::Locations::Client.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @search_service_stub.endpoint + config.universe_domain = @search_service_stub.universe_domain + config.logger = @search_service_stub.logger if config.respond_to? :logger= + end + end + + ## + # Get the associated client for mix-in of the Locations. + # + # @return [Google::Cloud::Location::Locations::Client] + # + attr_reader :location_client + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @search_service_stub.logger + end + + # Service calls + + ## + # Performs a search. + # + # This feature is only available for users who have Retail Search enabled. + # Enable Retail Search on Cloud Console before using this feature. + # + # @overload search(request, options = nil) + # Pass arguments to `search` via a request object, either of type + # {::Google::Cloud::Retail::V2::SearchRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::SearchRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload search(placement: nil, branch: nil, query: nil, visitor_id: nil, user_info: nil, page_size: nil, page_token: nil, offset: nil, filter: nil, canonical_filter: nil, order_by: nil, facet_specs: nil, dynamic_facet_spec: nil, boost_spec: nil, query_expansion_spec: nil, variant_rollup_keys: nil, page_categories: nil, search_mode: nil, personalization_spec: nil, labels: nil, spell_correction_spec: nil, entity: nil, conversational_search_spec: nil, tile_navigation_spec: nil, language_code: nil, region_code: nil, place_id: nil, user_attributes: nil) + # Pass arguments to `search` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param placement [::String] + # Required. The resource name of the Retail Search serving config, such as + # `projects/*/locations/global/catalogs/default_catalog/servingConfigs/default_serving_config` + # or the name of the legacy placement resource, such as + # `projects/*/locations/global/catalogs/default_catalog/placements/default_search`. + # This field is used to identify the serving config name and the set + # of models that are used to make the search. + # @param branch [::String] + # The branch resource name, such as + # `projects/*/locations/global/catalogs/default_catalog/branches/0`. + # + # Use "default_branch" as the branch ID or leave this field empty, to search + # products under the default branch. + # @param query [::String] + # Raw search query. + # + # If this field is empty, the request is considered a category browsing + # request and returned results are based on + # {::Google::Cloud::Retail::V2::SearchRequest#filter filter} and + # {::Google::Cloud::Retail::V2::SearchRequest#page_categories page_categories}. + # @param visitor_id [::String] + # Required. A unique identifier for tracking visitors. For example, this + # could be implemented with an HTTP cookie, which should be able to uniquely + # identify a visitor on a single device. This unique identifier should not + # change if the visitor logs in or out of the website. + # + # This should be the same identifier as + # {::Google::Cloud::Retail::V2::UserEvent#visitor_id UserEvent.visitor_id}. + # + # The field must be a UTF-8 encoded string with a length limit of 128 + # characters. Otherwise, an INVALID_ARGUMENT error is returned. + # @param user_info [::Google::Cloud::Retail::V2::UserInfo, ::Hash] + # User information. + # @param page_size [::Integer] + # Maximum number of {::Google::Cloud::Retail::V2::Product Product}s to return. If + # unspecified, defaults to a reasonable value. The maximum allowed value is + # 120. Values above 120 will be coerced to 120. + # + # If this field is negative, an INVALID_ARGUMENT is returned. + # @param page_token [::String] + # A page token + # {::Google::Cloud::Retail::V2::SearchResponse#next_page_token SearchResponse.next_page_token}, + # received from a previous + # {::Google::Cloud::Retail::V2::SearchService::Client#search SearchService.Search} call. + # Provide this to retrieve the subsequent page. + # + # When paginating, all other parameters provided to + # {::Google::Cloud::Retail::V2::SearchService::Client#search SearchService.Search} must + # match the call that provided the page token. Otherwise, an INVALID_ARGUMENT + # error is returned. + # @param offset [::Integer] + # A 0-indexed integer that specifies the current offset (that is, starting + # result location, amongst the {::Google::Cloud::Retail::V2::Product Product}s + # deemed by the API as relevant) in search results. This field is only + # considered if {::Google::Cloud::Retail::V2::SearchRequest#page_token page_token} + # is unset. + # + # If this field is negative, an INVALID_ARGUMENT is returned. + # @param filter [::String] + # The filter syntax consists of an expression language for constructing a + # predicate from one or more fields of the products being filtered. Filter + # expression is case-sensitive. For more information, see + # [Filter](https://cloud.google.com/retail/docs/filter-and-order#filter). + # + # If this field is unrecognizable, an INVALID_ARGUMENT is returned. + # @param canonical_filter [::String] + # The default filter that is applied when a user performs a search without + # checking any filters on the search page. + # + # The filter applied to every search request when quality improvement such as + # query expansion is needed. In the case a query does not have a sufficient + # amount of results this filter will be used to determine whether or not to + # enable the query expansion flow. The original filter will still be used for + # the query expanded search. + # This field is strongly recommended to achieve high search quality. + # + # For more information about filter syntax, see + # {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}. + # @param order_by [::String] + # The order in which products are returned. Products can be ordered by + # a field in an {::Google::Cloud::Retail::V2::Product Product} object. Leave it + # unset if ordered by relevance. OrderBy expression is case-sensitive. For + # more information, see + # [Order](https://cloud.google.com/retail/docs/filter-and-order#order). + # + # If this field is unrecognizable, an INVALID_ARGUMENT is returned. + # @param facet_specs [::Array<::Google::Cloud::Retail::V2::SearchRequest::FacetSpec, ::Hash>] + # Facet specifications for faceted search. If empty, no facets are returned. + # + # A maximum of 200 values are allowed. Otherwise, an INVALID_ARGUMENT error + # is returned. + # @param dynamic_facet_spec [::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec, ::Hash] + # Deprecated. Refer to https://cloud.google.com/retail/docs/configs#dynamic + # to enable dynamic facets. Do not set this field. + # + # The specification for dynamically generated facets. Notice that only + # textual facets can be dynamically generated. + # @param boost_spec [::Google::Cloud::Retail::V2::SearchRequest::BoostSpec, ::Hash] + # Boost specification to boost certain products. For more information, see + # [Boost results](https://cloud.google.com/retail/docs/boosting). + # + # Notice that if both + # {::Google::Cloud::Retail::V2::ServingConfig#boost_control_ids ServingConfig.boost_control_ids} + # and + # {::Google::Cloud::Retail::V2::SearchRequest#boost_spec SearchRequest.boost_spec} + # are set, the boost conditions from both places are evaluated. If a search + # request matches multiple boost conditions, the final boost score is equal + # to the sum of the boost scores from all matched boost conditions. + # @param query_expansion_spec [::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec, ::Hash] + # The query expansion specification that specifies the conditions under which + # query expansion occurs. For more information, see [Query + # expansion](https://cloud.google.com/retail/docs/result-size#query_expansion). + # @param variant_rollup_keys [::Array<::String>] + # The keys to fetch and rollup the matching + # {::Google::Cloud::Retail::V2::Product::Type::VARIANT variant} + # {::Google::Cloud::Retail::V2::Product Product}s attributes, + # {::Google::Cloud::Retail::V2::FulfillmentInfo FulfillmentInfo} or + # {::Google::Cloud::Retail::V2::LocalInventory LocalInventory}s attributes. The + # attributes from all the matching + # {::Google::Cloud::Retail::V2::Product::Type::VARIANT variant} + # {::Google::Cloud::Retail::V2::Product Product}s or + # {::Google::Cloud::Retail::V2::LocalInventory LocalInventory}s are merged and + # de-duplicated. Notice that rollup attributes will lead to extra query + # latency. Maximum number of keys is 30. + # + # For {::Google::Cloud::Retail::V2::FulfillmentInfo FulfillmentInfo}, a + # fulfillment type and a fulfillment ID must be provided in the format of + # "fulfillmentType.fulfillmentId". E.g., in "pickupInStore.store123", + # "pickupInStore" is fulfillment type and "store123" is the store ID. + # + # Supported keys are: + # + # * colorFamilies + # * price + # * originalPrice + # * discount + # * variantId + # * inventory(place_id,price) + # * inventory(place_id,original_price) + # * inventory(place_id,attributes.key), where key is any key in the + # {::Google::Cloud::Retail::V2::LocalInventory#attributes Product.local_inventories.attributes} + # map. + # * attributes.key, where key is any key in the + # {::Google::Cloud::Retail::V2::Product#attributes Product.attributes} map. + # * pickupInStore.id, where id is any + # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} + # for {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type} + # "pickup-in-store". + # * shipToStore.id, where id is any + # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} + # for {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type} + # "ship-to-store". + # * sameDayDelivery.id, where id is any + # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} + # for {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type} + # "same-day-delivery". + # * nextDayDelivery.id, where id is any + # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} + # for {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type} + # "next-day-delivery". + # * customFulfillment1.id, where id is any + # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} + # for {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type} + # "custom-type-1". + # * customFulfillment2.id, where id is any + # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} + # for {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type} + # "custom-type-2". + # * customFulfillment3.id, where id is any + # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} + # for {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type} + # "custom-type-3". + # * customFulfillment4.id, where id is any + # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} + # for {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type} + # "custom-type-4". + # * customFulfillment5.id, where id is any + # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} + # for {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type} + # "custom-type-5". + # + # If this field is set to an invalid value other than these, an + # INVALID_ARGUMENT error is returned. + # @param page_categories [::Array<::String>] + # The categories associated with a category page. Must be set for category + # navigation queries to achieve good search quality. The format should be + # the same as + # {::Google::Cloud::Retail::V2::UserEvent#page_categories UserEvent.page_categories}; + # + # To represent full path of category, use '>' sign to separate different + # hierarchies. If '>' is part of the category name, replace it with + # other character(s). + # + # Category pages include special pages such as sales or promotions. For + # instance, a special sale page may have the category hierarchy: + # "pageCategories" : ["Sales > 2017 Black Friday Deals"]. + # @param search_mode [::Google::Cloud::Retail::V2::SearchRequest::SearchMode] + # The search mode of the search request. If not specified, a single search + # request triggers both product search and faceted search. + # @param personalization_spec [::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec, ::Hash] + # The specification for personalization. + # + # Notice that if both + # {::Google::Cloud::Retail::V2::ServingConfig#personalization_spec ServingConfig.personalization_spec} + # and + # {::Google::Cloud::Retail::V2::SearchRequest#personalization_spec SearchRequest.personalization_spec} + # are set. + # {::Google::Cloud::Retail::V2::SearchRequest#personalization_spec SearchRequest.personalization_spec} + # will override + # {::Google::Cloud::Retail::V2::ServingConfig#personalization_spec ServingConfig.personalization_spec}. + # @param labels [::Hash{::String => ::String}] + # The labels applied to a resource must meet the following requirements: + # + # * Each resource can have multiple labels, up to a maximum of 64. + # * Each label must be a key-value pair. + # * Keys have a minimum length of 1 character and a maximum length of 63 + # characters and cannot be empty. Values can be empty and have a maximum + # length of 63 characters. + # * Keys and values can contain only lowercase letters, numeric characters, + # underscores, and dashes. All characters must use UTF-8 encoding, and + # international characters are allowed. + # * The key portion of a label must be unique. However, you can use the same + # key with multiple resources. + # * Keys must start with a lowercase letter or international character. + # + # For more information, see [Requirements for + # labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + # in the Resource Manager documentation. + # @param spell_correction_spec [::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec, ::Hash] + # The spell correction specification that specifies the mode under + # which spell correction will take effect. + # @param entity [::String] + # The entity for customers that may run multiple different entities, domains, + # sites or regions, for example, `Google US`, `Google Ads`, `Waymo`, + # `google.com`, `youtube.com`, etc. + # If this is set, it should be exactly matched with + # {::Google::Cloud::Retail::V2::UserEvent#entity UserEvent.entity} to get search + # results boosted by entity. + # @param conversational_search_spec [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec, ::Hash] + # Optional. This field specifies all conversational related parameters + # addition to traditional retail search. + # @param tile_navigation_spec [::Google::Cloud::Retail::V2::SearchRequest::TileNavigationSpec, ::Hash] + # Optional. This field specifies tile navigation related parameters. + # @param language_code [::String] + # Optional. The BCP-47 language code, such as "en-US" or "sr-Latn" + # [list](https://www.unicode.org/cldr/charts/46/summary/root.html). For more + # information, see [Standardized codes](https://google.aip.dev/143). This + # field helps to better interpret the query. If a value isn't specified, the + # query language code is automatically detected, which may not be accurate. + # @param region_code [::String] + # Optional. The Unicode country/region code (CLDR) of a location, such as + # "US" and "419" + # [list](https://www.unicode.org/cldr/charts/46/supplemental/territory_information.html). + # For more information, see [Standardized codes](https://google.aip.dev/143). + # If set, then results will be boosted based on the region_code provided. + # @param place_id [::String] + # Optional. An id corresponding to a place, such as a store id or region id. + # When specified, we use the price from the local inventory with the matching + # product's + # {::Google::Cloud::Retail::V2::LocalInventory#place_id LocalInventory.place_id} + # for revenue optimization. + # @param user_attributes [::Hash{::String => ::Google::Cloud::Retail::V2::StringList, ::Hash}] + # Optional. The user attributes that could be used for personalization of + # search results. + # * Populate at most 100 key-value pairs per query. + # * Only supports string keys and repeated string values. + # * Duplcate keys are not allowed within a single query. + # + # Example: + # user_attributes: [ + # { key: "pets" + # value { + # values: "dog" + # values: "cat" + # } + # }, + # { key: "state" + # value { + # values: "CA" + # } + # } + # ] + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Retail::V2::SearchResponse::SearchResult>] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::PagedEnumerable<::Google::Cloud::Retail::V2::SearchResponse::SearchResult>] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::SearchService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::SearchRequest.new + # + # # Call the search method. + # result = client.search request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Cloud::Retail::V2::SearchResponse::SearchResult. + # p item + # end + # + def search request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::SearchRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.search.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.placement + header_params["placement"] = request.placement + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.search.timeout, + metadata: metadata, + retry_policy: @config.rpcs.search.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @search_service_stub.call_rpc :search, request, options: options do |response, operation| + response = ::Gapic::PagedEnumerable.new @search_service_stub, :search, request, response, operation, options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the SearchService API. + # + # This class represents the configuration for SearchService, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::Retail::V2::SearchService::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # search to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Retail::V2::SearchService::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.search.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Retail::V2::SearchService::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.search.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`GRPC::Core::Channel`) a gRPC channel with included credentials + # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object + # * (`nil`) indicating no credentials + # + # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials + # is deprecated. Providing an unvalidated credential configuration to + # Google APIs can compromise the security of your systems and data. + # + # @example + # + # # The recommended way to provide credentials is to use the `make_creds` method + # # on the appropriate credentials class for your environment. + # + # require "googleauth" + # + # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds( + # json_key_io: ::File.open("/path/to/keyfile.json") + # ) + # + # client = ::Google::Cloud::Retail::V2::SearchService::Client.new do |config| + # config.credentials = credentials + # end + # + # @note Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] channel_args + # Extra parameters passed to the gRPC channel. Note: this is ignored if a + # `GRPC::Core::Channel` object is provided as the credential. + # @return [::Hash] + # @!attribute [rw] interceptors + # An array of interceptors that are run before calls are executed. + # @return [::Array<::GRPC::ClientInterceptor>] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional gRPC headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "retail.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) + config_attr :interceptors, nil, ::Array, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration for the channel pool + # @return [::Gapic::ServiceStub::ChannelPool::Configuration] + # + def channel_pool + @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new + end + + ## + # Configuration RPC class for the SearchService API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `search` + # @return [::Gapic::Config::Method] + # + attr_reader :search + + # @private + def initialize parent_rpcs = nil + search_config = parent_rpcs.search if parent_rpcs.respond_to? :search + @search = ::Gapic::Config::Method.new search_config + + yield self if block_given? + end + end + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/credentials.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/credentials.rb new file mode 100644 index 000000000000..cac1d6f0827c --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/credentials.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "googleauth" + +module Google + module Cloud + module Retail + module V2 + module SearchService + # Credentials for the SearchService API. + class Credentials < ::Google::Auth::Credentials + self.scope = [ + "https://www.googleapis.com/auth/cloud-platform" + ] + self.env_vars = [ + "RETAIL_CREDENTIALS", + "RETAIL_KEYFILE", + "GOOGLE_CLOUD_CREDENTIALS", + "GOOGLE_CLOUD_KEYFILE", + "GCLOUD_KEYFILE", + "RETAIL_CREDENTIALS_JSON", + "RETAIL_KEYFILE_JSON", + "GOOGLE_CLOUD_CREDENTIALS_JSON", + "GOOGLE_CLOUD_KEYFILE_JSON", + "GCLOUD_KEYFILE_JSON" + ] + self.paths = [ + "~/.config/google_cloud/application_default_credentials.json" + ] + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/paths.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/paths.rb new file mode 100644 index 000000000000..9bc8dfbe2895 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/paths.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Retail + module V2 + module SearchService + # Path helper methods for the SearchService API. + module Paths + ## + # Create a fully-qualified Branch resource string. + # + # The resource will be in the following format: + # + # `projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}` + # + # @param project [String] + # @param location [String] + # @param catalog [String] + # @param branch [String] + # + # @return [::String] + def branch_path project:, location:, catalog:, branch: + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" + raise ::ArgumentError, "catalog cannot contain /" if catalog.to_s.include? "/" + + "projects/#{project}/locations/#{location}/catalogs/#{catalog}/branches/#{branch}" + end + + extend self + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/rest.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/rest.rb new file mode 100644 index 000000000000..b7b1de13989c --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/rest.rb @@ -0,0 +1,55 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/rest" +require "gapic/config" +require "gapic/config/method" + +require "google/cloud/retail/v2/version" + +require "google/cloud/retail/v2/search_service/credentials" +require "google/cloud/retail/v2/search_service/paths" +require "google/cloud/retail/v2/search_service/rest/client" + +module Google + module Cloud + module Retail + module V2 + ## + # Service for search. + # + # This feature is only available for users who have Retail Search enabled. + # Enable Retail Search on Cloud Console before using this feature. + # + # To load this service and instantiate a REST client: + # + # require "google/cloud/retail/v2/search_service/rest" + # client = ::Google::Cloud::Retail::V2::SearchService::Rest::Client.new + # + module SearchService + # Client for the REST transport + module Rest + end + end + end + end + end +end + +helper_path = ::File.join __dir__, "rest", "helpers.rb" +require "google/cloud/retail/v2/search_service/rest/helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/rest/client.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/rest/client.rb new file mode 100644 index 000000000000..5657920b447d --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/rest/client.rb @@ -0,0 +1,739 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/cloud/retail/v2/search_service_pb" +require "google/cloud/retail/v2/search_service/rest/service_stub" +require "google/cloud/location/rest" + +module Google + module Cloud + module Retail + module V2 + module SearchService + module Rest + ## + # REST client for the SearchService service. + # + # Service for search. + # + # This feature is only available for users who have Retail Search enabled. + # Enable Retail Search on Cloud Console before using this feature. + # + class Client + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" + + include Paths + + # @private + attr_reader :search_service_stub + + ## + # Configure the SearchService Client class. + # + # See {::Google::Cloud::Retail::V2::SearchService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all SearchService clients + # ::Google::Cloud::Retail::V2::SearchService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "Retail", "V2"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config.timeout = 5.0 + default_config.retry_policy = { + initial_delay: 0.1, max_delay: 5.0, multiplier: 1.3, retry_codes: [14, 4] + } + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the SearchService Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Cloud::Retail::V2::SearchService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @search_service_stub.universe_domain + end + + ## + # Create a new SearchService REST client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::Retail::V2::SearchService::Rest::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::Retail::V2::SearchService::Rest::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the SearchService client. + # @yieldparam config [Client::Configuration] + # + def initialize + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @search_service_stub = ::Google::Cloud::Retail::V2::SearchService::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials, + logger: @config.logger + ) + + @search_service_stub.logger(stub: true)&.info do |entry| + entry.set_system_name + entry.set_service + entry.message = "Created client for #{entry.service}" + entry.set_credentials_fields credentials + entry.set "customEndpoint", @config.endpoint if @config.endpoint + entry.set "defaultTimeout", @config.timeout if @config.timeout + entry.set "quotaProject", @quota_project_id if @quota_project_id + end + + @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @search_service_stub.endpoint + config.universe_domain = @search_service_stub.universe_domain + config.logger = @search_service_stub.logger if config.respond_to? :logger= + end + end + + ## + # Get the associated client for mix-in of the Locations. + # + # @return [Google::Cloud::Location::Locations::Rest::Client] + # + attr_reader :location_client + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @search_service_stub.logger + end + + # Service calls + + ## + # Performs a search. + # + # This feature is only available for users who have Retail Search enabled. + # Enable Retail Search on Cloud Console before using this feature. + # + # @overload search(request, options = nil) + # Pass arguments to `search` via a request object, either of type + # {::Google::Cloud::Retail::V2::SearchRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::SearchRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload search(placement: nil, branch: nil, query: nil, visitor_id: nil, user_info: nil, page_size: nil, page_token: nil, offset: nil, filter: nil, canonical_filter: nil, order_by: nil, facet_specs: nil, dynamic_facet_spec: nil, boost_spec: nil, query_expansion_spec: nil, variant_rollup_keys: nil, page_categories: nil, search_mode: nil, personalization_spec: nil, labels: nil, spell_correction_spec: nil, entity: nil, conversational_search_spec: nil, tile_navigation_spec: nil, language_code: nil, region_code: nil, place_id: nil, user_attributes: nil) + # Pass arguments to `search` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param placement [::String] + # Required. The resource name of the Retail Search serving config, such as + # `projects/*/locations/global/catalogs/default_catalog/servingConfigs/default_serving_config` + # or the name of the legacy placement resource, such as + # `projects/*/locations/global/catalogs/default_catalog/placements/default_search`. + # This field is used to identify the serving config name and the set + # of models that are used to make the search. + # @param branch [::String] + # The branch resource name, such as + # `projects/*/locations/global/catalogs/default_catalog/branches/0`. + # + # Use "default_branch" as the branch ID or leave this field empty, to search + # products under the default branch. + # @param query [::String] + # Raw search query. + # + # If this field is empty, the request is considered a category browsing + # request and returned results are based on + # {::Google::Cloud::Retail::V2::SearchRequest#filter filter} and + # {::Google::Cloud::Retail::V2::SearchRequest#page_categories page_categories}. + # @param visitor_id [::String] + # Required. A unique identifier for tracking visitors. For example, this + # could be implemented with an HTTP cookie, which should be able to uniquely + # identify a visitor on a single device. This unique identifier should not + # change if the visitor logs in or out of the website. + # + # This should be the same identifier as + # {::Google::Cloud::Retail::V2::UserEvent#visitor_id UserEvent.visitor_id}. + # + # The field must be a UTF-8 encoded string with a length limit of 128 + # characters. Otherwise, an INVALID_ARGUMENT error is returned. + # @param user_info [::Google::Cloud::Retail::V2::UserInfo, ::Hash] + # User information. + # @param page_size [::Integer] + # Maximum number of {::Google::Cloud::Retail::V2::Product Product}s to return. If + # unspecified, defaults to a reasonable value. The maximum allowed value is + # 120. Values above 120 will be coerced to 120. + # + # If this field is negative, an INVALID_ARGUMENT is returned. + # @param page_token [::String] + # A page token + # {::Google::Cloud::Retail::V2::SearchResponse#next_page_token SearchResponse.next_page_token}, + # received from a previous + # {::Google::Cloud::Retail::V2::SearchService::Rest::Client#search SearchService.Search} call. + # Provide this to retrieve the subsequent page. + # + # When paginating, all other parameters provided to + # {::Google::Cloud::Retail::V2::SearchService::Rest::Client#search SearchService.Search} must + # match the call that provided the page token. Otherwise, an INVALID_ARGUMENT + # error is returned. + # @param offset [::Integer] + # A 0-indexed integer that specifies the current offset (that is, starting + # result location, amongst the {::Google::Cloud::Retail::V2::Product Product}s + # deemed by the API as relevant) in search results. This field is only + # considered if {::Google::Cloud::Retail::V2::SearchRequest#page_token page_token} + # is unset. + # + # If this field is negative, an INVALID_ARGUMENT is returned. + # @param filter [::String] + # The filter syntax consists of an expression language for constructing a + # predicate from one or more fields of the products being filtered. Filter + # expression is case-sensitive. For more information, see + # [Filter](https://cloud.google.com/retail/docs/filter-and-order#filter). + # + # If this field is unrecognizable, an INVALID_ARGUMENT is returned. + # @param canonical_filter [::String] + # The default filter that is applied when a user performs a search without + # checking any filters on the search page. + # + # The filter applied to every search request when quality improvement such as + # query expansion is needed. In the case a query does not have a sufficient + # amount of results this filter will be used to determine whether or not to + # enable the query expansion flow. The original filter will still be used for + # the query expanded search. + # This field is strongly recommended to achieve high search quality. + # + # For more information about filter syntax, see + # {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}. + # @param order_by [::String] + # The order in which products are returned. Products can be ordered by + # a field in an {::Google::Cloud::Retail::V2::Product Product} object. Leave it + # unset if ordered by relevance. OrderBy expression is case-sensitive. For + # more information, see + # [Order](https://cloud.google.com/retail/docs/filter-and-order#order). + # + # If this field is unrecognizable, an INVALID_ARGUMENT is returned. + # @param facet_specs [::Array<::Google::Cloud::Retail::V2::SearchRequest::FacetSpec, ::Hash>] + # Facet specifications for faceted search. If empty, no facets are returned. + # + # A maximum of 200 values are allowed. Otherwise, an INVALID_ARGUMENT error + # is returned. + # @param dynamic_facet_spec [::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec, ::Hash] + # Deprecated. Refer to https://cloud.google.com/retail/docs/configs#dynamic + # to enable dynamic facets. Do not set this field. + # + # The specification for dynamically generated facets. Notice that only + # textual facets can be dynamically generated. + # @param boost_spec [::Google::Cloud::Retail::V2::SearchRequest::BoostSpec, ::Hash] + # Boost specification to boost certain products. For more information, see + # [Boost results](https://cloud.google.com/retail/docs/boosting). + # + # Notice that if both + # {::Google::Cloud::Retail::V2::ServingConfig#boost_control_ids ServingConfig.boost_control_ids} + # and + # {::Google::Cloud::Retail::V2::SearchRequest#boost_spec SearchRequest.boost_spec} + # are set, the boost conditions from both places are evaluated. If a search + # request matches multiple boost conditions, the final boost score is equal + # to the sum of the boost scores from all matched boost conditions. + # @param query_expansion_spec [::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec, ::Hash] + # The query expansion specification that specifies the conditions under which + # query expansion occurs. For more information, see [Query + # expansion](https://cloud.google.com/retail/docs/result-size#query_expansion). + # @param variant_rollup_keys [::Array<::String>] + # The keys to fetch and rollup the matching + # {::Google::Cloud::Retail::V2::Product::Type::VARIANT variant} + # {::Google::Cloud::Retail::V2::Product Product}s attributes, + # {::Google::Cloud::Retail::V2::FulfillmentInfo FulfillmentInfo} or + # {::Google::Cloud::Retail::V2::LocalInventory LocalInventory}s attributes. The + # attributes from all the matching + # {::Google::Cloud::Retail::V2::Product::Type::VARIANT variant} + # {::Google::Cloud::Retail::V2::Product Product}s or + # {::Google::Cloud::Retail::V2::LocalInventory LocalInventory}s are merged and + # de-duplicated. Notice that rollup attributes will lead to extra query + # latency. Maximum number of keys is 30. + # + # For {::Google::Cloud::Retail::V2::FulfillmentInfo FulfillmentInfo}, a + # fulfillment type and a fulfillment ID must be provided in the format of + # "fulfillmentType.fulfillmentId". E.g., in "pickupInStore.store123", + # "pickupInStore" is fulfillment type and "store123" is the store ID. + # + # Supported keys are: + # + # * colorFamilies + # * price + # * originalPrice + # * discount + # * variantId + # * inventory(place_id,price) + # * inventory(place_id,original_price) + # * inventory(place_id,attributes.key), where key is any key in the + # {::Google::Cloud::Retail::V2::LocalInventory#attributes Product.local_inventories.attributes} + # map. + # * attributes.key, where key is any key in the + # {::Google::Cloud::Retail::V2::Product#attributes Product.attributes} map. + # * pickupInStore.id, where id is any + # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} + # for {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type} + # "pickup-in-store". + # * shipToStore.id, where id is any + # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} + # for {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type} + # "ship-to-store". + # * sameDayDelivery.id, where id is any + # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} + # for {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type} + # "same-day-delivery". + # * nextDayDelivery.id, where id is any + # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} + # for {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type} + # "next-day-delivery". + # * customFulfillment1.id, where id is any + # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} + # for {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type} + # "custom-type-1". + # * customFulfillment2.id, where id is any + # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} + # for {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type} + # "custom-type-2". + # * customFulfillment3.id, where id is any + # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} + # for {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type} + # "custom-type-3". + # * customFulfillment4.id, where id is any + # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} + # for {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type} + # "custom-type-4". + # * customFulfillment5.id, where id is any + # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} + # for {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type} + # "custom-type-5". + # + # If this field is set to an invalid value other than these, an + # INVALID_ARGUMENT error is returned. + # @param page_categories [::Array<::String>] + # The categories associated with a category page. Must be set for category + # navigation queries to achieve good search quality. The format should be + # the same as + # {::Google::Cloud::Retail::V2::UserEvent#page_categories UserEvent.page_categories}; + # + # To represent full path of category, use '>' sign to separate different + # hierarchies. If '>' is part of the category name, replace it with + # other character(s). + # + # Category pages include special pages such as sales or promotions. For + # instance, a special sale page may have the category hierarchy: + # "pageCategories" : ["Sales > 2017 Black Friday Deals"]. + # @param search_mode [::Google::Cloud::Retail::V2::SearchRequest::SearchMode] + # The search mode of the search request. If not specified, a single search + # request triggers both product search and faceted search. + # @param personalization_spec [::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec, ::Hash] + # The specification for personalization. + # + # Notice that if both + # {::Google::Cloud::Retail::V2::ServingConfig#personalization_spec ServingConfig.personalization_spec} + # and + # {::Google::Cloud::Retail::V2::SearchRequest#personalization_spec SearchRequest.personalization_spec} + # are set. + # {::Google::Cloud::Retail::V2::SearchRequest#personalization_spec SearchRequest.personalization_spec} + # will override + # {::Google::Cloud::Retail::V2::ServingConfig#personalization_spec ServingConfig.personalization_spec}. + # @param labels [::Hash{::String => ::String}] + # The labels applied to a resource must meet the following requirements: + # + # * Each resource can have multiple labels, up to a maximum of 64. + # * Each label must be a key-value pair. + # * Keys have a minimum length of 1 character and a maximum length of 63 + # characters and cannot be empty. Values can be empty and have a maximum + # length of 63 characters. + # * Keys and values can contain only lowercase letters, numeric characters, + # underscores, and dashes. All characters must use UTF-8 encoding, and + # international characters are allowed. + # * The key portion of a label must be unique. However, you can use the same + # key with multiple resources. + # * Keys must start with a lowercase letter or international character. + # + # For more information, see [Requirements for + # labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + # in the Resource Manager documentation. + # @param spell_correction_spec [::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec, ::Hash] + # The spell correction specification that specifies the mode under + # which spell correction will take effect. + # @param entity [::String] + # The entity for customers that may run multiple different entities, domains, + # sites or regions, for example, `Google US`, `Google Ads`, `Waymo`, + # `google.com`, `youtube.com`, etc. + # If this is set, it should be exactly matched with + # {::Google::Cloud::Retail::V2::UserEvent#entity UserEvent.entity} to get search + # results boosted by entity. + # @param conversational_search_spec [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec, ::Hash] + # Optional. This field specifies all conversational related parameters + # addition to traditional retail search. + # @param tile_navigation_spec [::Google::Cloud::Retail::V2::SearchRequest::TileNavigationSpec, ::Hash] + # Optional. This field specifies tile navigation related parameters. + # @param language_code [::String] + # Optional. The BCP-47 language code, such as "en-US" or "sr-Latn" + # [list](https://www.unicode.org/cldr/charts/46/summary/root.html). For more + # information, see [Standardized codes](https://google.aip.dev/143). This + # field helps to better interpret the query. If a value isn't specified, the + # query language code is automatically detected, which may not be accurate. + # @param region_code [::String] + # Optional. The Unicode country/region code (CLDR) of a location, such as + # "US" and "419" + # [list](https://www.unicode.org/cldr/charts/46/supplemental/territory_information.html). + # For more information, see [Standardized codes](https://google.aip.dev/143). + # If set, then results will be boosted based on the region_code provided. + # @param place_id [::String] + # Optional. An id corresponding to a place, such as a store id or region id. + # When specified, we use the price from the local inventory with the matching + # product's + # {::Google::Cloud::Retail::V2::LocalInventory#place_id LocalInventory.place_id} + # for revenue optimization. + # @param user_attributes [::Hash{::String => ::Google::Cloud::Retail::V2::StringList, ::Hash}] + # Optional. The user attributes that could be used for personalization of + # search results. + # * Populate at most 100 key-value pairs per query. + # * Only supports string keys and repeated string values. + # * Duplcate keys are not allowed within a single query. + # + # Example: + # user_attributes: [ + # { key: "pets" + # value { + # values: "dog" + # values: "cat" + # } + # }, + # { key: "state" + # value { + # values: "CA" + # } + # } + # ] + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Retail::V2::SearchResponse::SearchResult>] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Retail::V2::SearchResponse::SearchResult>] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::SearchService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::SearchRequest.new + # + # # Call the search method. + # result = client.search request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Cloud::Retail::V2::SearchResponse::SearchResult. + # p item + # end + # + def search request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::SearchRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.search.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.search.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.search.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @search_service_stub.search request, options do |result, operation| + result = ::Gapic::Rest::PagedEnumerable.new @search_service_stub, :search, "results", request, result, options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the SearchService REST API. + # + # This class represents the configuration for SearchService REST, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::Retail::V2::SearchService::Rest::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # search to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Retail::V2::SearchService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.search.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Retail::V2::SearchService::Rest::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.search.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`String`) The path to a service account key file in JSON format + # * (`Hash`) A service account key as a Hash + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`nil`) indicating no credentials + # + # Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "retail.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration RPC class for the SearchService API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `search` + # @return [::Gapic::Config::Method] + # + attr_reader :search + + # @private + def initialize parent_rpcs = nil + search_config = parent_rpcs.search if parent_rpcs.respond_to? :search + @search = ::Gapic::Config::Method.new search_config + + yield self if block_given? + end + end + end + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/rest/service_stub.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/rest/service_stub.rb new file mode 100644 index 000000000000..826122ca8f8d --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/rest/service_stub.rb @@ -0,0 +1,151 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/retail/v2/search_service_pb" + +module Google + module Cloud + module Retail + module V2 + module SearchService + module Rest + ## + # REST service stub for the SearchService service. + # Service stub contains baseline method implementations + # including transcoding, making the REST call, and deserialing the response. + # + class ServiceStub + # @private + def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger: + # These require statements are intentionally placed here to initialize + # the REST modules only when it's required. + require "gapic/rest" + + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials, + numeric_enums: true, + service_name: self.class, + raise_faraday_errors: false, + logger: logger + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @client_stub.universe_domain + end + + ## + # The effective endpoint + # + # @return [String] + # + def endpoint + @client_stub.endpoint + end + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger stub: false + stub ? @client_stub.stub_logger : @client_stub.logger + end + + ## + # Baseline implementation for the search REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::SearchRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::SearchResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::SearchResponse] + # A result object deserialized from the server's reply + def search request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_search_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "search", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Retail::V2::SearchResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # @private + # + # GRPC transcoding helper method for the search REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::SearchRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_search_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v2/{placement}:search", + body: "*", + matches: [ + ["placement", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/placements/[^/]+/?$}, false] + ] + ) + .with_bindings( + uri_method: :post, + uri_template: "/v2/{placement}:search", + body: "*", + matches: [ + ["placement", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/servingConfigs/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service_pb.rb new file mode 100644 index 000000000000..286deb6e40e7 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service_pb.rb @@ -0,0 +1,61 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/retail/v2/search_service.proto + +require 'google/protobuf' + +require 'google/api/annotations_pb' +require 'google/api/client_pb' +require 'google/api/field_behavior_pb' +require 'google/api/resource_pb' +require 'google/cloud/retail/v2/common_pb' +require 'google/cloud/retail/v2/product_pb' +require 'google/protobuf/field_mask_pb' +require 'google/protobuf/struct_pb' + + +descriptor_data = "\n+google/cloud/retail/v2/search_service.proto\x12\x16google.cloud.retail.v2\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a#google/cloud/retail/v2/common.proto\x1a$google/cloud/retail/v2/product.proto\x1a google/protobuf/field_mask.proto\x1a\x1cgoogle/protobuf/struct.proto\"4\n\x15ProductAttributeValue\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t\"\\\n\x18ProductAttributeInterval\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x32\n\x08interval\x18\x02 \x01(\x0b\x32 .google.cloud.retail.v2.Interval\"\xe8\x01\n\x04Tile\x12P\n\x17product_attribute_value\x18\x01 \x01(\x0b\x32-.google.cloud.retail.v2.ProductAttributeValueH\x00\x12V\n\x1aproduct_attribute_interval\x18\x02 \x01(\x0b\x32\x30.google.cloud.retail.v2.ProductAttributeIntervalH\x00\x12!\n\x19representative_product_id\x18\x03 \x01(\tB\x13\n\x11product_attribute\"\x8d\x1c\n\rSearchRequest\x12\x16\n\tplacement\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x31\n\x06\x62ranch\x18\x02 \x01(\tB!\xfa\x41\x1e\n\x1cretail.googleapis.com/Branch\x12\r\n\x05query\x18\x03 \x01(\t\x12\x17\n\nvisitor_id\x18\x04 \x01(\tB\x03\xe0\x41\x02\x12\x33\n\tuser_info\x18\x05 \x01(\x0b\x32 .google.cloud.retail.v2.UserInfo\x12\x11\n\tpage_size\x18\x07 \x01(\x05\x12\x12\n\npage_token\x18\x08 \x01(\t\x12\x0e\n\x06offset\x18\t \x01(\x05\x12\x0e\n\x06\x66ilter\x18\n \x01(\t\x12\x18\n\x10\x63\x61nonical_filter\x18\x1c \x01(\t\x12\x10\n\x08order_by\x18\x0b \x01(\t\x12\x44\n\x0b\x66\x61\x63\x65t_specs\x18\x0c \x03(\x0b\x32/.google.cloud.retail.v2.SearchRequest.FacetSpec\x12V\n\x12\x64ynamic_facet_spec\x18\x15 \x01(\x0b\x32\x36.google.cloud.retail.v2.SearchRequest.DynamicFacetSpecB\x02\x18\x01\x12\x43\n\nboost_spec\x18\r \x01(\x0b\x32/.google.cloud.retail.v2.SearchRequest.BoostSpec\x12V\n\x14query_expansion_spec\x18\x0e \x01(\x0b\x32\x38.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec\x12\x1b\n\x13variant_rollup_keys\x18\x11 \x03(\t\x12\x17\n\x0fpage_categories\x18\x17 \x03(\t\x12\x45\n\x0bsearch_mode\x18\x1f \x01(\x0e\x32\x30.google.cloud.retail.v2.SearchRequest.SearchMode\x12W\n\x14personalization_spec\x18 \x01(\x0b\x32\x39.google.cloud.retail.v2.SearchRequest.PersonalizationSpec\x12\x41\n\x06labels\x18\" \x03(\x0b\x32\x31.google.cloud.retail.v2.SearchRequest.LabelsEntry\x12]\n\x15spell_correction_spec\x18# \x01(\x0b\x32\x39.google.cloud.retail.v2.SearchRequest.SpellCorrectionSpecH\x00\x88\x01\x01\x12\x0e\n\x06\x65ntity\x18& \x01(\t\x12g\n\x1a\x63onversational_search_spec\x18( \x01(\x0b\x32>.google.cloud.retail.v2.SearchRequest.ConversationalSearchSpecB\x03\xe0\x41\x01\x12[\n\x14tile_navigation_spec\x18) \x01(\x0b\x32\x38.google.cloud.retail.v2.SearchRequest.TileNavigationSpecB\x03\xe0\x41\x01\x12\x1a\n\rlanguage_code\x18+ \x01(\tB\x03\xe0\x41\x01\x12\x18\n\x0bregion_code\x18, \x01(\tB\x03\xe0\x41\x01\x12\x15\n\x08place_id\x18. \x01(\tB\x03\xe0\x41\x01\x12W\n\x0fuser_attributes\x18/ \x03(\x0b\x32\x39.google.cloud.retail.v2.SearchRequest.UserAttributesEntryB\x03\xe0\x41\x01\x1a\x91\x03\n\tFacetSpec\x12P\n\tfacet_key\x18\x01 \x01(\x0b\x32\x38.google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKeyB\x03\xe0\x41\x02\x12\r\n\x05limit\x18\x02 \x01(\x05\x12\x1c\n\x14\x65xcluded_filter_keys\x18\x03 \x03(\t\x12\x1f\n\x17\x65nable_dynamic_position\x18\x04 \x01(\x08\x1a\xe3\x01\n\x08\x46\x61\x63\x65tKey\x12\x10\n\x03key\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x33\n\tintervals\x18\x02 \x03(\x0b\x32 .google.cloud.retail.v2.Interval\x12\x19\n\x11restricted_values\x18\x03 \x03(\t\x12\x10\n\x08prefixes\x18\x08 \x03(\t\x12\x10\n\x08\x63ontains\x18\t \x03(\t\x12\x18\n\x10\x63\x61se_insensitive\x18\n \x01(\x08\x12\x10\n\x08order_by\x18\x04 \x01(\t\x12\r\n\x05query\x18\x05 \x01(\t\x12\x16\n\x0ereturn_min_max\x18\x0b \x01(\x08\x1a\x96\x01\n\x10\x44ynamicFacetSpec\x12I\n\x04mode\x18\x01 \x01(\x0e\x32;.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode\"7\n\x04Mode\x12\x14\n\x10MODE_UNSPECIFIED\x10\x00\x12\x0c\n\x08\x44ISABLED\x10\x01\x12\x0b\n\x07\x45NABLED\x10\x02\x1a\xee\x01\n\tBoostSpec\x12\x61\n\x15\x63ondition_boost_specs\x18\x01 \x03(\x0b\x32\x42.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec\x12\'\n\x1askip_boost_spec_validation\x18\x02 \x01(\x08H\x00\x88\x01\x01\x1a\x36\n\x12\x43onditionBoostSpec\x12\x11\n\tcondition\x18\x01 \x01(\t\x12\r\n\x05\x62oost\x18\x02 \x01(\x02\x42\x1d\n\x1b_skip_boost_spec_validation\x1a\xcb\x01\n\x12QueryExpansionSpec\x12U\n\tcondition\x18\x01 \x01(\x0e\x32\x42.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition\x12\x1e\n\x16pin_unexpanded_results\x18\x02 \x01(\x08\">\n\tCondition\x12\x19\n\x15\x43ONDITION_UNSPECIFIED\x10\x00\x12\x0c\n\x08\x44ISABLED\x10\x01\x12\x08\n\x04\x41UTO\x10\x03\x1a\x99\x01\n\x13PersonalizationSpec\x12L\n\x04mode\x18\x01 \x01(\x0e\x32>.google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode\"4\n\x04Mode\x12\x14\n\x10MODE_UNSPECIFIED\x10\x00\x12\x08\n\x04\x41UTO\x10\x01\x12\x0c\n\x08\x44ISABLED\x10\x02\x1a\xa0\x01\n\x13SpellCorrectionSpec\x12L\n\x04mode\x18\x01 \x01(\x0e\x32>.google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode\";\n\x04Mode\x12\x14\n\x10MODE_UNSPECIFIED\x10\x00\x12\x13\n\x0fSUGGESTION_ONLY\x10\x01\x12\x08\n\x04\x41UTO\x10\x02\x1a\x97\x04\n\x18\x43onversationalSearchSpec\x12\'\n\x1f\x66ollowup_conversation_requested\x18\x01 \x01(\x08\x12\x17\n\x0f\x63onversation_id\x18\x02 \x01(\t\x12^\n\x0buser_answer\x18\x03 \x01(\x0b\x32I.google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec.UserAnswer\x1a\xd8\x02\n\nUserAnswer\x12\x15\n\x0btext_answer\x18\x01 \x01(\tH\x00\x12s\n\x0fselected_answer\x18\x02 \x01(\x0b\x32X.google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec.UserAnswer.SelectedAnswerH\x00\x1a\xb5\x01\n\x0eSelectedAnswer\x12S\n\x18product_attribute_values\x18\x01 \x03(\x0b\x32-.google.cloud.retail.v2.ProductAttributeValueB\x02\x18\x01\x12N\n\x17product_attribute_value\x18\x02 \x01(\x0b\x32-.google.cloud.retail.v2.ProductAttributeValueB\x06\n\x04type\x1al\n\x12TileNavigationSpec\x12!\n\x19tile_navigation_requested\x18\x01 \x01(\x08\x12\x33\n\rapplied_tiles\x18\x02 \x03(\x0b\x32\x1c.google.cloud.retail.v2.Tile\x1a-\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x1aY\n\x13UserAttributesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x31\n\x05value\x18\x02 \x01(\x0b\x32\".google.cloud.retail.v2.StringList:\x02\x38\x01\"[\n\nSearchMode\x12\x1b\n\x17SEARCH_MODE_UNSPECIFIED\x10\x00\x12\x17\n\x13PRODUCT_SEARCH_ONLY\x10\x01\x12\x17\n\x13\x46\x41\x43\x45TED_SEARCH_ONLY\x10\x02\x42\x18\n\x16_spell_correction_spec\"\xa5\x14\n\x0eSearchResponse\x12\x44\n\x07results\x18\x01 \x03(\x0b\x32\x33.google.cloud.retail.v2.SearchResponse.SearchResult\x12<\n\x06\x66\x61\x63\x65ts\x18\x02 \x03(\x0b\x32,.google.cloud.retail.v2.SearchResponse.Facet\x12\x12\n\ntotal_size\x18\x03 \x01(\x05\x12\x17\n\x0f\x63orrected_query\x18\x04 \x01(\t\x12\x19\n\x11\x61ttribution_token\x18\x05 \x01(\t\x12\x17\n\x0fnext_page_token\x18\x06 \x01(\t\x12W\n\x14query_expansion_info\x18\x07 \x01(\x0b\x32\x39.google.cloud.retail.v2.SearchResponse.QueryExpansionInfo\x12\x14\n\x0credirect_uri\x18\n \x01(\t\x12\x18\n\x10\x61pplied_controls\x18\x0c \x03(\t\x12H\n\x14pin_control_metadata\x18\x16 \x01(\x0b\x32*.google.cloud.retail.v2.PinControlMetadata\x12i\n\x1dinvalid_condition_boost_specs\x18\x0e \x03(\x0b\x32\x42.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec\x12?\n\x0f\x65xperiment_info\x18\x11 \x03(\x0b\x32&.google.cloud.retail.v2.ExperimentInfo\x12g\n\x1c\x63onversational_search_result\x18\x12 \x01(\x0b\x32\x41.google.cloud.retail.v2.SearchResponse.ConversationalSearchResult\x12[\n\x16tile_navigation_result\x18\x13 \x01(\x0b\x32;.google.cloud.retail.v2.SearchResponse.TileNavigationResult\x1a\xc5\x05\n\x0cSearchResult\x12\n\n\x02id\x18\x01 \x01(\t\x12\x30\n\x07product\x18\x02 \x01(\x0b\x32\x1f.google.cloud.retail.v2.Product\x12\x1e\n\x16matching_variant_count\x18\x03 \x01(\x05\x12o\n\x17matching_variant_fields\x18\x04 \x03(\x0b\x32N.google.cloud.retail.v2.SearchResponse.SearchResult.MatchingVariantFieldsEntry\x12k\n\x15variant_rollup_values\x18\x05 \x03(\x0b\x32L.google.cloud.retail.v2.SearchResponse.SearchResult.VariantRollupValuesEntry\x12\x17\n\x0fpersonal_labels\x18\x07 \x03(\t\x12Z\n\x0cmodel_scores\x18\x08 \x03(\x0b\x32\x44.google.cloud.retail.v2.SearchResponse.SearchResult.ModelScoresEntry\x1aX\n\x1aMatchingVariantFieldsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12)\n\x05value\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMask:\x02\x38\x01\x1aR\n\x18VariantRollupValuesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12%\n\x05value\x18\x02 \x01(\x0b\x32\x16.google.protobuf.Value:\x02\x38\x01\x1aV\n\x10ModelScoresEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x31\n\x05value\x18\x02 \x01(\x0b\x32\".google.cloud.retail.v2.DoubleList:\x02\x38\x01\x1a\x8e\x02\n\x05\x46\x61\x63\x65t\x12\x0b\n\x03key\x18\x01 \x01(\t\x12G\n\x06values\x18\x02 \x03(\x0b\x32\x37.google.cloud.retail.v2.SearchResponse.Facet.FacetValue\x12\x15\n\rdynamic_facet\x18\x03 \x01(\x08\x1a\x97\x01\n\nFacetValue\x12\x0f\n\x05value\x18\x01 \x01(\tH\x00\x12\x34\n\x08interval\x18\x02 \x01(\x0b\x32 .google.cloud.retail.v2.IntervalH\x00\x12\r\n\x05\x63ount\x18\x03 \x01(\x03\x12\x11\n\tmin_value\x18\x05 \x01(\x01\x12\x11\n\tmax_value\x18\x06 \x01(\x01\x42\r\n\x0b\x66\x61\x63\x65t_value\x1aI\n\x12QueryExpansionInfo\x12\x16\n\x0e\x65xpanded_query\x18\x01 \x01(\x08\x12\x1b\n\x13pinned_result_count\x18\x02 \x01(\x03\x1a\xff\x04\n\x1a\x43onversationalSearchResult\x12\x17\n\x0f\x63onversation_id\x18\x01 \x01(\t\x12\x15\n\rrefined_query\x18\x02 \x01(\t\x12r\n\x12\x61\x64\x64itional_filters\x18\x03 \x03(\x0b\x32R.google.cloud.retail.v2.SearchResponse.ConversationalSearchResult.AdditionalFilterB\x02\x18\x01\x12\x19\n\x11\x66ollowup_question\x18\x04 \x01(\t\x12l\n\x11suggested_answers\x18\x05 \x03(\x0b\x32Q.google.cloud.retail.v2.SearchResponse.ConversationalSearchResult.SuggestedAnswer\x12m\n\x11\x61\x64\x64itional_filter\x18\x06 \x01(\x0b\x32R.google.cloud.retail.v2.SearchResponse.ConversationalSearchResult.AdditionalFilter\x1a\x61\n\x0fSuggestedAnswer\x12N\n\x17product_attribute_value\x18\x01 \x01(\x0b\x32-.google.cloud.retail.v2.ProductAttributeValue\x1a\x62\n\x10\x41\x64\x64itionalFilter\x12N\n\x17product_attribute_value\x18\x01 \x01(\x0b\x32-.google.cloud.retail.v2.ProductAttributeValue\x1a\x43\n\x14TileNavigationResult\x12+\n\x05tiles\x18\x01 \x03(\x0b\x32\x1c.google.cloud.retail.v2.Tile\"\xfb\x02\n\x0e\x45xperimentInfo\x12\x63\n\x19serving_config_experiment\x18\x02 \x01(\x0b\x32>.google.cloud.retail.v2.ExperimentInfo.ServingConfigExperimentH\x00\x12\x39\n\nexperiment\x18\x01 \x01(\tB%\xfa\x41\"\n retail.googleapis.com/Experiment\x1a\xb1\x01\n\x17ServingConfigExperiment\x12I\n\x17original_serving_config\x18\x01 \x01(\tB(\xfa\x41%\n#retail.googleapis.com/ServingConfig\x12K\n\x19\x65xperiment_serving_config\x18\x02 \x01(\tB(\xfa\x41%\n#retail.googleapis.com/ServingConfigB\x15\n\x13\x65xperiment_metadata2\xd8\x02\n\rSearchService\x12\xfb\x01\n\x06Search\x12%.google.cloud.retail.v2.SearchRequest\x1a&.google.cloud.retail.v2.SearchResponse\"\xa1\x01\x82\xd3\xe4\x93\x02\x9a\x01\"E/v2/{placement=projects/*/locations/*/catalogs/*/placements/*}:search:\x01*ZN\"I/v2/{placement=projects/*/locations/*/catalogs/*/servingConfigs/*}:search:\x01*\x1aI\xca\x41\x15retail.googleapis.com\xd2\x41.https://www.googleapis.com/auth/cloud-platformB\xb7\x02\n\x1a\x63om.google.cloud.retail.v2B\x12SearchServiceProtoP\x01Z2cloud.google.com/go/retail/apiv2/retailpb;retailpb\xa2\x02\x06RETAIL\xaa\x02\x16Google.Cloud.Retail.V2\xca\x02\x16Google\\Cloud\\Retail\\V2\xea\x02\x19Google::Cloud::Retail::V2\xea\x41w\n retail.googleapis.com/Experiment\x12Sprojects/{project}/locations/{location}/catalogs/{catalog}/experiments/{experiment}b\x06proto3" + +pool = ::Google::Protobuf::DescriptorPool.generated_pool +pool.add_serialized_file(descriptor_data) + +module Google + module Cloud + module Retail + module V2 + ProductAttributeValue = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ProductAttributeValue").msgclass + ProductAttributeInterval = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ProductAttributeInterval").msgclass + Tile = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Tile").msgclass + SearchRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchRequest").msgclass + SearchRequest::FacetSpec = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchRequest.FacetSpec").msgclass + SearchRequest::FacetSpec::FacetKey = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey").msgclass + SearchRequest::DynamicFacetSpec = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchRequest.DynamicFacetSpec").msgclass + SearchRequest::DynamicFacetSpec::Mode = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode").enummodule + SearchRequest::BoostSpec = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchRequest.BoostSpec").msgclass + SearchRequest::BoostSpec::ConditionBoostSpec = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec").msgclass + SearchRequest::QueryExpansionSpec = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchRequest.QueryExpansionSpec").msgclass + SearchRequest::QueryExpansionSpec::Condition = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition").enummodule + SearchRequest::PersonalizationSpec = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchRequest.PersonalizationSpec").msgclass + SearchRequest::PersonalizationSpec::Mode = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode").enummodule + SearchRequest::SpellCorrectionSpec = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec").msgclass + SearchRequest::SpellCorrectionSpec::Mode = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode").enummodule + SearchRequest::ConversationalSearchSpec = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec").msgclass + SearchRequest::ConversationalSearchSpec::UserAnswer = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec.UserAnswer").msgclass + SearchRequest::ConversationalSearchSpec::UserAnswer::SelectedAnswer = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec.UserAnswer.SelectedAnswer").msgclass + SearchRequest::TileNavigationSpec = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchRequest.TileNavigationSpec").msgclass + SearchRequest::SearchMode = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchRequest.SearchMode").enummodule + SearchResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchResponse").msgclass + SearchResponse::SearchResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchResponse.SearchResult").msgclass + SearchResponse::Facet = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchResponse.Facet").msgclass + SearchResponse::Facet::FacetValue = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchResponse.Facet.FacetValue").msgclass + SearchResponse::QueryExpansionInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchResponse.QueryExpansionInfo").msgclass + SearchResponse::ConversationalSearchResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchResponse.ConversationalSearchResult").msgclass + SearchResponse::ConversationalSearchResult::SuggestedAnswer = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchResponse.ConversationalSearchResult.SuggestedAnswer").msgclass + SearchResponse::ConversationalSearchResult::AdditionalFilter = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchResponse.ConversationalSearchResult.AdditionalFilter").msgclass + SearchResponse::TileNavigationResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchResponse.TileNavigationResult").msgclass + ExperimentInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ExperimentInfo").msgclass + ExperimentInfo::ServingConfigExperiment = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ExperimentInfo.ServingConfigExperiment").msgclass + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service_services_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service_services_pb.rb new file mode 100644 index 000000000000..48bf05ab1516 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service_services_pb.rb @@ -0,0 +1,51 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# Source: google/cloud/retail/v2/search_service.proto for package 'Google.Cloud.Retail.V2' +# Original file comments: +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +require 'grpc' +require 'google/cloud/retail/v2/search_service_pb' + +module Google + module Cloud + module Retail + module V2 + module SearchService + # Service for search. + # + # This feature is only available for users who have Retail Search enabled. + # Enable Retail Search on Cloud Console before using this feature. + class Service + + include ::GRPC::GenericService + + self.marshal_class_method = :encode + self.unmarshal_class_method = :decode + self.service_name = 'google.cloud.retail.v2.SearchService' + + # Performs a search. + # + # This feature is only available for users who have Retail Search enabled. + # Enable Retail Search on Cloud Console before using this feature. + rpc :Search, ::Google::Cloud::Retail::V2::SearchRequest, ::Google::Cloud::Retail::V2::SearchResponse + end + + Stub = Service.rpc_stub_class + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_pb.rb new file mode 100644 index 000000000000..151bee6ebbef --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_pb.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/retail/v2/serving_config.proto + +require 'google/protobuf' + +require 'google/api/field_behavior_pb' +require 'google/api/resource_pb' +require 'google/cloud/retail/v2/common_pb' +require 'google/cloud/retail/v2/search_service_pb' + + +descriptor_data = "\n+google/cloud/retail/v2/serving_config.proto\x12\x16google.cloud.retail.v2\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a#google/cloud/retail/v2/common.proto\x1a+google/cloud/retail/v2/search_service.proto\"\x96\x08\n\rServingConfig\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x05\x12\x19\n\x0c\x64isplay_name\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\x10\n\x08model_id\x18\x03 \x01(\t\x12\x1d\n\x15price_reranking_level\x18\x04 \x01(\t\x12\x19\n\x11\x66\x61\x63\x65t_control_ids\x18\x05 \x03(\t\x12R\n\x12\x64ynamic_facet_spec\x18\x06 \x01(\x0b\x32\x36.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec\x12\x19\n\x11\x62oost_control_ids\x18\x07 \x03(\t\x12\x1a\n\x12\x66ilter_control_ids\x18\t \x03(\t\x12\x1c\n\x14redirect_control_ids\x18\n \x03(\t\x12#\n\x1btwoway_synonyms_control_ids\x18\x12 \x03(\t\x12#\n\x1boneway_synonyms_control_ids\x18\x0c \x03(\t\x12$\n\x1c\x64o_not_associate_control_ids\x18\r \x03(\t\x12\x1f\n\x17replacement_control_ids\x18\x0e \x03(\t\x12\x1a\n\x12ignore_control_ids\x18\x0f \x03(\t\x12\x17\n\x0f\x64iversity_level\x18\x08 \x01(\t\x12K\n\x0e\x64iversity_type\x18\x14 \x01(\x0e\x32\x33.google.cloud.retail.v2.ServingConfig.DiversityType\x12$\n\x1c\x65nable_category_filter_level\x18\x10 \x01(\t\x12\x1c\n\x14ignore_recs_denylist\x18\x18 \x01(\x08\x12W\n\x14personalization_spec\x18\x15 \x01(\x0b\x32\x39.google.cloud.retail.v2.SearchRequest.PersonalizationSpec\x12\x44\n\x0esolution_types\x18\x13 \x03(\x0e\x32$.google.cloud.retail.v2.SolutionTypeB\x06\xe0\x41\x02\xe0\x41\x05\"d\n\rDiversityType\x12\x1e\n\x1a\x44IVERSITY_TYPE_UNSPECIFIED\x10\x00\x12\x18\n\x14RULE_BASED_DIVERSITY\x10\x02\x12\x19\n\x15\x44\x41TA_DRIVEN_DIVERSITY\x10\x03:\x85\x01\xea\x41\x81\x01\n#retail.googleapis.com/ServingConfig\x12Zprojects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}B\xbd\x01\n\x1a\x63om.google.cloud.retail.v2B\x12ServingConfigProtoP\x01Z2cloud.google.com/go/retail/apiv2/retailpb;retailpb\xa2\x02\x06RETAIL\xaa\x02\x16Google.Cloud.Retail.V2\xca\x02\x16Google\\Cloud\\Retail\\V2\xea\x02\x19Google::Cloud::Retail::V2b\x06proto3" + +pool = ::Google::Protobuf::DescriptorPool.generated_pool +pool.add_serialized_file(descriptor_data) + +module Google + module Cloud + module Retail + module V2 + ServingConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ServingConfig").msgclass + ServingConfig::DiversityType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ServingConfig.DiversityType").enummodule + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service.rb new file mode 100644 index 000000000000..4a0503a4322d --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service.rb @@ -0,0 +1,55 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/common" +require "gapic/config" +require "gapic/config/method" + +require "google/cloud/retail/v2/version" + +require "google/cloud/retail/v2/serving_config_service/credentials" +require "google/cloud/retail/v2/serving_config_service/paths" +require "google/cloud/retail/v2/serving_config_service/client" +require "google/cloud/retail/v2/serving_config_service/rest" + +module Google + module Cloud + module Retail + module V2 + ## + # Service for modifying ServingConfig. + # + # @example Load this service and instantiate a gRPC client + # + # require "google/cloud/retail/v2/serving_config_service" + # client = ::Google::Cloud::Retail::V2::ServingConfigService::Client.new + # + # @example Load this service and instantiate a REST client + # + # require "google/cloud/retail/v2/serving_config_service/rest" + # client = ::Google::Cloud::Retail::V2::ServingConfigService::Rest::Client.new + # + module ServingConfigService + end + end + end + end +end + +helper_path = ::File.join __dir__, "serving_config_service", "helpers.rb" +require "google/cloud/retail/v2/serving_config_service/helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/client.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/client.rb new file mode 100644 index 000000000000..1baa4825c690 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/client.rb @@ -0,0 +1,1102 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/cloud/retail/v2/serving_config_service_pb" +require "google/cloud/location" + +module Google + module Cloud + module Retail + module V2 + module ServingConfigService + ## + # Client for the ServingConfigService service. + # + # Service for modifying ServingConfig. + # + class Client + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" + + include Paths + + # @private + attr_reader :serving_config_service_stub + + ## + # Configure the ServingConfigService Client class. + # + # See {::Google::Cloud::Retail::V2::ServingConfigService::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all ServingConfigService clients + # ::Google::Cloud::Retail::V2::ServingConfigService::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "Retail", "V2"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the ServingConfigService Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Cloud::Retail::V2::ServingConfigService::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @serving_config_service_stub.universe_domain + end + + ## + # Create a new ServingConfigService client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::Retail::V2::ServingConfigService::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::Retail::V2::ServingConfigService::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the ServingConfigService client. + # @yieldparam config [Client::Configuration] + # + def initialize + # These require statements are intentionally placed here to initialize + # the gRPC module only when it's required. + # See https://github.com/googleapis/toolkit/issues/446 + require "gapic/grpc" + require "google/cloud/retail/v2/serving_config_service_services_pb" + + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @serving_config_service_stub = ::Gapic::ServiceStub.new( + ::Google::Cloud::Retail::V2::ServingConfigService::Stub, + credentials: credentials, + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + channel_args: @config.channel_args, + interceptors: @config.interceptors, + channel_pool_config: @config.channel_pool, + logger: @config.logger + ) + + @serving_config_service_stub.stub_logger&.info do |entry| + entry.set_system_name + entry.set_service + entry.message = "Created client for #{entry.service}" + entry.set_credentials_fields credentials + entry.set "customEndpoint", @config.endpoint if @config.endpoint + entry.set "defaultTimeout", @config.timeout if @config.timeout + entry.set "quotaProject", @quota_project_id if @quota_project_id + end + + @location_client = Google::Cloud::Location::Locations::Client.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @serving_config_service_stub.endpoint + config.universe_domain = @serving_config_service_stub.universe_domain + config.logger = @serving_config_service_stub.logger if config.respond_to? :logger= + end + end + + ## + # Get the associated client for mix-in of the Locations. + # + # @return [Google::Cloud::Location::Locations::Client] + # + attr_reader :location_client + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @serving_config_service_stub.logger + end + + # Service calls + + ## + # Creates a ServingConfig. + # + # A maximum of 100 {::Google::Cloud::Retail::V2::ServingConfig ServingConfig}s are + # allowed in a {::Google::Cloud::Retail::V2::Catalog Catalog}, otherwise a + # FAILED_PRECONDITION error is returned. + # + # @overload create_serving_config(request, options = nil) + # Pass arguments to `create_serving_config` via a request object, either of type + # {::Google::Cloud::Retail::V2::CreateServingConfigRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::CreateServingConfigRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload create_serving_config(parent: nil, serving_config: nil, serving_config_id: nil) + # Pass arguments to `create_serving_config` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. Full resource name of parent. Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` + # @param serving_config [::Google::Cloud::Retail::V2::ServingConfig, ::Hash] + # Required. The ServingConfig to create. + # @param serving_config_id [::String] + # Required. The ID to use for the ServingConfig, which will become the final + # component of the ServingConfig's resource name. + # + # This value should be 4-63 characters, and valid characters + # are /[a-z][0-9]-_/. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Retail::V2::ServingConfig] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Retail::V2::ServingConfig] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ServingConfigService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::CreateServingConfigRequest.new + # + # # Call the create_serving_config method. + # result = client.create_serving_config request + # + # # The returned object is of type Google::Cloud::Retail::V2::ServingConfig. + # p result + # + def create_serving_config request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::CreateServingConfigRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.create_serving_config.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.create_serving_config.timeout, + metadata: metadata, + retry_policy: @config.rpcs.create_serving_config.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @serving_config_service_stub.call_rpc :create_serving_config, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Deletes a ServingConfig. + # + # Returns a NotFound error if the ServingConfig does not exist. + # + # @overload delete_serving_config(request, options = nil) + # Pass arguments to `delete_serving_config` via a request object, either of type + # {::Google::Cloud::Retail::V2::DeleteServingConfigRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::DeleteServingConfigRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload delete_serving_config(name: nil) + # Pass arguments to `delete_serving_config` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. The resource name of the ServingConfig to delete. Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Protobuf::Empty] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Protobuf::Empty] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ServingConfigService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::DeleteServingConfigRequest.new + # + # # Call the delete_serving_config method. + # result = client.delete_serving_config request + # + # # The returned object is of type Google::Protobuf::Empty. + # p result + # + def delete_serving_config request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::DeleteServingConfigRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.delete_serving_config.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.delete_serving_config.timeout, + metadata: metadata, + retry_policy: @config.rpcs.delete_serving_config.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @serving_config_service_stub.call_rpc :delete_serving_config, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Updates a ServingConfig. + # + # @overload update_serving_config(request, options = nil) + # Pass arguments to `update_serving_config` via a request object, either of type + # {::Google::Cloud::Retail::V2::UpdateServingConfigRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::UpdateServingConfigRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload update_serving_config(serving_config: nil, update_mask: nil) + # Pass arguments to `update_serving_config` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param serving_config [::Google::Cloud::Retail::V2::ServingConfig, ::Hash] + # Required. The ServingConfig to update. + # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] + # Indicates which fields in the provided + # {::Google::Cloud::Retail::V2::ServingConfig ServingConfig} to update. The + # following are NOT supported: + # + # * {::Google::Cloud::Retail::V2::ServingConfig#name ServingConfig.name} + # + # If not set, all supported fields are updated. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Retail::V2::ServingConfig] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Retail::V2::ServingConfig] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ServingConfigService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::UpdateServingConfigRequest.new + # + # # Call the update_serving_config method. + # result = client.update_serving_config request + # + # # The returned object is of type Google::Cloud::Retail::V2::ServingConfig. + # p result + # + def update_serving_config request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::UpdateServingConfigRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.update_serving_config.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.serving_config&.name + header_params["serving_config.name"] = request.serving_config.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.update_serving_config.timeout, + metadata: metadata, + retry_policy: @config.rpcs.update_serving_config.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @serving_config_service_stub.call_rpc :update_serving_config, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets a ServingConfig. + # + # Returns a NotFound error if the ServingConfig does not exist. + # + # @overload get_serving_config(request, options = nil) + # Pass arguments to `get_serving_config` via a request object, either of type + # {::Google::Cloud::Retail::V2::GetServingConfigRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::GetServingConfigRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload get_serving_config(name: nil) + # Pass arguments to `get_serving_config` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. The resource name of the ServingConfig to get. Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Retail::V2::ServingConfig] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Retail::V2::ServingConfig] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ServingConfigService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::GetServingConfigRequest.new + # + # # Call the get_serving_config method. + # result = client.get_serving_config request + # + # # The returned object is of type Google::Cloud::Retail::V2::ServingConfig. + # p result + # + def get_serving_config request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::GetServingConfigRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.get_serving_config.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.get_serving_config.timeout, + metadata: metadata, + retry_policy: @config.rpcs.get_serving_config.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @serving_config_service_stub.call_rpc :get_serving_config, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists all ServingConfigs linked to this catalog. + # + # @overload list_serving_configs(request, options = nil) + # Pass arguments to `list_serving_configs` via a request object, either of type + # {::Google::Cloud::Retail::V2::ListServingConfigsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::ListServingConfigsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload list_serving_configs(parent: nil, page_size: nil, page_token: nil) + # Pass arguments to `list_serving_configs` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. The catalog resource name. Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` + # @param page_size [::Integer] + # Optional. Maximum number of results to return. If unspecified, defaults + # to 100. If a value greater than 100 is provided, at most 100 results are + # returned. + # @param page_token [::String] + # Optional. A page token, received from a previous `ListServingConfigs` call. + # Provide this to retrieve the subsequent page. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Retail::V2::ServingConfig>] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::PagedEnumerable<::Google::Cloud::Retail::V2::ServingConfig>] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ServingConfigService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::ListServingConfigsRequest.new + # + # # Call the list_serving_configs method. + # result = client.list_serving_configs request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Cloud::Retail::V2::ServingConfig. + # p item + # end + # + def list_serving_configs request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ListServingConfigsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.list_serving_configs.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.list_serving_configs.timeout, + metadata: metadata, + retry_policy: @config.rpcs.list_serving_configs.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @serving_config_service_stub.call_rpc :list_serving_configs, request, options: options do |response, operation| + response = ::Gapic::PagedEnumerable.new @serving_config_service_stub, :list_serving_configs, request, response, operation, options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Enables a Control on the specified ServingConfig. + # The control is added in the last position of the list of controls + # it belongs to (e.g. if it's a facet spec control it will be applied + # in the last position of servingConfig.facetSpecIds) + # Returns a ALREADY_EXISTS error if the control has already been applied. + # Returns a FAILED_PRECONDITION error if the addition could exceed maximum + # number of control allowed for that type of control. + # + # @overload add_control(request, options = nil) + # Pass arguments to `add_control` via a request object, either of type + # {::Google::Cloud::Retail::V2::AddControlRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::AddControlRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload add_control(serving_config: nil, control_id: nil) + # Pass arguments to `add_control` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param serving_config [::String] + # Required. The source ServingConfig resource name . Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` + # @param control_id [::String] + # Required. The id of the control to apply. Assumed to be in the same catalog + # as the serving config - if id is not found a NOT_FOUND error is returned. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Retail::V2::ServingConfig] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Retail::V2::ServingConfig] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ServingConfigService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::AddControlRequest.new + # + # # Call the add_control method. + # result = client.add_control request + # + # # The returned object is of type Google::Cloud::Retail::V2::ServingConfig. + # p result + # + def add_control request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::AddControlRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.add_control.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.serving_config + header_params["serving_config"] = request.serving_config + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.add_control.timeout, + metadata: metadata, + retry_policy: @config.rpcs.add_control.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @serving_config_service_stub.call_rpc :add_control, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Disables a Control on the specified ServingConfig. + # The control is removed from the ServingConfig. + # Returns a NOT_FOUND error if the Control is not enabled for the + # ServingConfig. + # + # @overload remove_control(request, options = nil) + # Pass arguments to `remove_control` via a request object, either of type + # {::Google::Cloud::Retail::V2::RemoveControlRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::RemoveControlRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload remove_control(serving_config: nil, control_id: nil) + # Pass arguments to `remove_control` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param serving_config [::String] + # Required. The source ServingConfig resource name . Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` + # @param control_id [::String] + # Required. The id of the control to apply. Assumed to be in the same catalog + # as the serving config. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Retail::V2::ServingConfig] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Retail::V2::ServingConfig] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ServingConfigService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::RemoveControlRequest.new + # + # # Call the remove_control method. + # result = client.remove_control request + # + # # The returned object is of type Google::Cloud::Retail::V2::ServingConfig. + # p result + # + def remove_control request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::RemoveControlRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.remove_control.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.serving_config + header_params["serving_config"] = request.serving_config + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.remove_control.timeout, + metadata: metadata, + retry_policy: @config.rpcs.remove_control.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @serving_config_service_stub.call_rpc :remove_control, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the ServingConfigService API. + # + # This class represents the configuration for ServingConfigService, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::Retail::V2::ServingConfigService::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # create_serving_config to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Retail::V2::ServingConfigService::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.create_serving_config.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Retail::V2::ServingConfigService::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.create_serving_config.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`GRPC::Core::Channel`) a gRPC channel with included credentials + # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object + # * (`nil`) indicating no credentials + # + # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials + # is deprecated. Providing an unvalidated credential configuration to + # Google APIs can compromise the security of your systems and data. + # + # @example + # + # # The recommended way to provide credentials is to use the `make_creds` method + # # on the appropriate credentials class for your environment. + # + # require "googleauth" + # + # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds( + # json_key_io: ::File.open("/path/to/keyfile.json") + # ) + # + # client = ::Google::Cloud::Retail::V2::ServingConfigService::Client.new do |config| + # config.credentials = credentials + # end + # + # @note Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] channel_args + # Extra parameters passed to the gRPC channel. Note: this is ignored if a + # `GRPC::Core::Channel` object is provided as the credential. + # @return [::Hash] + # @!attribute [rw] interceptors + # An array of interceptors that are run before calls are executed. + # @return [::Array<::GRPC::ClientInterceptor>] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional gRPC headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "retail.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) + config_attr :interceptors, nil, ::Array, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration for the channel pool + # @return [::Gapic::ServiceStub::ChannelPool::Configuration] + # + def channel_pool + @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new + end + + ## + # Configuration RPC class for the ServingConfigService API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `create_serving_config` + # @return [::Gapic::Config::Method] + # + attr_reader :create_serving_config + ## + # RPC-specific configuration for `delete_serving_config` + # @return [::Gapic::Config::Method] + # + attr_reader :delete_serving_config + ## + # RPC-specific configuration for `update_serving_config` + # @return [::Gapic::Config::Method] + # + attr_reader :update_serving_config + ## + # RPC-specific configuration for `get_serving_config` + # @return [::Gapic::Config::Method] + # + attr_reader :get_serving_config + ## + # RPC-specific configuration for `list_serving_configs` + # @return [::Gapic::Config::Method] + # + attr_reader :list_serving_configs + ## + # RPC-specific configuration for `add_control` + # @return [::Gapic::Config::Method] + # + attr_reader :add_control + ## + # RPC-specific configuration for `remove_control` + # @return [::Gapic::Config::Method] + # + attr_reader :remove_control + + # @private + def initialize parent_rpcs = nil + create_serving_config_config = parent_rpcs.create_serving_config if parent_rpcs.respond_to? :create_serving_config + @create_serving_config = ::Gapic::Config::Method.new create_serving_config_config + delete_serving_config_config = parent_rpcs.delete_serving_config if parent_rpcs.respond_to? :delete_serving_config + @delete_serving_config = ::Gapic::Config::Method.new delete_serving_config_config + update_serving_config_config = parent_rpcs.update_serving_config if parent_rpcs.respond_to? :update_serving_config + @update_serving_config = ::Gapic::Config::Method.new update_serving_config_config + get_serving_config_config = parent_rpcs.get_serving_config if parent_rpcs.respond_to? :get_serving_config + @get_serving_config = ::Gapic::Config::Method.new get_serving_config_config + list_serving_configs_config = parent_rpcs.list_serving_configs if parent_rpcs.respond_to? :list_serving_configs + @list_serving_configs = ::Gapic::Config::Method.new list_serving_configs_config + add_control_config = parent_rpcs.add_control if parent_rpcs.respond_to? :add_control + @add_control = ::Gapic::Config::Method.new add_control_config + remove_control_config = parent_rpcs.remove_control if parent_rpcs.respond_to? :remove_control + @remove_control = ::Gapic::Config::Method.new remove_control_config + + yield self if block_given? + end + end + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/credentials.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/credentials.rb new file mode 100644 index 000000000000..c42ba1c10eee --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/credentials.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "googleauth" + +module Google + module Cloud + module Retail + module V2 + module ServingConfigService + # Credentials for the ServingConfigService API. + class Credentials < ::Google::Auth::Credentials + self.scope = [ + "https://www.googleapis.com/auth/cloud-platform" + ] + self.env_vars = [ + "RETAIL_CREDENTIALS", + "RETAIL_KEYFILE", + "GOOGLE_CLOUD_CREDENTIALS", + "GOOGLE_CLOUD_KEYFILE", + "GCLOUD_KEYFILE", + "RETAIL_CREDENTIALS_JSON", + "RETAIL_KEYFILE_JSON", + "GOOGLE_CLOUD_CREDENTIALS_JSON", + "GOOGLE_CLOUD_KEYFILE_JSON", + "GCLOUD_KEYFILE_JSON" + ] + self.paths = [ + "~/.config/google_cloud/application_default_credentials.json" + ] + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/paths.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/paths.rb new file mode 100644 index 000000000000..bb9d885a6589 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/paths.rb @@ -0,0 +1,73 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Retail + module V2 + module ServingConfigService + # Path helper methods for the ServingConfigService API. + module Paths + ## + # Create a fully-qualified Catalog resource string. + # + # The resource will be in the following format: + # + # `projects/{project}/locations/{location}/catalogs/{catalog}` + # + # @param project [String] + # @param location [String] + # @param catalog [String] + # + # @return [::String] + def catalog_path project:, location:, catalog: + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" + + "projects/#{project}/locations/#{location}/catalogs/#{catalog}" + end + + ## + # Create a fully-qualified ServingConfig resource string. + # + # The resource will be in the following format: + # + # `projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}` + # + # @param project [String] + # @param location [String] + # @param catalog [String] + # @param serving_config [String] + # + # @return [::String] + def serving_config_path project:, location:, catalog:, serving_config: + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" + raise ::ArgumentError, "catalog cannot contain /" if catalog.to_s.include? "/" + + "projects/#{project}/locations/#{location}/catalogs/#{catalog}/servingConfigs/#{serving_config}" + end + + extend self + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/rest.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/rest.rb new file mode 100644 index 000000000000..f2b31df2bbc7 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/rest.rb @@ -0,0 +1,52 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/rest" +require "gapic/config" +require "gapic/config/method" + +require "google/cloud/retail/v2/version" + +require "google/cloud/retail/v2/serving_config_service/credentials" +require "google/cloud/retail/v2/serving_config_service/paths" +require "google/cloud/retail/v2/serving_config_service/rest/client" + +module Google + module Cloud + module Retail + module V2 + ## + # Service for modifying ServingConfig. + # + # To load this service and instantiate a REST client: + # + # require "google/cloud/retail/v2/serving_config_service/rest" + # client = ::Google::Cloud::Retail::V2::ServingConfigService::Rest::Client.new + # + module ServingConfigService + # Client for the REST transport + module Rest + end + end + end + end + end +end + +helper_path = ::File.join __dir__, "rest", "helpers.rb" +require "google/cloud/retail/v2/serving_config_service/rest/helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/rest/client.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/rest/client.rb new file mode 100644 index 000000000000..6974da79ed98 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/rest/client.rb @@ -0,0 +1,1010 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/cloud/retail/v2/serving_config_service_pb" +require "google/cloud/retail/v2/serving_config_service/rest/service_stub" +require "google/cloud/location/rest" + +module Google + module Cloud + module Retail + module V2 + module ServingConfigService + module Rest + ## + # REST client for the ServingConfigService service. + # + # Service for modifying ServingConfig. + # + class Client + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" + + include Paths + + # @private + attr_reader :serving_config_service_stub + + ## + # Configure the ServingConfigService Client class. + # + # See {::Google::Cloud::Retail::V2::ServingConfigService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all ServingConfigService clients + # ::Google::Cloud::Retail::V2::ServingConfigService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "Retail", "V2"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the ServingConfigService Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Cloud::Retail::V2::ServingConfigService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @serving_config_service_stub.universe_domain + end + + ## + # Create a new ServingConfigService REST client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::Retail::V2::ServingConfigService::Rest::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::Retail::V2::ServingConfigService::Rest::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the ServingConfigService client. + # @yieldparam config [Client::Configuration] + # + def initialize + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @serving_config_service_stub = ::Google::Cloud::Retail::V2::ServingConfigService::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials, + logger: @config.logger + ) + + @serving_config_service_stub.logger(stub: true)&.info do |entry| + entry.set_system_name + entry.set_service + entry.message = "Created client for #{entry.service}" + entry.set_credentials_fields credentials + entry.set "customEndpoint", @config.endpoint if @config.endpoint + entry.set "defaultTimeout", @config.timeout if @config.timeout + entry.set "quotaProject", @quota_project_id if @quota_project_id + end + + @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @serving_config_service_stub.endpoint + config.universe_domain = @serving_config_service_stub.universe_domain + config.logger = @serving_config_service_stub.logger if config.respond_to? :logger= + end + end + + ## + # Get the associated client for mix-in of the Locations. + # + # @return [Google::Cloud::Location::Locations::Rest::Client] + # + attr_reader :location_client + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @serving_config_service_stub.logger + end + + # Service calls + + ## + # Creates a ServingConfig. + # + # A maximum of 100 {::Google::Cloud::Retail::V2::ServingConfig ServingConfig}s are + # allowed in a {::Google::Cloud::Retail::V2::Catalog Catalog}, otherwise a + # FAILED_PRECONDITION error is returned. + # + # @overload create_serving_config(request, options = nil) + # Pass arguments to `create_serving_config` via a request object, either of type + # {::Google::Cloud::Retail::V2::CreateServingConfigRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::CreateServingConfigRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload create_serving_config(parent: nil, serving_config: nil, serving_config_id: nil) + # Pass arguments to `create_serving_config` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. Full resource name of parent. Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` + # @param serving_config [::Google::Cloud::Retail::V2::ServingConfig, ::Hash] + # Required. The ServingConfig to create. + # @param serving_config_id [::String] + # Required. The ID to use for the ServingConfig, which will become the final + # component of the ServingConfig's resource name. + # + # This value should be 4-63 characters, and valid characters + # are /[a-z][0-9]-_/. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::ServingConfig] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::ServingConfig] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ServingConfigService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::CreateServingConfigRequest.new + # + # # Call the create_serving_config method. + # result = client.create_serving_config request + # + # # The returned object is of type Google::Cloud::Retail::V2::ServingConfig. + # p result + # + def create_serving_config request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::CreateServingConfigRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.create_serving_config.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.create_serving_config.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.create_serving_config.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @serving_config_service_stub.create_serving_config request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Deletes a ServingConfig. + # + # Returns a NotFound error if the ServingConfig does not exist. + # + # @overload delete_serving_config(request, options = nil) + # Pass arguments to `delete_serving_config` via a request object, either of type + # {::Google::Cloud::Retail::V2::DeleteServingConfigRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::DeleteServingConfigRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload delete_serving_config(name: nil) + # Pass arguments to `delete_serving_config` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. The resource name of the ServingConfig to delete. Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Protobuf::Empty] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Protobuf::Empty] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ServingConfigService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::DeleteServingConfigRequest.new + # + # # Call the delete_serving_config method. + # result = client.delete_serving_config request + # + # # The returned object is of type Google::Protobuf::Empty. + # p result + # + def delete_serving_config request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::DeleteServingConfigRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.delete_serving_config.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.delete_serving_config.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.delete_serving_config.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @serving_config_service_stub.delete_serving_config request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Updates a ServingConfig. + # + # @overload update_serving_config(request, options = nil) + # Pass arguments to `update_serving_config` via a request object, either of type + # {::Google::Cloud::Retail::V2::UpdateServingConfigRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::UpdateServingConfigRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload update_serving_config(serving_config: nil, update_mask: nil) + # Pass arguments to `update_serving_config` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param serving_config [::Google::Cloud::Retail::V2::ServingConfig, ::Hash] + # Required. The ServingConfig to update. + # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] + # Indicates which fields in the provided + # {::Google::Cloud::Retail::V2::ServingConfig ServingConfig} to update. The + # following are NOT supported: + # + # * {::Google::Cloud::Retail::V2::ServingConfig#name ServingConfig.name} + # + # If not set, all supported fields are updated. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::ServingConfig] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::ServingConfig] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ServingConfigService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::UpdateServingConfigRequest.new + # + # # Call the update_serving_config method. + # result = client.update_serving_config request + # + # # The returned object is of type Google::Cloud::Retail::V2::ServingConfig. + # p result + # + def update_serving_config request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::UpdateServingConfigRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.update_serving_config.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.update_serving_config.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.update_serving_config.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @serving_config_service_stub.update_serving_config request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets a ServingConfig. + # + # Returns a NotFound error if the ServingConfig does not exist. + # + # @overload get_serving_config(request, options = nil) + # Pass arguments to `get_serving_config` via a request object, either of type + # {::Google::Cloud::Retail::V2::GetServingConfigRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::GetServingConfigRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload get_serving_config(name: nil) + # Pass arguments to `get_serving_config` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # Required. The resource name of the ServingConfig to get. Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::ServingConfig] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::ServingConfig] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ServingConfigService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::GetServingConfigRequest.new + # + # # Call the get_serving_config method. + # result = client.get_serving_config request + # + # # The returned object is of type Google::Cloud::Retail::V2::ServingConfig. + # p result + # + def get_serving_config request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::GetServingConfigRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.get_serving_config.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.get_serving_config.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.get_serving_config.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @serving_config_service_stub.get_serving_config request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists all ServingConfigs linked to this catalog. + # + # @overload list_serving_configs(request, options = nil) + # Pass arguments to `list_serving_configs` via a request object, either of type + # {::Google::Cloud::Retail::V2::ListServingConfigsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::ListServingConfigsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload list_serving_configs(parent: nil, page_size: nil, page_token: nil) + # Pass arguments to `list_serving_configs` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. The catalog resource name. Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` + # @param page_size [::Integer] + # Optional. Maximum number of results to return. If unspecified, defaults + # to 100. If a value greater than 100 is provided, at most 100 results are + # returned. + # @param page_token [::String] + # Optional. A page token, received from a previous `ListServingConfigs` call. + # Provide this to retrieve the subsequent page. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Retail::V2::ServingConfig>] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Retail::V2::ServingConfig>] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ServingConfigService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::ListServingConfigsRequest.new + # + # # Call the list_serving_configs method. + # result = client.list_serving_configs request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Cloud::Retail::V2::ServingConfig. + # p item + # end + # + def list_serving_configs request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ListServingConfigsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.list_serving_configs.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.list_serving_configs.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.list_serving_configs.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @serving_config_service_stub.list_serving_configs request, options do |result, operation| + result = ::Gapic::Rest::PagedEnumerable.new @serving_config_service_stub, :list_serving_configs, "serving_configs", request, result, options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Enables a Control on the specified ServingConfig. + # The control is added in the last position of the list of controls + # it belongs to (e.g. if it's a facet spec control it will be applied + # in the last position of servingConfig.facetSpecIds) + # Returns a ALREADY_EXISTS error if the control has already been applied. + # Returns a FAILED_PRECONDITION error if the addition could exceed maximum + # number of control allowed for that type of control. + # + # @overload add_control(request, options = nil) + # Pass arguments to `add_control` via a request object, either of type + # {::Google::Cloud::Retail::V2::AddControlRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::AddControlRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload add_control(serving_config: nil, control_id: nil) + # Pass arguments to `add_control` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param serving_config [::String] + # Required. The source ServingConfig resource name . Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` + # @param control_id [::String] + # Required. The id of the control to apply. Assumed to be in the same catalog + # as the serving config - if id is not found a NOT_FOUND error is returned. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::ServingConfig] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::ServingConfig] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ServingConfigService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::AddControlRequest.new + # + # # Call the add_control method. + # result = client.add_control request + # + # # The returned object is of type Google::Cloud::Retail::V2::ServingConfig. + # p result + # + def add_control request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::AddControlRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.add_control.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.add_control.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.add_control.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @serving_config_service_stub.add_control request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Disables a Control on the specified ServingConfig. + # The control is removed from the ServingConfig. + # Returns a NOT_FOUND error if the Control is not enabled for the + # ServingConfig. + # + # @overload remove_control(request, options = nil) + # Pass arguments to `remove_control` via a request object, either of type + # {::Google::Cloud::Retail::V2::RemoveControlRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::RemoveControlRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload remove_control(serving_config: nil, control_id: nil) + # Pass arguments to `remove_control` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param serving_config [::String] + # Required. The source ServingConfig resource name . Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` + # @param control_id [::String] + # Required. The id of the control to apply. Assumed to be in the same catalog + # as the serving config. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::ServingConfig] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::ServingConfig] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::ServingConfigService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::RemoveControlRequest.new + # + # # Call the remove_control method. + # result = client.remove_control request + # + # # The returned object is of type Google::Cloud::Retail::V2::ServingConfig. + # p result + # + def remove_control request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::RemoveControlRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.remove_control.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.remove_control.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.remove_control.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @serving_config_service_stub.remove_control request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the ServingConfigService REST API. + # + # This class represents the configuration for ServingConfigService REST, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::Retail::V2::ServingConfigService::Rest::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # create_serving_config to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Retail::V2::ServingConfigService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.create_serving_config.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Retail::V2::ServingConfigService::Rest::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.create_serving_config.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`String`) The path to a service account key file in JSON format + # * (`Hash`) A service account key as a Hash + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`nil`) indicating no credentials + # + # Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "retail.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration RPC class for the ServingConfigService API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `create_serving_config` + # @return [::Gapic::Config::Method] + # + attr_reader :create_serving_config + ## + # RPC-specific configuration for `delete_serving_config` + # @return [::Gapic::Config::Method] + # + attr_reader :delete_serving_config + ## + # RPC-specific configuration for `update_serving_config` + # @return [::Gapic::Config::Method] + # + attr_reader :update_serving_config + ## + # RPC-specific configuration for `get_serving_config` + # @return [::Gapic::Config::Method] + # + attr_reader :get_serving_config + ## + # RPC-specific configuration for `list_serving_configs` + # @return [::Gapic::Config::Method] + # + attr_reader :list_serving_configs + ## + # RPC-specific configuration for `add_control` + # @return [::Gapic::Config::Method] + # + attr_reader :add_control + ## + # RPC-specific configuration for `remove_control` + # @return [::Gapic::Config::Method] + # + attr_reader :remove_control + + # @private + def initialize parent_rpcs = nil + create_serving_config_config = parent_rpcs.create_serving_config if parent_rpcs.respond_to? :create_serving_config + @create_serving_config = ::Gapic::Config::Method.new create_serving_config_config + delete_serving_config_config = parent_rpcs.delete_serving_config if parent_rpcs.respond_to? :delete_serving_config + @delete_serving_config = ::Gapic::Config::Method.new delete_serving_config_config + update_serving_config_config = parent_rpcs.update_serving_config if parent_rpcs.respond_to? :update_serving_config + @update_serving_config = ::Gapic::Config::Method.new update_serving_config_config + get_serving_config_config = parent_rpcs.get_serving_config if parent_rpcs.respond_to? :get_serving_config + @get_serving_config = ::Gapic::Config::Method.new get_serving_config_config + list_serving_configs_config = parent_rpcs.list_serving_configs if parent_rpcs.respond_to? :list_serving_configs + @list_serving_configs = ::Gapic::Config::Method.new list_serving_configs_config + add_control_config = parent_rpcs.add_control if parent_rpcs.respond_to? :add_control + @add_control = ::Gapic::Config::Method.new add_control_config + remove_control_config = parent_rpcs.remove_control if parent_rpcs.respond_to? :remove_control + @remove_control = ::Gapic::Config::Method.new remove_control_config + + yield self if block_given? + end + end + end + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/rest/service_stub.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/rest/service_stub.rb new file mode 100644 index 000000000000..ade51caaf6b9 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/rest/service_stub.rb @@ -0,0 +1,512 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/retail/v2/serving_config_service_pb" + +module Google + module Cloud + module Retail + module V2 + module ServingConfigService + module Rest + ## + # REST service stub for the ServingConfigService service. + # Service stub contains baseline method implementations + # including transcoding, making the REST call, and deserialing the response. + # + class ServiceStub + # @private + def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger: + # These require statements are intentionally placed here to initialize + # the REST modules only when it's required. + require "gapic/rest" + + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials, + numeric_enums: true, + service_name: self.class, + raise_faraday_errors: false, + logger: logger + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @client_stub.universe_domain + end + + ## + # The effective endpoint + # + # @return [String] + # + def endpoint + @client_stub.endpoint + end + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger stub: false + stub ? @client_stub.stub_logger : @client_stub.logger + end + + ## + # Baseline implementation for the create_serving_config REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::CreateServingConfigRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::ServingConfig] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::ServingConfig] + # A result object deserialized from the server's reply + def create_serving_config request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_create_serving_config_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "create_serving_config", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Retail::V2::ServingConfig.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the delete_serving_config REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::DeleteServingConfigRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Protobuf::Empty] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Protobuf::Empty] + # A result object deserialized from the server's reply + def delete_serving_config request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_delete_serving_config_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "delete_serving_config", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the update_serving_config REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::UpdateServingConfigRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::ServingConfig] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::ServingConfig] + # A result object deserialized from the server's reply + def update_serving_config request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_update_serving_config_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "update_serving_config", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Retail::V2::ServingConfig.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the get_serving_config REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::GetServingConfigRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::ServingConfig] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::ServingConfig] + # A result object deserialized from the server's reply + def get_serving_config request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_get_serving_config_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "get_serving_config", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Retail::V2::ServingConfig.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the list_serving_configs REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::ListServingConfigsRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::ListServingConfigsResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::ListServingConfigsResponse] + # A result object deserialized from the server's reply + def list_serving_configs request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_list_serving_configs_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "list_serving_configs", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Retail::V2::ListServingConfigsResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the add_control REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::AddControlRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::ServingConfig] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::ServingConfig] + # A result object deserialized from the server's reply + def add_control request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_add_control_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "add_control", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Retail::V2::ServingConfig.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the remove_control REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::RemoveControlRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::ServingConfig] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::ServingConfig] + # A result object deserialized from the server's reply + def remove_control request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_remove_control_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "remove_control", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Retail::V2::ServingConfig.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # @private + # + # GRPC transcoding helper method for the create_serving_config REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::CreateServingConfigRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_create_serving_config_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v2/{parent}/servingConfigs", + body: "serving_config", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the delete_serving_config REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::DeleteServingConfigRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_delete_serving_config_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :delete, + uri_template: "/v2/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/servingConfigs/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the update_serving_config REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::UpdateServingConfigRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_update_serving_config_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :patch, + uri_template: "/v2/{serving_config.name}", + body: "serving_config", + matches: [ + ["serving_config.name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/servingConfigs/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the get_serving_config REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::GetServingConfigRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_get_serving_config_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v2/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/servingConfigs/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the list_serving_configs REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::ListServingConfigsRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_list_serving_configs_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v2/{parent}/servingConfigs", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the add_control REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::AddControlRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_add_control_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v2/{serving_config}:addControl", + body: "*", + matches: [ + ["serving_config", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/servingConfigs/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the remove_control REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::RemoveControlRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_remove_control_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v2/{serving_config}:removeControl", + body: "*", + matches: [ + ["serving_config", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/servingConfigs/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service_pb.rb new file mode 100644 index 000000000000..8fb9b76b0e85 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service_pb.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/retail/v2/serving_config_service.proto + +require 'google/protobuf' + +require 'google/api/annotations_pb' +require 'google/api/client_pb' +require 'google/api/field_behavior_pb' +require 'google/api/resource_pb' +require 'google/cloud/retail/v2/serving_config_pb' +require 'google/protobuf/empty_pb' +require 'google/protobuf/field_mask_pb' + + +descriptor_data = "\n3google/cloud/retail/v2/serving_config_service.proto\x12\x16google.cloud.retail.v2\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a+google/cloud/retail/v2/serving_config.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\"\xb7\x01\n\x1a\x43reateServingConfigRequest\x12\x35\n\x06parent\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\n\x1dretail.googleapis.com/Catalog\x12\x42\n\x0eserving_config\x18\x02 \x01(\x0b\x32%.google.cloud.retail.v2.ServingConfigB\x03\xe0\x41\x02\x12\x1e\n\x11serving_config_id\x18\x03 \x01(\tB\x03\xe0\x41\x02\"\x91\x01\n\x1aUpdateServingConfigRequest\x12\x42\n\x0eserving_config\x18\x01 \x01(\x0b\x32%.google.cloud.retail.v2.ServingConfigB\x03\xe0\x41\x02\x12/\n\x0bupdate_mask\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMask\"W\n\x1a\x44\x65leteServingConfigRequest\x12\x39\n\x04name\x18\x01 \x01(\tB+\xe0\x41\x02\xfa\x41%\n#retail.googleapis.com/ServingConfig\"T\n\x17GetServingConfigRequest\x12\x39\n\x04name\x18\x01 \x01(\tB+\xe0\x41\x02\xfa\x41%\n#retail.googleapis.com/ServingConfig\"\x83\x01\n\x19ListServingConfigsRequest\x12\x35\n\x06parent\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\n\x1dretail.googleapis.com/Catalog\x12\x16\n\tpage_size\x18\x02 \x01(\x05\x42\x03\xe0\x41\x01\x12\x17\n\npage_token\x18\x03 \x01(\tB\x03\xe0\x41\x01\"u\n\x1aListServingConfigsResponse\x12>\n\x0fserving_configs\x18\x01 \x03(\x0b\x32%.google.cloud.retail.v2.ServingConfig\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t\"q\n\x11\x41\x64\x64\x43ontrolRequest\x12\x43\n\x0eserving_config\x18\x01 \x01(\tB+\xe0\x41\x02\xfa\x41%\n#retail.googleapis.com/ServingConfig\x12\x17\n\ncontrol_id\x18\x02 \x01(\tB\x03\xe0\x41\x02\"t\n\x14RemoveControlRequest\x12\x43\n\x0eserving_config\x18\x01 \x01(\tB+\xe0\x41\x02\xfa\x41%\n#retail.googleapis.com/ServingConfig\x12\x17\n\ncontrol_id\x18\x02 \x01(\tB\x03\xe0\x41\x02\x32\xb2\x0c\n\x14ServingConfigService\x12\xf1\x01\n\x13\x43reateServingConfig\x12\x32.google.cloud.retail.v2.CreateServingConfigRequest\x1a%.google.cloud.retail.v2.ServingConfig\"\x7f\xda\x41\'parent,serving_config,serving_config_id\x82\xd3\xe4\x93\x02O\"=/v2/{parent=projects/*/locations/*/catalogs/*}/servingConfigs:\x0eserving_config\x12\xaf\x01\n\x13\x44\x65leteServingConfig\x12\x32.google.cloud.retail.v2.DeleteServingConfigRequest\x1a\x16.google.protobuf.Empty\"L\xda\x41\x04name\x82\xd3\xe4\x93\x02?*=/v2/{name=projects/*/locations/*/catalogs/*/servingConfigs/*}\x12\xf4\x01\n\x13UpdateServingConfig\x12\x32.google.cloud.retail.v2.UpdateServingConfigRequest\x1a%.google.cloud.retail.v2.ServingConfig\"\x81\x01\xda\x41\x1aserving_config,update_mask\x82\xd3\xe4\x93\x02^2L/v2/{serving_config.name=projects/*/locations/*/catalogs/*/servingConfigs/*}:\x0eserving_config\x12\xb8\x01\n\x10GetServingConfig\x12/.google.cloud.retail.v2.GetServingConfigRequest\x1a%.google.cloud.retail.v2.ServingConfig\"L\xda\x41\x04name\x82\xd3\xe4\x93\x02?\x12=/v2/{name=projects/*/locations/*/catalogs/*/servingConfigs/*}\x12\xcb\x01\n\x12ListServingConfigs\x12\x31.google.cloud.retail.v2.ListServingConfigsRequest\x1a\x32.google.cloud.retail.v2.ListServingConfigsResponse\"N\xda\x41\x06parent\x82\xd3\xe4\x93\x02?\x12=/v2/{parent=projects/*/locations/*/catalogs/*}/servingConfigs\x12\xce\x01\n\nAddControl\x12).google.cloud.retail.v2.AddControlRequest\x1a%.google.cloud.retail.v2.ServingConfig\"n\xda\x41\x0eserving_config\x82\xd3\xe4\x93\x02W\"R/v2/{serving_config=projects/*/locations/*/catalogs/*/servingConfigs/*}:addControl:\x01*\x12\xd7\x01\n\rRemoveControl\x12,.google.cloud.retail.v2.RemoveControlRequest\x1a%.google.cloud.retail.v2.ServingConfig\"q\xda\x41\x0eserving_config\x82\xd3\xe4\x93\x02Z\"U/v2/{serving_config=projects/*/locations/*/catalogs/*/servingConfigs/*}:removeControl:\x01*\x1aI\xca\x41\x15retail.googleapis.com\xd2\x41.https://www.googleapis.com/auth/cloud-platformB\xc4\x01\n\x1a\x63om.google.cloud.retail.v2B\x19ServingConfigServiceProtoP\x01Z2cloud.google.com/go/retail/apiv2/retailpb;retailpb\xa2\x02\x06RETAIL\xaa\x02\x16Google.Cloud.Retail.V2\xca\x02\x16Google\\Cloud\\Retail\\V2\xea\x02\x19Google::Cloud::Retail::V2b\x06proto3" + +pool = ::Google::Protobuf::DescriptorPool.generated_pool +pool.add_serialized_file(descriptor_data) + +module Google + module Cloud + module Retail + module V2 + CreateServingConfigRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CreateServingConfigRequest").msgclass + UpdateServingConfigRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.UpdateServingConfigRequest").msgclass + DeleteServingConfigRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.DeleteServingConfigRequest").msgclass + GetServingConfigRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.GetServingConfigRequest").msgclass + ListServingConfigsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ListServingConfigsRequest").msgclass + ListServingConfigsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ListServingConfigsResponse").msgclass + AddControlRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.AddControlRequest").msgclass + RemoveControlRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.RemoveControlRequest").msgclass + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service_services_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service_services_pb.rb new file mode 100644 index 000000000000..ae1db2fde215 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service_services_pb.rb @@ -0,0 +1,74 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# Source: google/cloud/retail/v2/serving_config_service.proto for package 'Google.Cloud.Retail.V2' +# Original file comments: +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +require 'grpc' +require 'google/cloud/retail/v2/serving_config_service_pb' + +module Google + module Cloud + module Retail + module V2 + module ServingConfigService + # Service for modifying ServingConfig. + class Service + + include ::GRPC::GenericService + + self.marshal_class_method = :encode + self.unmarshal_class_method = :decode + self.service_name = 'google.cloud.retail.v2.ServingConfigService' + + # Creates a ServingConfig. + # + # A maximum of 100 [ServingConfig][google.cloud.retail.v2.ServingConfig]s are + # allowed in a [Catalog][google.cloud.retail.v2.Catalog], otherwise a + # FAILED_PRECONDITION error is returned. + rpc :CreateServingConfig, ::Google::Cloud::Retail::V2::CreateServingConfigRequest, ::Google::Cloud::Retail::V2::ServingConfig + # Deletes a ServingConfig. + # + # Returns a NotFound error if the ServingConfig does not exist. + rpc :DeleteServingConfig, ::Google::Cloud::Retail::V2::DeleteServingConfigRequest, ::Google::Protobuf::Empty + # Updates a ServingConfig. + rpc :UpdateServingConfig, ::Google::Cloud::Retail::V2::UpdateServingConfigRequest, ::Google::Cloud::Retail::V2::ServingConfig + # Gets a ServingConfig. + # + # Returns a NotFound error if the ServingConfig does not exist. + rpc :GetServingConfig, ::Google::Cloud::Retail::V2::GetServingConfigRequest, ::Google::Cloud::Retail::V2::ServingConfig + # Lists all ServingConfigs linked to this catalog. + rpc :ListServingConfigs, ::Google::Cloud::Retail::V2::ListServingConfigsRequest, ::Google::Cloud::Retail::V2::ListServingConfigsResponse + # Enables a Control on the specified ServingConfig. + # The control is added in the last position of the list of controls + # it belongs to (e.g. if it's a facet spec control it will be applied + # in the last position of servingConfig.facetSpecIds) + # Returns a ALREADY_EXISTS error if the control has already been applied. + # Returns a FAILED_PRECONDITION error if the addition could exceed maximum + # number of control allowed for that type of control. + rpc :AddControl, ::Google::Cloud::Retail::V2::AddControlRequest, ::Google::Cloud::Retail::V2::ServingConfig + # Disables a Control on the specified ServingConfig. + # The control is removed from the ServingConfig. + # Returns a NOT_FOUND error if the Control is not enabled for the + # ServingConfig. + rpc :RemoveControl, ::Google::Cloud::Retail::V2::RemoveControlRequest, ::Google::Cloud::Retail::V2::ServingConfig + end + + Stub = Service.rpc_stub_class + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_pb.rb new file mode 100644 index 000000000000..f7da172ecbbd --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_pb.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/retail/v2/user_event.proto + +require 'google/protobuf' + +require 'google/api/field_behavior_pb' +require 'google/cloud/retail/v2/common_pb' +require 'google/cloud/retail/v2/product_pb' +require 'google/protobuf/timestamp_pb' +require 'google/protobuf/wrappers_pb' + + +descriptor_data = "\n\'google/cloud/retail/v2/user_event.proto\x12\x16google.cloud.retail.v2\x1a\x1fgoogle/api/field_behavior.proto\x1a#google/cloud/retail/v2/common.proto\x1a$google/cloud/retail/v2/product.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1egoogle/protobuf/wrappers.proto\"\x97\x06\n\tUserEvent\x12\x17\n\nevent_type\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x17\n\nvisitor_id\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\x12\n\nsession_id\x18\x15 \x01(\t\x12.\n\nevent_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x16\n\x0e\x65xperiment_ids\x18\x04 \x03(\t\x12\x19\n\x11\x61ttribution_token\x18\x05 \x01(\t\x12>\n\x0fproduct_details\x18\x06 \x03(\x0b\x32%.google.cloud.retail.v2.ProductDetail\x12\x43\n\x11\x63ompletion_detail\x18\x16 \x01(\x0b\x32(.google.cloud.retail.v2.CompletionDetail\x12\x45\n\nattributes\x18\x07 \x03(\x0b\x32\x31.google.cloud.retail.v2.UserEvent.AttributesEntry\x12\x0f\n\x07\x63\x61rt_id\x18\x08 \x01(\t\x12I\n\x14purchase_transaction\x18\t \x01(\x0b\x32+.google.cloud.retail.v2.PurchaseTransaction\x12\x14\n\x0csearch_query\x18\n \x01(\t\x12\x0e\n\x06\x66ilter\x18\x10 \x01(\t\x12\x10\n\x08order_by\x18\x11 \x01(\t\x12\x0e\n\x06offset\x18\x12 \x01(\x05\x12\x17\n\x0fpage_categories\x18\x0b \x03(\t\x12\x33\n\tuser_info\x18\x0c \x01(\x0b\x32 .google.cloud.retail.v2.UserInfo\x12\x0b\n\x03uri\x18\r \x01(\t\x12\x14\n\x0creferrer_uri\x18\x0e \x01(\t\x12\x14\n\x0cpage_view_id\x18\x0f \x01(\t\x12\x0e\n\x06\x65ntity\x18\x17 \x01(\t\x1aZ\n\x0f\x41ttributesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x36\n\x05value\x18\x02 \x01(\x0b\x32\'.google.cloud.retail.v2.CustomAttribute:\x02\x38\x01\"u\n\rProductDetail\x12\x35\n\x07product\x18\x01 \x01(\x0b\x32\x1f.google.cloud.retail.v2.ProductB\x03\xe0\x41\x02\x12-\n\x08quantity\x18\x02 \x01(\x0b\x32\x1b.google.protobuf.Int32Value\"p\n\x10\x43ompletionDetail\x12$\n\x1c\x63ompletion_attribution_token\x18\x01 \x01(\t\x12\x1b\n\x13selected_suggestion\x18\x02 \x01(\t\x12\x19\n\x11selected_position\x18\x03 \x01(\x05\"n\n\x13PurchaseTransaction\x12\n\n\x02id\x18\x01 \x01(\t\x12\x14\n\x07revenue\x18\x02 \x01(\x02\x42\x03\xe0\x41\x02\x12\x0b\n\x03tax\x18\x03 \x01(\x02\x12\x0c\n\x04\x63ost\x18\x04 \x01(\x02\x12\x1a\n\rcurrency_code\x18\x05 \x01(\tB\x03\xe0\x41\x02\x42\xb9\x01\n\x1a\x63om.google.cloud.retail.v2B\x0eUserEventProtoP\x01Z2cloud.google.com/go/retail/apiv2/retailpb;retailpb\xa2\x02\x06RETAIL\xaa\x02\x16Google.Cloud.Retail.V2\xca\x02\x16Google\\Cloud\\Retail\\V2\xea\x02\x19Google::Cloud::Retail::V2b\x06proto3" + +pool = ::Google::Protobuf::DescriptorPool.generated_pool +pool.add_serialized_file(descriptor_data) + +module Google + module Cloud + module Retail + module V2 + UserEvent = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.UserEvent").msgclass + ProductDetail = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ProductDetail").msgclass + CompletionDetail = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CompletionDetail").msgclass + PurchaseTransaction = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.PurchaseTransaction").msgclass + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service.rb new file mode 100644 index 000000000000..7ff44608d216 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service.rb @@ -0,0 +1,56 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/common" +require "gapic/config" +require "gapic/config/method" + +require "google/cloud/retail/v2/version" + +require "google/cloud/retail/v2/user_event_service/credentials" +require "google/cloud/retail/v2/user_event_service/paths" +require "google/cloud/retail/v2/user_event_service/operations" +require "google/cloud/retail/v2/user_event_service/client" +require "google/cloud/retail/v2/user_event_service/rest" + +module Google + module Cloud + module Retail + module V2 + ## + # Service for ingesting end user actions on the customer website. + # + # @example Load this service and instantiate a gRPC client + # + # require "google/cloud/retail/v2/user_event_service" + # client = ::Google::Cloud::Retail::V2::UserEventService::Client.new + # + # @example Load this service and instantiate a REST client + # + # require "google/cloud/retail/v2/user_event_service/rest" + # client = ::Google::Cloud::Retail::V2::UserEventService::Rest::Client.new + # + module UserEventService + end + end + end + end +end + +helper_path = ::File.join __dir__, "user_event_service", "helpers.rb" +require "google/cloud/retail/v2/user_event_service/helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/client.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/client.rb new file mode 100644 index 000000000000..b7852fd0e142 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/client.rb @@ -0,0 +1,1008 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/cloud/retail/v2/user_event_service_pb" +require "google/cloud/location" + +module Google + module Cloud + module Retail + module V2 + module UserEventService + ## + # Client for the UserEventService service. + # + # Service for ingesting end user actions on the customer website. + # + class Client + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" + + include Paths + + # @private + attr_reader :user_event_service_stub + + ## + # Configure the UserEventService Client class. + # + # See {::Google::Cloud::Retail::V2::UserEventService::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all UserEventService clients + # ::Google::Cloud::Retail::V2::UserEventService::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "Retail", "V2"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config.timeout = 10.0 + default_config.retry_policy = { + initial_delay: 0.1, max_delay: 5.0, multiplier: 1.3, retry_codes: [14, 4] + } + + default_config.rpcs.purge_user_events.timeout = 30.0 + default_config.rpcs.purge_user_events.retry_policy = { + initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [14, 4] + } + + default_config.rpcs.import_user_events.timeout = 600.0 + default_config.rpcs.import_user_events.retry_policy = { + initial_delay: 0.1, max_delay: 300.0, multiplier: 1.3, retry_codes: [14, 4] + } + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the UserEventService Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Cloud::Retail::V2::UserEventService::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @user_event_service_stub.universe_domain + end + + ## + # Create a new UserEventService client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::Retail::V2::UserEventService::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::Retail::V2::UserEventService::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the UserEventService client. + # @yieldparam config [Client::Configuration] + # + def initialize + # These require statements are intentionally placed here to initialize + # the gRPC module only when it's required. + # See https://github.com/googleapis/toolkit/issues/446 + require "gapic/grpc" + require "google/cloud/retail/v2/user_event_service_services_pb" + + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @operations_client = Operations.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain + end + + @user_event_service_stub = ::Gapic::ServiceStub.new( + ::Google::Cloud::Retail::V2::UserEventService::Stub, + credentials: credentials, + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + channel_args: @config.channel_args, + interceptors: @config.interceptors, + channel_pool_config: @config.channel_pool, + logger: @config.logger + ) + + @user_event_service_stub.stub_logger&.info do |entry| + entry.set_system_name + entry.set_service + entry.message = "Created client for #{entry.service}" + entry.set_credentials_fields credentials + entry.set "customEndpoint", @config.endpoint if @config.endpoint + entry.set "defaultTimeout", @config.timeout if @config.timeout + entry.set "quotaProject", @quota_project_id if @quota_project_id + end + + @location_client = Google::Cloud::Location::Locations::Client.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @user_event_service_stub.endpoint + config.universe_domain = @user_event_service_stub.universe_domain + config.logger = @user_event_service_stub.logger if config.respond_to? :logger= + end + end + + ## + # Get the associated client for long-running operations. + # + # @return [::Google::Cloud::Retail::V2::UserEventService::Operations] + # + attr_reader :operations_client + + ## + # Get the associated client for mix-in of the Locations. + # + # @return [Google::Cloud::Location::Locations::Client] + # + attr_reader :location_client + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @user_event_service_stub.logger + end + + # Service calls + + ## + # Writes a single user event. + # + # @overload write_user_event(request, options = nil) + # Pass arguments to `write_user_event` via a request object, either of type + # {::Google::Cloud::Retail::V2::WriteUserEventRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::WriteUserEventRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload write_user_event(parent: nil, user_event: nil, write_async: nil) + # Pass arguments to `write_user_event` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. The parent catalog resource name, such as + # `projects/1234/locations/global/catalogs/default_catalog`. + # @param user_event [::Google::Cloud::Retail::V2::UserEvent, ::Hash] + # Required. User event to write. + # @param write_async [::Boolean] + # If set to true, the user event will be written asynchronously after + # validation, and the API will respond without waiting for the write. + # Therefore, silent failures can occur even if the API returns success. In + # case of silent failures, error messages can be found in Stackdriver logs. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Retail::V2::UserEvent] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Retail::V2::UserEvent] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::UserEventService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::WriteUserEventRequest.new + # + # # Call the write_user_event method. + # result = client.write_user_event request + # + # # The returned object is of type Google::Cloud::Retail::V2::UserEvent. + # p result + # + def write_user_event request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::WriteUserEventRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.write_user_event.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.write_user_event.timeout, + metadata: metadata, + retry_policy: @config.rpcs.write_user_event.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @user_event_service_stub.call_rpc :write_user_event, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Writes a single user event from the browser. + # + # For larger user event payload over 16 KB, the POST method should be used + # instead, otherwise a 400 Bad Request error is returned. + # + # This method is used only by the Retail API JavaScript pixel and Google Tag + # Manager. Users should not call this method directly. + # + # @overload collect_user_event(request, options = nil) + # Pass arguments to `collect_user_event` via a request object, either of type + # {::Google::Cloud::Retail::V2::CollectUserEventRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::CollectUserEventRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload collect_user_event(prebuilt_rule: nil, parent: nil, user_event: nil, uri: nil, ets: nil, raw_json: nil) + # Pass arguments to `collect_user_event` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param prebuilt_rule [::String] + # The prebuilt rule name that can convert a specific type of raw_json. + # For example: "ga4_bq" rule for the GA4 user event schema. + # @param parent [::String] + # Required. The parent catalog name, such as + # `projects/1234/locations/global/catalogs/default_catalog`. + # @param user_event [::String] + # Required. URL encoded UserEvent proto with a length limit of 2,000,000 + # characters. + # @param uri [::String] + # The URL including cgi-parameters but excluding the hash fragment with a + # length limit of 5,000 characters. This is often more useful than the + # referer URL, because many browsers only send the domain for 3rd party + # requests. + # @param ets [::Integer] + # The event timestamp in milliseconds. This prevents browser caching of + # otherwise identical get requests. The name is abbreviated to reduce the + # payload bytes. + # @param raw_json [::String] + # An arbitrary serialized JSON string that contains necessary information + # that can comprise a user event. When this field is specified, the + # user_event field will be ignored. Note: line-delimited JSON is not + # supported, a single JSON only. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Api::HttpBody] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Api::HttpBody] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::UserEventService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::CollectUserEventRequest.new + # + # # Call the collect_user_event method. + # result = client.collect_user_event request + # + # # The returned object is of type Google::Api::HttpBody. + # p result + # + def collect_user_event request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::CollectUserEventRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.collect_user_event.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.collect_user_event.timeout, + metadata: metadata, + retry_policy: @config.rpcs.collect_user_event.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @user_event_service_stub.call_rpc :collect_user_event, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Deletes permanently all user events specified by the filter provided. + # Depending on the number of events specified by the filter, this operation + # could take hours or days to complete. To test a filter, use the list + # command first. + # + # @overload purge_user_events(request, options = nil) + # Pass arguments to `purge_user_events` via a request object, either of type + # {::Google::Cloud::Retail::V2::PurgeUserEventsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::PurgeUserEventsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload purge_user_events(parent: nil, filter: nil, force: nil) + # Pass arguments to `purge_user_events` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. The resource name of the catalog under which the events are + # created. The format is + # `projects/${projectId}/locations/global/catalogs/${catalogId}` + # @param filter [::String] + # Required. The filter string to specify the events to be deleted with a + # length limit of 5,000 characters. Empty string filter is not allowed. The + # eligible fields for filtering are: + # + # * `eventType`: Double quoted + # {::Google::Cloud::Retail::V2::UserEvent#event_type UserEvent.event_type} string. + # * `eventTime`: in ISO 8601 "zulu" format. + # * `visitorId`: Double quoted string. Specifying this will delete all + # events associated with a visitor. + # * `userId`: Double quoted string. Specifying this will delete all events + # associated with a user. + # + # Examples: + # + # * Deleting all events in a time range: + # `eventTime > "2012-04-23T18:25:43.511Z" + # eventTime < "2012-04-23T18:30:43.511Z"` + # * Deleting specific eventType in time range: + # `eventTime > "2012-04-23T18:25:43.511Z" eventType = "detail-page-view"` + # * Deleting all events for a specific visitor: + # `visitorId = "visitor1024"` + # + # The filtering fields are assumed to have an implicit AND. + # @param force [::Boolean] + # Actually perform the purge. + # If `force` is set to false, the method will return the expected purge count + # without deleting any user events. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::UserEventService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::PurgeUserEventsRequest.new + # + # # Call the purge_user_events method. + # result = client.purge_user_events request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def purge_user_events request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::PurgeUserEventsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.purge_user_events.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.purge_user_events.timeout, + metadata: metadata, + retry_policy: @config.rpcs.purge_user_events.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @user_event_service_stub.call_rpc :purge_user_events, request, options: options do |response, operation| + response = ::Gapic::Operation.new response, @operations_client, options: options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Bulk import of User events. Request processing might be + # synchronous. Events that already exist are skipped. + # Use this method for backfilling historical user events. + # + # `Operation.response` is of type `ImportResponse`. Note that it is + # possible for a subset of the items to be successfully inserted. + # `Operation.metadata` is of type `ImportMetadata`. + # + # @overload import_user_events(request, options = nil) + # Pass arguments to `import_user_events` via a request object, either of type + # {::Google::Cloud::Retail::V2::ImportUserEventsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::ImportUserEventsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload import_user_events(parent: nil, input_config: nil, errors_config: nil) + # Pass arguments to `import_user_events` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. `projects/1234/locations/global/catalogs/default_catalog` + # @param input_config [::Google::Cloud::Retail::V2::UserEventInputConfig, ::Hash] + # Required. The desired input location of the data. + # @param errors_config [::Google::Cloud::Retail::V2::ImportErrorsConfig, ::Hash] + # The desired location of errors incurred during the Import. Cannot be set + # for inline user event imports. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::UserEventService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::ImportUserEventsRequest.new + # + # # Call the import_user_events method. + # result = client.import_user_events request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def import_user_events request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ImportUserEventsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.import_user_events.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.import_user_events.timeout, + metadata: metadata, + retry_policy: @config.rpcs.import_user_events.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @user_event_service_stub.call_rpc :import_user_events, request, options: options do |response, operation| + response = ::Gapic::Operation.new response, @operations_client, options: options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Starts a user-event rejoin operation with latest product catalog. Events + # are not annotated with detailed product information for products that are + # missing from the catalog when the user event is ingested. These + # events are stored as unjoined events with limited usage on training and + # serving. You can use this method to start a join operation on specified + # events with the latest version of product catalog. You can also use this + # method to correct events joined with the wrong product catalog. A rejoin + # operation can take hours or days to complete. + # + # @overload rejoin_user_events(request, options = nil) + # Pass arguments to `rejoin_user_events` via a request object, either of type + # {::Google::Cloud::Retail::V2::RejoinUserEventsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::RejoinUserEventsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload rejoin_user_events(parent: nil, user_event_rejoin_scope: nil) + # Pass arguments to `rejoin_user_events` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. The parent catalog resource name, such as + # `projects/1234/locations/global/catalogs/default_catalog`. + # @param user_event_rejoin_scope [::Google::Cloud::Retail::V2::RejoinUserEventsRequest::UserEventRejoinScope] + # The type of the user event rejoin to define the scope and range of the user + # events to be rejoined with the latest product catalog. Defaults to + # `USER_EVENT_REJOIN_SCOPE_UNSPECIFIED` if this field is not set, or set to + # an invalid integer value. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::UserEventService::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::RejoinUserEventsRequest.new + # + # # Call the rejoin_user_events method. + # result = client.rejoin_user_events request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def rejoin_user_events request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::RejoinUserEventsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.rejoin_user_events.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.rejoin_user_events.timeout, + metadata: metadata, + retry_policy: @config.rpcs.rejoin_user_events.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @user_event_service_stub.call_rpc :rejoin_user_events, request, options: options do |response, operation| + response = ::Gapic::Operation.new response, @operations_client, options: options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the UserEventService API. + # + # This class represents the configuration for UserEventService, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::Retail::V2::UserEventService::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # write_user_event to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Retail::V2::UserEventService::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.write_user_event.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Retail::V2::UserEventService::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.write_user_event.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`GRPC::Core::Channel`) a gRPC channel with included credentials + # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object + # * (`nil`) indicating no credentials + # + # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials + # is deprecated. Providing an unvalidated credential configuration to + # Google APIs can compromise the security of your systems and data. + # + # @example + # + # # The recommended way to provide credentials is to use the `make_creds` method + # # on the appropriate credentials class for your environment. + # + # require "googleauth" + # + # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds( + # json_key_io: ::File.open("/path/to/keyfile.json") + # ) + # + # client = ::Google::Cloud::Retail::V2::UserEventService::Client.new do |config| + # config.credentials = credentials + # end + # + # @note Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] channel_args + # Extra parameters passed to the gRPC channel. Note: this is ignored if a + # `GRPC::Core::Channel` object is provided as the credential. + # @return [::Hash] + # @!attribute [rw] interceptors + # An array of interceptors that are run before calls are executed. + # @return [::Array<::GRPC::ClientInterceptor>] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional gRPC headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "retail.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) + config_attr :interceptors, nil, ::Array, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration for the channel pool + # @return [::Gapic::ServiceStub::ChannelPool::Configuration] + # + def channel_pool + @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new + end + + ## + # Configuration RPC class for the UserEventService API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `write_user_event` + # @return [::Gapic::Config::Method] + # + attr_reader :write_user_event + ## + # RPC-specific configuration for `collect_user_event` + # @return [::Gapic::Config::Method] + # + attr_reader :collect_user_event + ## + # RPC-specific configuration for `purge_user_events` + # @return [::Gapic::Config::Method] + # + attr_reader :purge_user_events + ## + # RPC-specific configuration for `import_user_events` + # @return [::Gapic::Config::Method] + # + attr_reader :import_user_events + ## + # RPC-specific configuration for `rejoin_user_events` + # @return [::Gapic::Config::Method] + # + attr_reader :rejoin_user_events + + # @private + def initialize parent_rpcs = nil + write_user_event_config = parent_rpcs.write_user_event if parent_rpcs.respond_to? :write_user_event + @write_user_event = ::Gapic::Config::Method.new write_user_event_config + collect_user_event_config = parent_rpcs.collect_user_event if parent_rpcs.respond_to? :collect_user_event + @collect_user_event = ::Gapic::Config::Method.new collect_user_event_config + purge_user_events_config = parent_rpcs.purge_user_events if parent_rpcs.respond_to? :purge_user_events + @purge_user_events = ::Gapic::Config::Method.new purge_user_events_config + import_user_events_config = parent_rpcs.import_user_events if parent_rpcs.respond_to? :import_user_events + @import_user_events = ::Gapic::Config::Method.new import_user_events_config + rejoin_user_events_config = parent_rpcs.rejoin_user_events if parent_rpcs.respond_to? :rejoin_user_events + @rejoin_user_events = ::Gapic::Config::Method.new rejoin_user_events_config + + yield self if block_given? + end + end + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/credentials.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/credentials.rb new file mode 100644 index 000000000000..d7842cfcb893 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/credentials.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "googleauth" + +module Google + module Cloud + module Retail + module V2 + module UserEventService + # Credentials for the UserEventService API. + class Credentials < ::Google::Auth::Credentials + self.scope = [ + "https://www.googleapis.com/auth/cloud-platform" + ] + self.env_vars = [ + "RETAIL_CREDENTIALS", + "RETAIL_KEYFILE", + "GOOGLE_CLOUD_CREDENTIALS", + "GOOGLE_CLOUD_KEYFILE", + "GCLOUD_KEYFILE", + "RETAIL_CREDENTIALS_JSON", + "RETAIL_KEYFILE_JSON", + "GOOGLE_CLOUD_CREDENTIALS_JSON", + "GOOGLE_CLOUD_KEYFILE_JSON", + "GCLOUD_KEYFILE_JSON" + ] + self.paths = [ + "~/.config/google_cloud/application_default_credentials.json" + ] + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/operations.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/operations.rb new file mode 100644 index 000000000000..77846fecafab --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/operations.rb @@ -0,0 +1,843 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/operation" +require "google/longrunning/operations_pb" + +module Google + module Cloud + module Retail + module V2 + module UserEventService + # Service that implements Longrunning Operations API. + class Operations + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" + + # @private + attr_reader :operations_stub + + ## + # Configuration for the UserEventService Operations API. + # + # @yield [config] Configure the Operations client. + # @yieldparam config [Operations::Configuration] + # + # @return [Operations::Configuration] + # + def self.configure + @configure ||= Operations::Configuration.new + yield @configure if block_given? + @configure + end + + ## + # Configure the UserEventService Operations instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Operations.configure}. + # + # @yield [config] Configure the Operations client. + # @yieldparam config [Operations::Configuration] + # + # @return [Operations::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @operations_stub.universe_domain + end + + ## + # Create a new Operations client object. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Operations::Configuration] + # + def initialize + # These require statements are intentionally placed here to initialize + # the gRPC module only when it's required. + # See https://github.com/googleapis/toolkit/issues/446 + require "gapic/grpc" + require "google/longrunning/operations_services_pb" + + # Create the configuration object + @config = Configuration.new Operations.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + credentials ||= Credentials.default scope: @config.scope + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @operations_stub = ::Gapic::ServiceStub.new( + ::Google::Longrunning::Operations::Stub, + credentials: credentials, + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + channel_args: @config.channel_args, + interceptors: @config.interceptors, + channel_pool_config: @config.channel_pool + ) + + # Used by an LRO wrapper for some methods of this service + @operations_client = self + end + + # Service calls + + ## + # Lists operations that match the specified filter in the request. If the + # server doesn't support this method, it returns `UNIMPLEMENTED`. + # + # @overload list_operations(request, options = nil) + # Pass arguments to `list_operations` via a request object, either of type + # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::ListOperationsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload list_operations(name: nil, filter: nil, page_size: nil, page_token: nil, return_partial_success: nil) + # Pass arguments to `list_operations` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation's parent resource. + # @param filter [::String] + # The standard list filter. + # @param page_size [::Integer] + # The standard list page size. + # @param page_token [::String] + # The standard list page token. + # @param return_partial_success [::Boolean] + # When set to `true`, operations that are reachable are returned as normal, + # and those that are unreachable are returned in the + # [ListOperationsResponse.unreachable] field. + # + # This can only be `true` when reading across collections e.g. when `parent` + # is set to `"projects/example/locations/-"`. + # + # This field is not by default supported and will result in an + # `UNIMPLEMENTED` error if set unless explicitly documented otherwise in + # service or product specific documentation. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::PagedEnumerable<::Gapic::Operation>] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::PagedEnumerable<::Gapic::Operation>] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::ListOperationsRequest.new + # + # # Call the list_operations method. + # result = client.list_operations request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Longrunning::Operation. + # p item + # end + # + def list_operations request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::ListOperationsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.list_operations.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.list_operations.timeout, + metadata: metadata, + retry_policy: @config.rpcs.list_operations.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.call_rpc :list_operations, request, options: options do |response, operation| + wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client } + response = ::Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets the latest state of a long-running operation. Clients can use this + # method to poll the operation result at intervals as recommended by the API + # service. + # + # @overload get_operation(request, options = nil) + # Pass arguments to `get_operation` via a request object, either of type + # {::Google::Longrunning::GetOperationRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::GetOperationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload get_operation(name: nil) + # Pass arguments to `get_operation` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation resource. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::GetOperationRequest.new + # + # # Call the get_operation method. + # result = client.get_operation request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def get_operation request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::GetOperationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.get_operation.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.get_operation.timeout, + metadata: metadata, + retry_policy: @config.rpcs.get_operation.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.call_rpc :get_operation, request, options: options do |response, operation| + response = ::Gapic::Operation.new response, @operations_client, options: options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Deletes a long-running operation. This method indicates that the client is + # no longer interested in the operation result. It does not cancel the + # operation. If the server doesn't support this method, it returns + # `google.rpc.Code.UNIMPLEMENTED`. + # + # @overload delete_operation(request, options = nil) + # Pass arguments to `delete_operation` via a request object, either of type + # {::Google::Longrunning::DeleteOperationRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::DeleteOperationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload delete_operation(name: nil) + # Pass arguments to `delete_operation` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation resource to be deleted. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Protobuf::Empty] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Protobuf::Empty] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::DeleteOperationRequest.new + # + # # Call the delete_operation method. + # result = client.delete_operation request + # + # # The returned object is of type Google::Protobuf::Empty. + # p result + # + def delete_operation request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::DeleteOperationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.delete_operation.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.delete_operation.timeout, + metadata: metadata, + retry_policy: @config.rpcs.delete_operation.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.call_rpc :delete_operation, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Starts asynchronous cancellation on a long-running operation. The server + # makes a best effort to cancel the operation, but success is not + # guaranteed. If the server doesn't support this method, it returns + # `google.rpc.Code.UNIMPLEMENTED`. Clients can use + # Operations.GetOperation or + # other methods to check whether the cancellation succeeded or whether the + # operation completed despite cancellation. On successful cancellation, + # the operation is not deleted; instead, it becomes an operation with + # an {::Google::Longrunning::Operation#error Operation.error} value with a + # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to + # `Code.CANCELLED`. + # + # @overload cancel_operation(request, options = nil) + # Pass arguments to `cancel_operation` via a request object, either of type + # {::Google::Longrunning::CancelOperationRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::CancelOperationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload cancel_operation(name: nil) + # Pass arguments to `cancel_operation` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation resource to be cancelled. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Protobuf::Empty] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Protobuf::Empty] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::CancelOperationRequest.new + # + # # Call the cancel_operation method. + # result = client.cancel_operation request + # + # # The returned object is of type Google::Protobuf::Empty. + # p result + # + def cancel_operation request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::CancelOperationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.cancel_operation.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.name + header_params["name"] = request.name + end + + request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") + metadata[:"x-goog-request-params"] ||= request_params_header + + options.apply_defaults timeout: @config.rpcs.cancel_operation.timeout, + metadata: metadata, + retry_policy: @config.rpcs.cancel_operation.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Waits until the specified long-running operation is done or reaches at most + # a specified timeout, returning the latest state. If the operation is + # already done, the latest state is immediately returned. If the timeout + # specified is greater than the default HTTP/RPC timeout, the HTTP/RPC + # timeout is used. If the server does not support this method, it returns + # `google.rpc.Code.UNIMPLEMENTED`. + # Note that this method is on a best-effort basis. It may return the latest + # state before the specified timeout (including immediately), meaning even an + # immediate response is no guarantee that the operation is done. + # + # @overload wait_operation(request, options = nil) + # Pass arguments to `wait_operation` via a request object, either of type + # {::Google::Longrunning::WaitOperationRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::WaitOperationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. + # + # @overload wait_operation(name: nil, timeout: nil) + # Pass arguments to `wait_operation` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation resource to wait on. + # @param timeout [::Google::Protobuf::Duration, ::Hash] + # The maximum duration to wait before timing out. If left blank, the wait + # will be at most the time permitted by the underlying HTTP/RPC protocol. + # If RPC context deadline is also specified, the shorter one will be used. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::WaitOperationRequest.new + # + # # Call the wait_operation method. + # result = client.wait_operation request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def wait_operation request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::WaitOperationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + metadata = @config.rpcs.wait_operation.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.wait_operation.timeout, + metadata: metadata, + retry_policy: @config.rpcs.wait_operation.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation| + response = ::Gapic::Operation.new response, @operations_client, options: options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the Operations API. + # + # This class represents the configuration for Operations, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Longrunning::Operations::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # list_operations to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Longrunning::Operations::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.list_operations.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Longrunning::Operations::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.list_operations.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`GRPC::Core::Channel`) a gRPC channel with included credentials + # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object + # * (`nil`) indicating no credentials + # + # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials + # is deprecated. Providing an unvalidated credential configuration to + # Google APIs can compromise the security of your systems and data. + # + # @example + # + # # The recommended way to provide credentials is to use the `make_creds` method + # # on the appropriate credentials class for your environment. + # + # require "googleauth" + # + # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds( + # json_key_io: ::File.open("/path/to/keyfile.json") + # ) + # + # client = ::Google::Longrunning::Operations::Client.new do |config| + # config.credentials = credentials + # end + # + # @note Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] channel_args + # Extra parameters passed to the gRPC channel. Note: this is ignored if a + # `GRPC::Core::Channel` object is provided as the credential. + # @return [::Hash] + # @!attribute [rw] interceptors + # An array of interceptors that are run before calls are executed. + # @return [::Array<::GRPC::ClientInterceptor>] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional gRPC headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "retail.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) + config_attr :interceptors, nil, ::Array, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration for the channel pool + # @return [::Gapic::ServiceStub::ChannelPool::Configuration] + # + def channel_pool + @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new + end + + ## + # Configuration RPC class for the Operations API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `list_operations` + # @return [::Gapic::Config::Method] + # + attr_reader :list_operations + ## + # RPC-specific configuration for `get_operation` + # @return [::Gapic::Config::Method] + # + attr_reader :get_operation + ## + # RPC-specific configuration for `delete_operation` + # @return [::Gapic::Config::Method] + # + attr_reader :delete_operation + ## + # RPC-specific configuration for `cancel_operation` + # @return [::Gapic::Config::Method] + # + attr_reader :cancel_operation + ## + # RPC-specific configuration for `wait_operation` + # @return [::Gapic::Config::Method] + # + attr_reader :wait_operation + + # @private + def initialize parent_rpcs = nil + list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations + @list_operations = ::Gapic::Config::Method.new list_operations_config + get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation + @get_operation = ::Gapic::Config::Method.new get_operation_config + delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation + @delete_operation = ::Gapic::Config::Method.new delete_operation_config + cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation + @cancel_operation = ::Gapic::Config::Method.new cancel_operation_config + wait_operation_config = parent_rpcs.wait_operation if parent_rpcs.respond_to? :wait_operation + @wait_operation = ::Gapic::Config::Method.new wait_operation_config + + yield self if block_given? + end + end + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/paths.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/paths.rb new file mode 100644 index 000000000000..83bc1611ec7f --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/paths.rb @@ -0,0 +1,75 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Retail + module V2 + module UserEventService + # Path helper methods for the UserEventService API. + module Paths + ## + # Create a fully-qualified Catalog resource string. + # + # The resource will be in the following format: + # + # `projects/{project}/locations/{location}/catalogs/{catalog}` + # + # @param project [String] + # @param location [String] + # @param catalog [String] + # + # @return [::String] + def catalog_path project:, location:, catalog: + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" + + "projects/#{project}/locations/#{location}/catalogs/#{catalog}" + end + + ## + # Create a fully-qualified Product resource string. + # + # The resource will be in the following format: + # + # `projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}` + # + # @param project [String] + # @param location [String] + # @param catalog [String] + # @param branch [String] + # @param product [String] + # + # @return [::String] + def product_path project:, location:, catalog:, branch:, product: + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" + raise ::ArgumentError, "catalog cannot contain /" if catalog.to_s.include? "/" + raise ::ArgumentError, "branch cannot contain /" if branch.to_s.include? "/" + + "projects/#{project}/locations/#{location}/catalogs/#{catalog}/branches/#{branch}/products/#{product}" + end + + extend self + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/rest.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/rest.rb new file mode 100644 index 000000000000..dfa91294298f --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/rest.rb @@ -0,0 +1,53 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/rest" +require "gapic/config" +require "gapic/config/method" + +require "google/cloud/retail/v2/version" + +require "google/cloud/retail/v2/user_event_service/credentials" +require "google/cloud/retail/v2/user_event_service/paths" +require "google/cloud/retail/v2/user_event_service/rest/operations" +require "google/cloud/retail/v2/user_event_service/rest/client" + +module Google + module Cloud + module Retail + module V2 + ## + # Service for ingesting end user actions on the customer website. + # + # To load this service and instantiate a REST client: + # + # require "google/cloud/retail/v2/user_event_service/rest" + # client = ::Google::Cloud::Retail::V2::UserEventService::Rest::Client.new + # + module UserEventService + # Client for the REST transport + module Rest + end + end + end + end + end +end + +helper_path = ::File.join __dir__, "rest", "helpers.rb" +require "google/cloud/retail/v2/user_event_service/rest/helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/rest/client.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/rest/client.rb new file mode 100644 index 000000000000..623b46759f10 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/rest/client.rb @@ -0,0 +1,930 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/errors" +require "google/cloud/retail/v2/user_event_service_pb" +require "google/cloud/retail/v2/user_event_service/rest/service_stub" +require "google/cloud/location/rest" + +module Google + module Cloud + module Retail + module V2 + module UserEventService + module Rest + ## + # REST client for the UserEventService service. + # + # Service for ingesting end user actions on the customer website. + # + class Client + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" + + include Paths + + # @private + attr_reader :user_event_service_stub + + ## + # Configure the UserEventService Client class. + # + # See {::Google::Cloud::Retail::V2::UserEventService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @example + # + # # Modify the configuration for all UserEventService clients + # ::Google::Cloud::Retail::V2::UserEventService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def self.configure + @configure ||= begin + namespace = ["Google", "Cloud", "Retail", "V2"] + parent_config = while namespace.any? + parent_name = namespace.join "::" + parent_const = const_get parent_name + break parent_const.configure if parent_const.respond_to? :configure + namespace.pop + end + default_config = Client::Configuration.new parent_config + + default_config.timeout = 10.0 + default_config.retry_policy = { + initial_delay: 0.1, max_delay: 5.0, multiplier: 1.3, retry_codes: [14, 4] + } + + default_config.rpcs.purge_user_events.timeout = 30.0 + default_config.rpcs.purge_user_events.retry_policy = { + initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [14, 4] + } + + default_config.rpcs.import_user_events.timeout = 600.0 + default_config.rpcs.import_user_events.retry_policy = { + initial_delay: 0.1, max_delay: 300.0, multiplier: 1.3, retry_codes: [14, 4] + } + + default_config + end + yield @configure if block_given? + @configure + end + + ## + # Configure the UserEventService Client instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Client.configure}. + # + # See {::Google::Cloud::Retail::V2::UserEventService::Rest::Client::Configuration} + # for a description of the configuration fields. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Client::Configuration] + # + # @return [Client::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @user_event_service_stub.universe_domain + end + + ## + # Create a new UserEventService REST client object. + # + # @example + # + # # Create a client using the default configuration + # client = ::Google::Cloud::Retail::V2::UserEventService::Rest::Client.new + # + # # Create a client using a custom configuration + # client = ::Google::Cloud::Retail::V2::UserEventService::Rest::Client.new do |config| + # config.timeout = 10.0 + # end + # + # @yield [config] Configure the UserEventService client. + # @yieldparam config [Client::Configuration] + # + def initialize + # Create the configuration object + @config = Configuration.new Client.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + # Use self-signed JWT if the endpoint is unchanged from default, + # but only if the default endpoint does not have a region prefix. + enable_self_signed_jwt = @config.endpoint.nil? || + (@config.endpoint == Configuration::DEFAULT_ENDPOINT && + !@config.endpoint.split(".").first.include?("-")) + credentials ||= Credentials.default scope: @config.scope, + enable_self_signed_jwt: enable_self_signed_jwt + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @operations_client = ::Google::Cloud::Retail::V2::UserEventService::Rest::Operations.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @config.endpoint + config.universe_domain = @config.universe_domain + end + + @user_event_service_stub = ::Google::Cloud::Retail::V2::UserEventService::Rest::ServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials, + logger: @config.logger + ) + + @user_event_service_stub.logger(stub: true)&.info do |entry| + entry.set_system_name + entry.set_service + entry.message = "Created client for #{entry.service}" + entry.set_credentials_fields credentials + entry.set "customEndpoint", @config.endpoint if @config.endpoint + entry.set "defaultTimeout", @config.timeout if @config.timeout + entry.set "quotaProject", @quota_project_id if @quota_project_id + end + + @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config| + config.credentials = credentials + config.quota_project = @quota_project_id + config.endpoint = @user_event_service_stub.endpoint + config.universe_domain = @user_event_service_stub.universe_domain + config.logger = @user_event_service_stub.logger if config.respond_to? :logger= + end + end + + ## + # Get the associated client for long-running operations. + # + # @return [::Google::Cloud::Retail::V2::UserEventService::Rest::Operations] + # + attr_reader :operations_client + + ## + # Get the associated client for mix-in of the Locations. + # + # @return [Google::Cloud::Location::Locations::Rest::Client] + # + attr_reader :location_client + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @user_event_service_stub.logger + end + + # Service calls + + ## + # Writes a single user event. + # + # @overload write_user_event(request, options = nil) + # Pass arguments to `write_user_event` via a request object, either of type + # {::Google::Cloud::Retail::V2::WriteUserEventRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::WriteUserEventRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload write_user_event(parent: nil, user_event: nil, write_async: nil) + # Pass arguments to `write_user_event` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. The parent catalog resource name, such as + # `projects/1234/locations/global/catalogs/default_catalog`. + # @param user_event [::Google::Cloud::Retail::V2::UserEvent, ::Hash] + # Required. User event to write. + # @param write_async [::Boolean] + # If set to true, the user event will be written asynchronously after + # validation, and the API will respond without waiting for the write. + # Therefore, silent failures can occur even if the API returns success. In + # case of silent failures, error messages can be found in Stackdriver logs. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::UserEvent] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::UserEvent] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::UserEventService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::WriteUserEventRequest.new + # + # # Call the write_user_event method. + # result = client.write_user_event request + # + # # The returned object is of type Google::Cloud::Retail::V2::UserEvent. + # p result + # + def write_user_event request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::WriteUserEventRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.write_user_event.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.write_user_event.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.write_user_event.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @user_event_service_stub.write_user_event request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Writes a single user event from the browser. + # + # For larger user event payload over 16 KB, the POST method should be used + # instead, otherwise a 400 Bad Request error is returned. + # + # This method is used only by the Retail API JavaScript pixel and Google Tag + # Manager. Users should not call this method directly. + # + # @overload collect_user_event(request, options = nil) + # Pass arguments to `collect_user_event` via a request object, either of type + # {::Google::Cloud::Retail::V2::CollectUserEventRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::CollectUserEventRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload collect_user_event(prebuilt_rule: nil, parent: nil, user_event: nil, uri: nil, ets: nil, raw_json: nil) + # Pass arguments to `collect_user_event` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param prebuilt_rule [::String] + # The prebuilt rule name that can convert a specific type of raw_json. + # For example: "ga4_bq" rule for the GA4 user event schema. + # @param parent [::String] + # Required. The parent catalog name, such as + # `projects/1234/locations/global/catalogs/default_catalog`. + # @param user_event [::String] + # Required. URL encoded UserEvent proto with a length limit of 2,000,000 + # characters. + # @param uri [::String] + # The URL including cgi-parameters but excluding the hash fragment with a + # length limit of 5,000 characters. This is often more useful than the + # referer URL, because many browsers only send the domain for 3rd party + # requests. + # @param ets [::Integer] + # The event timestamp in milliseconds. This prevents browser caching of + # otherwise identical get requests. The name is abbreviated to reduce the + # payload bytes. + # @param raw_json [::String] + # An arbitrary serialized JSON string that contains necessary information + # that can comprise a user event. When this field is specified, the + # user_event field will be ignored. Note: line-delimited JSON is not + # supported, a single JSON only. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Api::HttpBody] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Api::HttpBody] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::UserEventService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::CollectUserEventRequest.new + # + # # Call the collect_user_event method. + # result = client.collect_user_event request + # + # # The returned object is of type Google::Api::HttpBody. + # p result + # + def collect_user_event request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::CollectUserEventRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.collect_user_event.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.collect_user_event.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.collect_user_event.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @user_event_service_stub.collect_user_event request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Deletes permanently all user events specified by the filter provided. + # Depending on the number of events specified by the filter, this operation + # could take hours or days to complete. To test a filter, use the list + # command first. + # + # @overload purge_user_events(request, options = nil) + # Pass arguments to `purge_user_events` via a request object, either of type + # {::Google::Cloud::Retail::V2::PurgeUserEventsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::PurgeUserEventsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload purge_user_events(parent: nil, filter: nil, force: nil) + # Pass arguments to `purge_user_events` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. The resource name of the catalog under which the events are + # created. The format is + # `projects/${projectId}/locations/global/catalogs/${catalogId}` + # @param filter [::String] + # Required. The filter string to specify the events to be deleted with a + # length limit of 5,000 characters. Empty string filter is not allowed. The + # eligible fields for filtering are: + # + # * `eventType`: Double quoted + # {::Google::Cloud::Retail::V2::UserEvent#event_type UserEvent.event_type} string. + # * `eventTime`: in ISO 8601 "zulu" format. + # * `visitorId`: Double quoted string. Specifying this will delete all + # events associated with a visitor. + # * `userId`: Double quoted string. Specifying this will delete all events + # associated with a user. + # + # Examples: + # + # * Deleting all events in a time range: + # `eventTime > "2012-04-23T18:25:43.511Z" + # eventTime < "2012-04-23T18:30:43.511Z"` + # * Deleting specific eventType in time range: + # `eventTime > "2012-04-23T18:25:43.511Z" eventType = "detail-page-view"` + # * Deleting all events for a specific visitor: + # `visitorId = "visitor1024"` + # + # The filtering fields are assumed to have an implicit AND. + # @param force [::Boolean] + # Actually perform the purge. + # If `force` is set to false, the method will return the expected purge count + # without deleting any user events. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::UserEventService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::PurgeUserEventsRequest.new + # + # # Call the purge_user_events method. + # result = client.purge_user_events request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def purge_user_events request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::PurgeUserEventsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.purge_user_events.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.purge_user_events.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.purge_user_events.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @user_event_service_stub.purge_user_events request, options do |result, operation| + result = ::Gapic::Operation.new result, @operations_client, options: options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Bulk import of User events. Request processing might be + # synchronous. Events that already exist are skipped. + # Use this method for backfilling historical user events. + # + # `Operation.response` is of type `ImportResponse`. Note that it is + # possible for a subset of the items to be successfully inserted. + # `Operation.metadata` is of type `ImportMetadata`. + # + # @overload import_user_events(request, options = nil) + # Pass arguments to `import_user_events` via a request object, either of type + # {::Google::Cloud::Retail::V2::ImportUserEventsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::ImportUserEventsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload import_user_events(parent: nil, input_config: nil, errors_config: nil) + # Pass arguments to `import_user_events` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. `projects/1234/locations/global/catalogs/default_catalog` + # @param input_config [::Google::Cloud::Retail::V2::UserEventInputConfig, ::Hash] + # Required. The desired input location of the data. + # @param errors_config [::Google::Cloud::Retail::V2::ImportErrorsConfig, ::Hash] + # The desired location of errors incurred during the Import. Cannot be set + # for inline user event imports. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::UserEventService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::ImportUserEventsRequest.new + # + # # Call the import_user_events method. + # result = client.import_user_events request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def import_user_events request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ImportUserEventsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.import_user_events.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.import_user_events.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.import_user_events.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @user_event_service_stub.import_user_events request, options do |result, operation| + result = ::Gapic::Operation.new result, @operations_client, options: options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Starts a user-event rejoin operation with latest product catalog. Events + # are not annotated with detailed product information for products that are + # missing from the catalog when the user event is ingested. These + # events are stored as unjoined events with limited usage on training and + # serving. You can use this method to start a join operation on specified + # events with the latest version of product catalog. You can also use this + # method to correct events joined with the wrong product catalog. A rejoin + # operation can take hours or days to complete. + # + # @overload rejoin_user_events(request, options = nil) + # Pass arguments to `rejoin_user_events` via a request object, either of type + # {::Google::Cloud::Retail::V2::RejoinUserEventsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Retail::V2::RejoinUserEventsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload rejoin_user_events(parent: nil, user_event_rejoin_scope: nil) + # Pass arguments to `rejoin_user_events` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param parent [::String] + # Required. The parent catalog resource name, such as + # `projects/1234/locations/global/catalogs/default_catalog`. + # @param user_event_rejoin_scope [::Google::Cloud::Retail::V2::RejoinUserEventsRequest::UserEventRejoinScope] + # The type of the user event rejoin to define the scope and range of the user + # events to be rejoined with the latest product catalog. Defaults to + # `USER_EVENT_REJOIN_SCOPE_UNSPECIFIED` if this field is not set, or set to + # an invalid integer value. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/retail/v2" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Retail::V2::UserEventService::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Retail::V2::RejoinUserEventsRequest.new + # + # # Call the rejoin_user_events method. + # result = client.rejoin_user_events request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def rejoin_user_events request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::RejoinUserEventsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.rejoin_user_events.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.rejoin_user_events.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.rejoin_user_events.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @user_event_service_stub.rejoin_user_events request, options do |result, operation| + result = ::Gapic::Operation.new result, @operations_client, options: options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the UserEventService REST API. + # + # This class represents the configuration for UserEventService REST, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::Retail::V2::UserEventService::Rest::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # write_user_event to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Retail::V2::UserEventService::Rest::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.write_user_event.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Retail::V2::UserEventService::Rest::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.write_user_event.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`String`) The path to a service account key file in JSON format + # * (`Hash`) A service account key as a Hash + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`nil`) indicating no credentials + # + # Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "retail.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration RPC class for the UserEventService API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `write_user_event` + # @return [::Gapic::Config::Method] + # + attr_reader :write_user_event + ## + # RPC-specific configuration for `collect_user_event` + # @return [::Gapic::Config::Method] + # + attr_reader :collect_user_event + ## + # RPC-specific configuration for `purge_user_events` + # @return [::Gapic::Config::Method] + # + attr_reader :purge_user_events + ## + # RPC-specific configuration for `import_user_events` + # @return [::Gapic::Config::Method] + # + attr_reader :import_user_events + ## + # RPC-specific configuration for `rejoin_user_events` + # @return [::Gapic::Config::Method] + # + attr_reader :rejoin_user_events + + # @private + def initialize parent_rpcs = nil + write_user_event_config = parent_rpcs.write_user_event if parent_rpcs.respond_to? :write_user_event + @write_user_event = ::Gapic::Config::Method.new write_user_event_config + collect_user_event_config = parent_rpcs.collect_user_event if parent_rpcs.respond_to? :collect_user_event + @collect_user_event = ::Gapic::Config::Method.new collect_user_event_config + purge_user_events_config = parent_rpcs.purge_user_events if parent_rpcs.respond_to? :purge_user_events + @purge_user_events = ::Gapic::Config::Method.new purge_user_events_config + import_user_events_config = parent_rpcs.import_user_events if parent_rpcs.respond_to? :import_user_events + @import_user_events = ::Gapic::Config::Method.new import_user_events_config + rejoin_user_events_config = parent_rpcs.rejoin_user_events if parent_rpcs.respond_to? :rejoin_user_events + @rejoin_user_events = ::Gapic::Config::Method.new rejoin_user_events_config + + yield self if block_given? + end + end + end + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/rest/operations.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/rest/operations.rb new file mode 100644 index 000000000000..0cf60d8bffb9 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/rest/operations.rb @@ -0,0 +1,962 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "gapic/operation" + +module Google + module Cloud + module Retail + module V2 + module UserEventService + module Rest + # Service that implements Longrunning Operations API. + class Operations + # @private + API_VERSION = "" + + # @private + DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" + + # @private + attr_reader :operations_stub + + ## + # Configuration for the UserEventService Operations API. + # + # @yield [config] Configure the Operations client. + # @yieldparam config [Operations::Configuration] + # + # @return [Operations::Configuration] + # + def self.configure + @configure ||= Operations::Configuration.new + yield @configure if block_given? + @configure + end + + ## + # Configure the UserEventService Operations instance. + # + # The configuration is set to the derived mode, meaning that values can be changed, + # but structural changes (adding new fields, etc.) are not allowed. Structural changes + # should be made on {Operations.configure}. + # + # @yield [config] Configure the Operations client. + # @yieldparam config [Operations::Configuration] + # + # @return [Operations::Configuration] + # + def configure + yield @config if block_given? + @config + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @operations_stub.universe_domain + end + + ## + # Create a new Operations client object. + # + # @yield [config] Configure the Client client. + # @yieldparam config [Operations::Configuration] + # + def initialize + # Create the configuration object + @config = Configuration.new Operations.configure + + # Yield the configuration if needed + yield @config if block_given? + + # Create credentials + credentials = @config.credentials + credentials ||= Credentials.default scope: @config.scope + if credentials.is_a?(::String) || credentials.is_a?(::Hash) + credentials = Credentials.new credentials, scope: @config.scope + end + + @quota_project_id = @config.quota_project + @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id + + @operations_stub = OperationsServiceStub.new( + endpoint: @config.endpoint, + endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, + universe_domain: @config.universe_domain, + credentials: credentials + ) + + # Used by an LRO wrapper for some methods of this service + @operations_client = self + end + + # Service calls + + ## + # Lists operations that match the specified filter in the request. If the + # server doesn't support this method, it returns `UNIMPLEMENTED`. + # + # @overload list_operations(request, options = nil) + # Pass arguments to `list_operations` via a request object, either of type + # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::ListOperationsRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload list_operations(name: nil, filter: nil, page_size: nil, page_token: nil, return_partial_success: nil) + # Pass arguments to `list_operations` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation's parent resource. + # @param filter [::String] + # The standard list filter. + # @param page_size [::Integer] + # The standard list page size. + # @param page_token [::String] + # The standard list page token. + # @param return_partial_success [::Boolean] + # When set to `true`, operations that are reachable are returned as normal, + # and those that are unreachable are returned in the + # [ListOperationsResponse.unreachable] field. + # + # This can only be `true` when reading across collections e.g. when `parent` + # is set to `"projects/example/locations/-"`. + # + # This field is not by default supported and will result in an + # `UNIMPLEMENTED` error if set unless explicitly documented otherwise in + # service or product specific documentation. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::ListOperationsRequest.new + # + # # Call the list_operations method. + # result = client.list_operations request + # + # # The returned object is of type Gapic::PagedEnumerable. You can iterate + # # over elements, and API calls will be issued to fetch pages as needed. + # result.each do |item| + # # Each element is of type ::Google::Longrunning::Operation. + # p item + # end + # + def list_operations request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::ListOperationsRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.list_operations.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.list_operations.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.list_operations.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.list_operations request, options do |result, operation| + result = ::Gapic::Rest::PagedEnumerable.new @operations_stub, :list_operations, "operations", request, result, options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets the latest state of a long-running operation. Clients can use this + # method to poll the operation result at intervals as recommended by the API + # service. + # + # @overload get_operation(request, options = nil) + # Pass arguments to `get_operation` via a request object, either of type + # {::Google::Longrunning::GetOperationRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::GetOperationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload get_operation(name: nil) + # Pass arguments to `get_operation` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation resource. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::GetOperationRequest.new + # + # # Call the get_operation method. + # result = client.get_operation request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def get_operation request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::GetOperationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.get_operation.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.get_operation.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.get_operation.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.get_operation request, options do |result, operation| + result = ::Gapic::Operation.new result, @operations_client, options: options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Deletes a long-running operation. This method indicates that the client is + # no longer interested in the operation result. It does not cancel the + # operation. If the server doesn't support this method, it returns + # `google.rpc.Code.UNIMPLEMENTED`. + # + # @overload delete_operation(request, options = nil) + # Pass arguments to `delete_operation` via a request object, either of type + # {::Google::Longrunning::DeleteOperationRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::DeleteOperationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload delete_operation(name: nil) + # Pass arguments to `delete_operation` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation resource to be deleted. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Protobuf::Empty] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Protobuf::Empty] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::DeleteOperationRequest.new + # + # # Call the delete_operation method. + # result = client.delete_operation request + # + # # The returned object is of type Google::Protobuf::Empty. + # p result + # + def delete_operation request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::DeleteOperationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.delete_operation.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.delete_operation.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.delete_operation.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.delete_operation request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Starts asynchronous cancellation on a long-running operation. The server + # makes a best effort to cancel the operation, but success is not + # guaranteed. If the server doesn't support this method, it returns + # `google.rpc.Code.UNIMPLEMENTED`. Clients can use + # Operations.GetOperation or + # other methods to check whether the cancellation succeeded or whether the + # operation completed despite cancellation. On successful cancellation, + # the operation is not deleted; instead, it becomes an operation with + # an {::Google::Longrunning::Operation#error Operation.error} value with a + # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to + # `Code.CANCELLED`. + # + # @overload cancel_operation(request, options = nil) + # Pass arguments to `cancel_operation` via a request object, either of type + # {::Google::Longrunning::CancelOperationRequest} or an equivalent Hash. + # + # @param request [::Google::Longrunning::CancelOperationRequest, ::Hash] + # A request object representing the call parameters. Required. To specify no + # parameters, or to keep all the default parameter values, pass an empty Hash. + # @param options [::Gapic::CallOptions, ::Hash] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @overload cancel_operation(name: nil) + # Pass arguments to `cancel_operation` via keyword arguments. Note that at + # least one keyword argument is required. To specify no parameters, or to keep all + # the default parameter values, pass an empty Hash as a request object (see above). + # + # @param name [::String] + # The name of the operation resource to be cancelled. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Protobuf::Empty] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Protobuf::Empty] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/longrunning" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Longrunning::Operations::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Longrunning::CancelOperationRequest.new + # + # # Call the cancel_operation method. + # result = client.cancel_operation request + # + # # The returned object is of type Google::Protobuf::Empty. + # p result + # + def cancel_operation request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::CancelOperationRequest + + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h + + # Customize the options with defaults + call_metadata = @config.rpcs.cancel_operation.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ + lib_name: @config.lib_name, lib_version: @config.lib_version, + gapic_version: ::Google::Cloud::Retail::V2::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.cancel_operation.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.cancel_operation.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @operations_stub.cancel_operation request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the Operations REST API. + # + # This class represents the configuration for Operations REST, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Longrunning::Operations::Rest::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # list_operations to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Longrunning::Operations::Rest::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.list_operations.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Longrunning::Operations::Rest::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.list_operations.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`String`) The path to a service account key file in JSON format + # * (`Hash`) A service account key as a Hash + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`nil`) indicating no credentials + # + # Warning: If you accept a credential configuration (JSON file or Hash) from an + # external source for authentication to Google Cloud, you must validate it before + # providing it to a Google API client library. Providing an unvalidated credential + # configuration to Google APIs can compromise the security of your systems and data. + # For more information, refer to [Validate credential configurations from external + # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "retail.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration RPC class for the Operations API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `list_operations` + # @return [::Gapic::Config::Method] + # + attr_reader :list_operations + ## + # RPC-specific configuration for `get_operation` + # @return [::Gapic::Config::Method] + # + attr_reader :get_operation + ## + # RPC-specific configuration for `delete_operation` + # @return [::Gapic::Config::Method] + # + attr_reader :delete_operation + ## + # RPC-specific configuration for `cancel_operation` + # @return [::Gapic::Config::Method] + # + attr_reader :cancel_operation + + # @private + def initialize parent_rpcs = nil + list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations + @list_operations = ::Gapic::Config::Method.new list_operations_config + get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation + @get_operation = ::Gapic::Config::Method.new get_operation_config + delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation + @delete_operation = ::Gapic::Config::Method.new delete_operation_config + cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation + @cancel_operation = ::Gapic::Config::Method.new cancel_operation_config + + yield self if block_given? + end + end + end + end + + ## + # @private + # REST service stub for the Longrunning Operations API. + # Service stub contains baseline method implementations + # including transcoding, making the REST call, and deserialing the response. + class OperationsServiceStub + def initialize endpoint:, endpoint_template:, universe_domain:, credentials: + # These require statements are intentionally placed here to initialize + # the REST modules only when it's required. + require "gapic/rest" + + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials + end + + ## + # Baseline implementation for the list_operations REST call + # + # @param request_pb [::Google::Longrunning::ListOperationsRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::ListOperationsResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::ListOperationsResponse] + # A result object deserialized from the server's reply + def list_operations request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = OperationsServiceStub.transcode_list_operations_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "list_operations", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::ListOperationsResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the get_operation REST call + # + # @param request_pb [::Google::Longrunning::GetOperationRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::Operation] + # A result object deserialized from the server's reply + def get_operation request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = OperationsServiceStub.transcode_get_operation_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "get_operation", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the delete_operation REST call + # + # @param request_pb [::Google::Longrunning::DeleteOperationRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Protobuf::Empty] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Protobuf::Empty] + # A result object deserialized from the server's reply + def delete_operation request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = OperationsServiceStub.transcode_delete_operation_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "delete_operation", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the cancel_operation REST call + # + # @param request_pb [::Google::Longrunning::CancelOperationRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Protobuf::Empty] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Protobuf::Empty] + # A result object deserialized from the server's reply + def cancel_operation request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = OperationsServiceStub.transcode_cancel_operation_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "cancel_operation", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # @private + # + # GRPC transcoding helper method for the list_operations REST call + # + # @param request_pb [::Google::Longrunning::ListOperationsRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_list_operations_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v2/{name}/operations", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/?$}, false] + ] + ) + .with_bindings( + uri_method: :get, + uri_template: "/v2/{name}/operations", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] + ] + ) + .with_bindings( + uri_method: :get, + uri_template: "/v2/{name}/operations", + matches: [ + ["name", %r{^projects/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the get_operation REST call + # + # @param request_pb [::Google::Longrunning::GetOperationRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_get_operation_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v2/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/operations/[^/]+/?$}, false] + ] + ) + .with_bindings( + uri_method: :get, + uri_template: "/v2/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/branches/[^/]+/operations/[^/]+/?$}, false] + ] + ) + .with_bindings( + uri_method: :get, + uri_template: "/v2/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/operations/[^/]+/?$}, false] + ] + ) + .with_bindings( + uri_method: :get, + uri_template: "/v2/{name}", + matches: [ + ["name", %r{^projects/[^/]+/operations/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the delete_operation REST call + # + # @param request_pb [::Google::Longrunning::DeleteOperationRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_delete_operation_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :delete, + uri_template: "/v1/{name}", + matches: [ + ["name", %r{^operations(?:/(?<__wildcard__>.*))?$}, true] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the cancel_operation REST call + # + # @param request_pb [::Google::Longrunning::CancelOperationRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_cancel_operation_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1/{name}:cancel", + body: "*", + matches: [ + ["name", %r{^operations(?:/(?<__wildcard__>.*))?$}, true] + ] + ) + transcoder.transcode request_pb + end + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/rest/service_stub.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/rest/service_stub.rb new file mode 100644 index 000000000000..d2603e85207f --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/rest/service_stub.rb @@ -0,0 +1,398 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "google/cloud/retail/v2/user_event_service_pb" + +module Google + module Cloud + module Retail + module V2 + module UserEventService + module Rest + ## + # REST service stub for the UserEventService service. + # Service stub contains baseline method implementations + # including transcoding, making the REST call, and deserialing the response. + # + class ServiceStub + # @private + def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger: + # These require statements are intentionally placed here to initialize + # the REST modules only when it's required. + require "gapic/rest" + + @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, + endpoint_template: endpoint_template, + universe_domain: universe_domain, + credentials: credentials, + numeric_enums: true, + service_name: self.class, + raise_faraday_errors: false, + logger: logger + end + + ## + # The effective universe domain + # + # @return [String] + # + def universe_domain + @client_stub.universe_domain + end + + ## + # The effective endpoint + # + # @return [String] + # + def endpoint + @client_stub.endpoint + end + + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger stub: false + stub ? @client_stub.stub_logger : @client_stub.logger + end + + ## + # Baseline implementation for the write_user_event REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::WriteUserEventRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Retail::V2::UserEvent] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Retail::V2::UserEvent] + # A result object deserialized from the server's reply + def write_user_event request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_write_user_event_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "write_user_event", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Retail::V2::UserEvent.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the collect_user_event REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::CollectUserEventRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Api::HttpBody] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Api::HttpBody] + # A result object deserialized from the server's reply + def collect_user_event request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_collect_user_event_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "collect_user_event", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Api::HttpBody.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the purge_user_events REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::PurgeUserEventsRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::Operation] + # A result object deserialized from the server's reply + def purge_user_events request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_purge_user_events_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "purge_user_events", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the import_user_events REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::ImportUserEventsRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::Operation] + # A result object deserialized from the server's reply + def import_user_events request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_import_user_events_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "import_user_events", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the rejoin_user_events REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::RejoinUserEventsRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::Operation] + # A result object deserialized from the server's reply + def rejoin_user_events request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_rejoin_user_events_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "rejoin_user_events", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # @private + # + # GRPC transcoding helper method for the write_user_event REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::WriteUserEventRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_write_user_event_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v2/{parent}/userEvents:write", + body: "user_event", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the collect_user_event REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::CollectUserEventRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_collect_user_event_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v2/{parent}/userEvents:collect", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] + ] + ) + .with_bindings( + uri_method: :post, + uri_template: "/v2/{parent}/userEvents:collect", + body: "*", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the purge_user_events REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::PurgeUserEventsRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_purge_user_events_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v2/{parent}/userEvents:purge", + body: "*", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the import_user_events REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::ImportUserEventsRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_import_user_events_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v2/{parent}/userEvents:import", + body: "*", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the rejoin_user_events REST call + # + # @param request_pb [::Google::Cloud::Retail::V2::RejoinUserEventsRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_rejoin_user_events_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v2/{parent}/userEvents:rejoin", + body: "*", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service_pb.rb new file mode 100644 index 000000000000..69dbde1899d7 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service_pb.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/retail/v2/user_event_service.proto + +require 'google/protobuf' + +require 'google/api/annotations_pb' +require 'google/api/client_pb' +require 'google/api/field_behavior_pb' +require 'google/api/httpbody_pb' +require 'google/api/resource_pb' +require 'google/cloud/retail/v2/import_config_pb' +require 'google/cloud/retail/v2/purge_config_pb' +require 'google/cloud/retail/v2/user_event_pb' +require 'google/longrunning/operations_pb' + + +descriptor_data = "\n/google/cloud/retail/v2/user_event_service.proto\x12\x16google.cloud.retail.v2\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/httpbody.proto\x1a\x19google/api/resource.proto\x1a*google/cloud/retail/v2/import_config.proto\x1a)google/cloud/retail/v2/purge_config.proto\x1a\'google/cloud/retail/v2/user_event.proto\x1a#google/longrunning/operations.proto\"}\n\x15WriteUserEventRequest\x12\x13\n\x06parent\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12:\n\nuser_event\x18\x02 \x01(\x0b\x32!.google.cloud.retail.v2.UserEventB\x03\xe0\x41\x02\x12\x13\n\x0bwrite_async\x18\x03 \x01(\x08\"\x9f\x01\n\x17\x43ollectUserEventRequest\x12\x17\n\rprebuilt_rule\x18\x06 \x01(\tH\x00\x12\x13\n\x06parent\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x17\n\nuser_event\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\x0b\n\x03uri\x18\x03 \x01(\t\x12\x0b\n\x03\x65ts\x18\x04 \x01(\x03\x12\x10\n\x08raw_json\x18\x05 \x01(\tB\x11\n\x0f\x63onversion_rule\"\xfe\x01\n\x17RejoinUserEventsRequest\x12\x13\n\x06parent\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x65\n\x17user_event_rejoin_scope\x18\x02 \x01(\x0e\x32\x44.google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope\"g\n\x14UserEventRejoinScope\x12\'\n#USER_EVENT_REJOIN_SCOPE_UNSPECIFIED\x10\x00\x12\x11\n\rJOINED_EVENTS\x10\x01\x12\x13\n\x0fUNJOINED_EVENTS\x10\x02\">\n\x18RejoinUserEventsResponse\x12\"\n\x1arejoined_user_events_count\x18\x01 \x01(\x03\"\x1a\n\x18RejoinUserEventsMetadata2\x89\n\n\x10UserEventService\x12\xb7\x01\n\x0eWriteUserEvent\x12-.google.cloud.retail.v2.WriteUserEventRequest\x1a!.google.cloud.retail.v2.UserEvent\"S\x82\xd3\xe4\x93\x02M\"?/v2/{parent=projects/*/locations/*/catalogs/*}/userEvents:write:\nuser_event\x12\xee\x01\n\x10\x43ollectUserEvent\x12/.google.cloud.retail.v2.CollectUserEventRequest\x1a\x14.google.api.HttpBody\"\x92\x01\x82\xd3\xe4\x93\x02\x8b\x01\x12\x41/v2/{parent=projects/*/locations/*/catalogs/*}/userEvents:collectZF\"A/v2/{parent=projects/*/locations/*/catalogs/*}/userEvents:collect:\x01*\x12\x86\x02\n\x0fPurgeUserEvents\x12..google.cloud.retail.v2.PurgeUserEventsRequest\x1a\x1d.google.longrunning.Operation\"\xa3\x01\xca\x41V\n.google.cloud.retail.v2.PurgeUserEventsResponse\x12$google.cloud.retail.v2.PurgeMetadata\x82\xd3\xe4\x93\x02\x44\"?/v2/{parent=projects/*/locations/*/catalogs/*}/userEvents:purge:\x01*\x12\x8b\x02\n\x10ImportUserEvents\x12/.google.cloud.retail.v2.ImportUserEventsRequest\x1a\x1d.google.longrunning.Operation\"\xa6\x01\xca\x41X\n/google.cloud.retail.v2.ImportUserEventsResponse\x12%google.cloud.retail.v2.ImportMetadata\x82\xd3\xe4\x93\x02\x45\"@/v2/{parent=projects/*/locations/*/catalogs/*}/userEvents:import:\x01*\x12\xe7\x01\n\x10RejoinUserEvents\x12/.google.cloud.retail.v2.RejoinUserEventsRequest\x1a\x1d.google.longrunning.Operation\"\x82\x01\xca\x41\x34\n\x18RejoinUserEventsResponse\x12\x18RejoinUserEventsMetadata\x82\xd3\xe4\x93\x02\x45\"@/v2/{parent=projects/*/locations/*/catalogs/*}/userEvents:rejoin:\x01*\x1aI\xca\x41\x15retail.googleapis.com\xd2\x41.https://www.googleapis.com/auth/cloud-platformB\xc0\x01\n\x1a\x63om.google.cloud.retail.v2B\x15UserEventServiceProtoP\x01Z2cloud.google.com/go/retail/apiv2/retailpb;retailpb\xa2\x02\x06RETAIL\xaa\x02\x16Google.Cloud.Retail.V2\xca\x02\x16Google\\Cloud\\Retail\\V2\xea\x02\x19Google::Cloud::Retail::V2b\x06proto3" + +pool = ::Google::Protobuf::DescriptorPool.generated_pool +pool.add_serialized_file(descriptor_data) + +module Google + module Cloud + module Retail + module V2 + WriteUserEventRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.WriteUserEventRequest").msgclass + CollectUserEventRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CollectUserEventRequest").msgclass + RejoinUserEventsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.RejoinUserEventsRequest").msgclass + RejoinUserEventsRequest::UserEventRejoinScope = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope").enummodule + RejoinUserEventsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.RejoinUserEventsResponse").msgclass + RejoinUserEventsMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.RejoinUserEventsMetadata").msgclass + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service_services_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service_services_pb.rb new file mode 100644 index 000000000000..65e9fe4b7c1f --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service_services_pb.rb @@ -0,0 +1,75 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# Source: google/cloud/retail/v2/user_event_service.proto for package 'Google.Cloud.Retail.V2' +# Original file comments: +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +require 'grpc' +require 'google/cloud/retail/v2/user_event_service_pb' + +module Google + module Cloud + module Retail + module V2 + module UserEventService + # Service for ingesting end user actions on the customer website. + class Service + + include ::GRPC::GenericService + + self.marshal_class_method = :encode + self.unmarshal_class_method = :decode + self.service_name = 'google.cloud.retail.v2.UserEventService' + + # Writes a single user event. + rpc :WriteUserEvent, ::Google::Cloud::Retail::V2::WriteUserEventRequest, ::Google::Cloud::Retail::V2::UserEvent + # Writes a single user event from the browser. + # + # For larger user event payload over 16 KB, the POST method should be used + # instead, otherwise a 400 Bad Request error is returned. + # + # This method is used only by the Retail API JavaScript pixel and Google Tag + # Manager. Users should not call this method directly. + rpc :CollectUserEvent, ::Google::Cloud::Retail::V2::CollectUserEventRequest, ::Google::Api::HttpBody + # Deletes permanently all user events specified by the filter provided. + # Depending on the number of events specified by the filter, this operation + # could take hours or days to complete. To test a filter, use the list + # command first. + rpc :PurgeUserEvents, ::Google::Cloud::Retail::V2::PurgeUserEventsRequest, ::Google::Longrunning::Operation + # Bulk import of User events. Request processing might be + # synchronous. Events that already exist are skipped. + # Use this method for backfilling historical user events. + # + # `Operation.response` is of type `ImportResponse`. Note that it is + # possible for a subset of the items to be successfully inserted. + # `Operation.metadata` is of type `ImportMetadata`. + rpc :ImportUserEvents, ::Google::Cloud::Retail::V2::ImportUserEventsRequest, ::Google::Longrunning::Operation + # Starts a user-event rejoin operation with latest product catalog. Events + # are not annotated with detailed product information for products that are + # missing from the catalog when the user event is ingested. These + # events are stored as unjoined events with limited usage on training and + # serving. You can use this method to start a join operation on specified + # events with the latest version of product catalog. You can also use this + # method to correct events joined with the wrong product catalog. A rejoin + # operation can take hours or days to complete. + rpc :RejoinUserEvents, ::Google::Cloud::Retail::V2::RejoinUserEventsRequest, ::Google::Longrunning::Operation + end + + Stub = Service.rpc_stub_class + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/version.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/version.rb new file mode 100644 index 000000000000..ea00c998505d --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/version.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Retail + module V2 + VERSION = "0.0.1" + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/README.md b/owl-bot-staging/google-cloud-retail-v2/proto_docs/README.md new file mode 100644 index 000000000000..339fa1264598 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/proto_docs/README.md @@ -0,0 +1,4 @@ +# Retail V2 Protocol Buffer Documentation + +These files are for the YARD documentation of the generated protobuf files. +They are not intended to be required or loaded at runtime. diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/api/client.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/api/client.rb new file mode 100644 index 000000000000..3ab0b096d445 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/api/client.rb @@ -0,0 +1,593 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Api + # Required information for every language. + # @!attribute [rw] reference_docs_uri + # @deprecated This field is deprecated and may be removed in the next major version update. + # @return [::String] + # Link to automatically generated reference documentation. Example: + # https://cloud.google.com/nodejs/docs/reference/asset/latest + # @!attribute [rw] destinations + # @return [::Array<::Google::Api::ClientLibraryDestination>] + # The destination where API teams want this client library to be published. + # @!attribute [rw] selective_gapic_generation + # @return [::Google::Api::SelectiveGapicGeneration] + # Configuration for which RPCs should be generated in the GAPIC client. + # + # Note: This field should not be used in most cases. + class CommonLanguageSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Details about how and where to publish client libraries. + # @!attribute [rw] version + # @return [::String] + # Version of the API to apply these settings to. This is the full protobuf + # package for the API, ending in the version element. + # Examples: "google.cloud.speech.v1" and "google.spanner.admin.database.v1". + # @!attribute [rw] launch_stage + # @return [::Google::Api::LaunchStage] + # Launch stage of this version of the API. + # @!attribute [rw] rest_numeric_enums + # @return [::Boolean] + # When using transport=rest, the client request will encode enums as + # numbers rather than strings. + # @!attribute [rw] java_settings + # @return [::Google::Api::JavaSettings] + # Settings for legacy Java features, supported in the Service YAML. + # @!attribute [rw] cpp_settings + # @return [::Google::Api::CppSettings] + # Settings for C++ client libraries. + # @!attribute [rw] php_settings + # @return [::Google::Api::PhpSettings] + # Settings for PHP client libraries. + # @!attribute [rw] python_settings + # @return [::Google::Api::PythonSettings] + # Settings for Python client libraries. + # @!attribute [rw] node_settings + # @return [::Google::Api::NodeSettings] + # Settings for Node client libraries. + # @!attribute [rw] dotnet_settings + # @return [::Google::Api::DotnetSettings] + # Settings for .NET client libraries. + # @!attribute [rw] ruby_settings + # @return [::Google::Api::RubySettings] + # Settings for Ruby client libraries. + # @!attribute [rw] go_settings + # @return [::Google::Api::GoSettings] + # Settings for Go client libraries. + class ClientLibrarySettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # This message configures the settings for publishing [Google Cloud Client + # libraries](https://cloud.google.com/apis/docs/cloud-client-libraries) + # generated from the service config. + # @!attribute [rw] method_settings + # @return [::Array<::Google::Api::MethodSettings>] + # A list of API method settings, e.g. the behavior for methods that use the + # long-running operation pattern. + # @!attribute [rw] new_issue_uri + # @return [::String] + # Link to a *public* URI where users can report issues. Example: + # https://issuetracker.google.com/issues/new?component=190865&template=1161103 + # @!attribute [rw] documentation_uri + # @return [::String] + # Link to product home page. Example: + # https://cloud.google.com/asset-inventory/docs/overview + # @!attribute [rw] api_short_name + # @return [::String] + # Used as a tracking tag when collecting data about the APIs developer + # relations artifacts like docs, packages delivered to package managers, + # etc. Example: "speech". + # @!attribute [rw] github_label + # @return [::String] + # GitHub label to apply to issues and pull requests opened for this API. + # @!attribute [rw] codeowner_github_teams + # @return [::Array<::String>] + # GitHub teams to be added to CODEOWNERS in the directory in GitHub + # containing source code for the client libraries for this API. + # @!attribute [rw] doc_tag_prefix + # @return [::String] + # A prefix used in sample code when demarking regions to be included in + # documentation. + # @!attribute [rw] organization + # @return [::Google::Api::ClientLibraryOrganization] + # For whom the client library is being published. + # @!attribute [rw] library_settings + # @return [::Array<::Google::Api::ClientLibrarySettings>] + # Client library settings. If the same version string appears multiple + # times in this list, then the last one wins. Settings from earlier + # settings with the same version string are discarded. + # @!attribute [rw] proto_reference_documentation_uri + # @return [::String] + # Optional link to proto reference documentation. Example: + # https://cloud.google.com/pubsub/lite/docs/reference/rpc + # @!attribute [rw] rest_reference_documentation_uri + # @return [::String] + # Optional link to REST reference documentation. Example: + # https://cloud.google.com/pubsub/lite/docs/reference/rest + class Publishing + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Settings for Java client libraries. + # @!attribute [rw] library_package + # @return [::String] + # The package name to use in Java. Clobbers the java_package option + # set in the protobuf. This should be used **only** by APIs + # who have already set the language_settings.java.package_name" field + # in gapic.yaml. API teams should use the protobuf java_package option + # where possible. + # + # Example of a YAML configuration:: + # + # publishing: + # library_settings: + # java_settings: + # library_package: com.google.cloud.pubsub.v1 + # @!attribute [rw] service_class_names + # @return [::Google::Protobuf::Map{::String => ::String}] + # Configure the Java class name to use instead of the service's for its + # corresponding generated GAPIC client. Keys are fully-qualified + # service names as they appear in the protobuf (including the full + # the language_settings.java.interface_names" field in gapic.yaml. API + # teams should otherwise use the service name as it appears in the + # protobuf. + # + # Example of a YAML configuration:: + # + # publishing: + # java_settings: + # service_class_names: + # - google.pubsub.v1.Publisher: TopicAdmin + # - google.pubsub.v1.Subscriber: SubscriptionAdmin + # @!attribute [rw] common + # @return [::Google::Api::CommonLanguageSettings] + # Some settings. + class JavaSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # @!attribute [rw] key + # @return [::String] + # @!attribute [rw] value + # @return [::String] + class ServiceClassNamesEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # Settings for C++ client libraries. + # @!attribute [rw] common + # @return [::Google::Api::CommonLanguageSettings] + # Some settings. + class CppSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Settings for Php client libraries. + # @!attribute [rw] common + # @return [::Google::Api::CommonLanguageSettings] + # Some settings. + # @!attribute [rw] library_package + # @return [::String] + # The package name to use in Php. Clobbers the php_namespace option + # set in the protobuf. This should be used **only** by APIs + # who have already set the language_settings.php.package_name" field + # in gapic.yaml. API teams should use the protobuf php_namespace option + # where possible. + # + # Example of a YAML configuration:: + # + # publishing: + # library_settings: + # php_settings: + # library_package: Google\Cloud\PubSub\V1 + class PhpSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Settings for Python client libraries. + # @!attribute [rw] common + # @return [::Google::Api::CommonLanguageSettings] + # Some settings. + # @!attribute [rw] experimental_features + # @return [::Google::Api::PythonSettings::ExperimentalFeatures] + # Experimental features to be included during client library generation. + class PythonSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Experimental features to be included during client library generation. + # These fields will be deprecated once the feature graduates and is enabled + # by default. + # @!attribute [rw] rest_async_io_enabled + # @return [::Boolean] + # Enables generation of asynchronous REST clients if `rest` transport is + # enabled. By default, asynchronous REST clients will not be generated. + # This feature will be enabled by default 1 month after launching the + # feature in preview packages. + # @!attribute [rw] protobuf_pythonic_types_enabled + # @return [::Boolean] + # Enables generation of protobuf code using new types that are more + # Pythonic which are included in `protobuf>=5.29.x`. This feature will be + # enabled by default 1 month after launching the feature in preview + # packages. + # @!attribute [rw] unversioned_package_disabled + # @return [::Boolean] + # Disables generation of an unversioned Python package for this client + # library. This means that the module names will need to be versioned in + # import statements. For example `import google.cloud.library_v2` instead + # of `import google.cloud.library`. + class ExperimentalFeatures + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # Settings for Node client libraries. + # @!attribute [rw] common + # @return [::Google::Api::CommonLanguageSettings] + # Some settings. + class NodeSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Settings for Dotnet client libraries. + # @!attribute [rw] common + # @return [::Google::Api::CommonLanguageSettings] + # Some settings. + # @!attribute [rw] renamed_services + # @return [::Google::Protobuf::Map{::String => ::String}] + # Map from original service names to renamed versions. + # This is used when the default generated types + # would cause a naming conflict. (Neither name is + # fully-qualified.) + # Example: Subscriber to SubscriberServiceApi. + # @!attribute [rw] renamed_resources + # @return [::Google::Protobuf::Map{::String => ::String}] + # Map from full resource types to the effective short name + # for the resource. This is used when otherwise resource + # named from different services would cause naming collisions. + # Example entry: + # "datalabeling.googleapis.com/Dataset": "DataLabelingDataset" + # @!attribute [rw] ignored_resources + # @return [::Array<::String>] + # List of full resource types to ignore during generation. + # This is typically used for API-specific Location resources, + # which should be handled by the generator as if they were actually + # the common Location resources. + # Example entry: "documentai.googleapis.com/Location" + # @!attribute [rw] forced_namespace_aliases + # @return [::Array<::String>] + # Namespaces which must be aliased in snippets due to + # a known (but non-generator-predictable) naming collision + # @!attribute [rw] handwritten_signatures + # @return [::Array<::String>] + # Method signatures (in the form "service.method(signature)") + # which are provided separately, so shouldn't be generated. + # Snippets *calling* these methods are still generated, however. + class DotnetSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # @!attribute [rw] key + # @return [::String] + # @!attribute [rw] value + # @return [::String] + class RenamedServicesEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # @!attribute [rw] key + # @return [::String] + # @!attribute [rw] value + # @return [::String] + class RenamedResourcesEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # Settings for Ruby client libraries. + # @!attribute [rw] common + # @return [::Google::Api::CommonLanguageSettings] + # Some settings. + class RubySettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Settings for Go client libraries. + # @!attribute [rw] common + # @return [::Google::Api::CommonLanguageSettings] + # Some settings. + # @!attribute [rw] renamed_services + # @return [::Google::Protobuf::Map{::String => ::String}] + # Map of service names to renamed services. Keys are the package relative + # service names and values are the name to be used for the service client + # and call options. + # + # Example: + # + # publishing: + # go_settings: + # renamed_services: + # Publisher: TopicAdmin + class GoSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # @!attribute [rw] key + # @return [::String] + # @!attribute [rw] value + # @return [::String] + class RenamedServicesEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # Describes the generator configuration for a method. + # @!attribute [rw] selector + # @return [::String] + # The fully qualified name of the method, for which the options below apply. + # This is used to find the method to apply the options. + # + # Example: + # + # publishing: + # method_settings: + # - selector: google.storage.control.v2.StorageControl.CreateFolder + # # method settings for CreateFolder... + # @!attribute [rw] long_running + # @return [::Google::Api::MethodSettings::LongRunning] + # Describes settings to use for long-running operations when generating + # API methods for RPCs. Complements RPCs that use the annotations in + # google/longrunning/operations.proto. + # + # Example of a YAML configuration:: + # + # publishing: + # method_settings: + # - selector: google.cloud.speech.v2.Speech.BatchRecognize + # long_running: + # initial_poll_delay: 60s # 1 minute + # poll_delay_multiplier: 1.5 + # max_poll_delay: 360s # 6 minutes + # total_poll_timeout: 54000s # 90 minutes + # @!attribute [rw] auto_populated_fields + # @return [::Array<::String>] + # List of top-level fields of the request message, that should be + # automatically populated by the client libraries based on their + # (google.api.field_info).format. Currently supported format: UUID4. + # + # Example of a YAML configuration: + # + # publishing: + # method_settings: + # - selector: google.example.v1.ExampleService.CreateExample + # auto_populated_fields: + # - request_id + # @!attribute [rw] batching + # @return [::Google::Api::BatchingConfigProto] + # Batching configuration for an API method in client libraries. + # + # Example of a YAML configuration: + # + # publishing: + # method_settings: + # - selector: google.example.v1.ExampleService.BatchCreateExample + # batching: + # element_count_threshold: 1000 + # request_byte_threshold: 100000000 + # delay_threshold_millis: 10 + class MethodSettings + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Describes settings to use when generating API methods that use the + # long-running operation pattern. + # All default values below are from those used in the client library + # generators (e.g. + # [Java](https://github.com/googleapis/gapic-generator-java/blob/04c2faa191a9b5a10b92392fe8482279c4404803/src/main/java/com/google/api/generator/gapic/composer/common/RetrySettingsComposer.java)). + # @!attribute [rw] initial_poll_delay + # @return [::Google::Protobuf::Duration] + # Initial delay after which the first poll request will be made. + # Default value: 5 seconds. + # @!attribute [rw] poll_delay_multiplier + # @return [::Float] + # Multiplier to gradually increase delay between subsequent polls until it + # reaches max_poll_delay. + # Default value: 1.5. + # @!attribute [rw] max_poll_delay + # @return [::Google::Protobuf::Duration] + # Maximum time between two subsequent poll requests. + # Default value: 45 seconds. + # @!attribute [rw] total_poll_timeout + # @return [::Google::Protobuf::Duration] + # Total polling timeout. + # Default value: 5 minutes. + class LongRunning + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # This message is used to configure the generation of a subset of the RPCs in + # a service for client libraries. + # + # Note: This feature should not be used in most cases. + # @!attribute [rw] methods + # @return [::Array<::String>] + # An allowlist of the fully qualified names of RPCs that should be included + # on public client surfaces. + # @!attribute [rw] generate_omitted_as_internal + # @return [::Boolean] + # Setting this to true indicates to the client generators that methods + # that would be excluded from the generation should instead be generated + # in a way that indicates these methods should not be consumed by + # end users. How this is expressed is up to individual language + # implementations to decide. Some examples may be: added annotations, + # obfuscated identifiers, or other language idiomatic patterns. + class SelectiveGapicGeneration + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # `BatchingConfigProto` defines the batching configuration for an API method. + # @!attribute [rw] thresholds + # @return [::Google::Api::BatchingSettingsProto] + # The thresholds which trigger a batched request to be sent. + # @!attribute [rw] batch_descriptor + # @return [::Google::Api::BatchingDescriptorProto] + # The request and response fields used in batching. + class BatchingConfigProto + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # `BatchingSettingsProto` specifies a set of batching thresholds, each of + # which acts as a trigger to send a batch of messages as a request. At least + # one threshold must be positive nonzero. + # @!attribute [rw] element_count_threshold + # @return [::Integer] + # The number of elements of a field collected into a batch which, if + # exceeded, causes the batch to be sent. + # @!attribute [rw] request_byte_threshold + # @return [::Integer] + # The aggregated size of the batched field which, if exceeded, causes the + # batch to be sent. This size is computed by aggregating the sizes of the + # request field to be batched, not of the entire request message. + # @!attribute [rw] delay_threshold + # @return [::Google::Protobuf::Duration] + # The duration after which a batch should be sent, starting from the addition + # of the first message to that batch. + # @!attribute [rw] element_count_limit + # @return [::Integer] + # The maximum number of elements collected in a batch that could be accepted + # by server. + # @!attribute [rw] request_byte_limit + # @return [::Integer] + # The maximum size of the request that could be accepted by server. + # @!attribute [rw] flow_control_element_limit + # @return [::Integer] + # The maximum number of elements allowed by flow control. + # @!attribute [rw] flow_control_byte_limit + # @return [::Integer] + # The maximum size of data allowed by flow control. + # @!attribute [rw] flow_control_limit_exceeded_behavior + # @return [::Google::Api::FlowControlLimitExceededBehaviorProto] + # The behavior to take when the flow control limit is exceeded. + class BatchingSettingsProto + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # `BatchingDescriptorProto` specifies the fields of the request message to be + # used for batching, and, optionally, the fields of the response message to be + # used for demultiplexing. + # @!attribute [rw] batched_field + # @return [::String] + # The repeated field in the request message to be aggregated by batching. + # @!attribute [rw] discriminator_fields + # @return [::Array<::String>] + # A list of the fields in the request message. Two requests will be batched + # together only if the values of every field specified in + # `request_discriminator_fields` is equal between the two requests. + # @!attribute [rw] subresponse_field + # @return [::String] + # Optional. When present, indicates the field in the response message to be + # used to demultiplex the response into multiple response messages, in + # correspondence with the multiple request messages originally batched + # together. + class BatchingDescriptorProto + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The organization for which the client libraries are being published. + # Affects the url where generated docs are published, etc. + module ClientLibraryOrganization + # Not useful. + CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED = 0 + + # Google Cloud Platform Org. + CLOUD = 1 + + # Ads (Advertising) Org. + ADS = 2 + + # Photos Org. + PHOTOS = 3 + + # Street View Org. + STREET_VIEW = 4 + + # Shopping Org. + SHOPPING = 5 + + # Geo Org. + GEO = 6 + + # Generative AI - https://developers.generativeai.google + GENERATIVE_AI = 7 + end + + # To where should client libraries be published? + module ClientLibraryDestination + # Client libraries will neither be generated nor published to package + # managers. + CLIENT_LIBRARY_DESTINATION_UNSPECIFIED = 0 + + # Generate the client library in a repo under github.com/googleapis, + # but don't publish it to package managers. + GITHUB = 10 + + # Publish the library to package managers like nuget.org and npmjs.com. + PACKAGE_MANAGER = 20 + end + + # The behavior to take when the flow control limit is exceeded. + module FlowControlLimitExceededBehaviorProto + # Default behavior, system-defined. + UNSET_BEHAVIOR = 0 + + # Stop operation, raise error. + THROW_EXCEPTION = 1 + + # Pause operation until limit clears. + BLOCK = 2 + + # Continue operation, disregard limit. + IGNORE = 3 + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/api/field_behavior.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/api/field_behavior.rb new file mode 100644 index 000000000000..582be187d115 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/api/field_behavior.rb @@ -0,0 +1,85 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Api + # An indicator of the behavior of a given field (for example, that a field + # is required in requests, or given as output but ignored as input). + # This **does not** change the behavior in protocol buffers itself; it only + # denotes the behavior and may affect how API tooling handles the field. + # + # Note: This enum **may** receive new values in the future. + module FieldBehavior + # Conventional default for enums. Do not use this. + FIELD_BEHAVIOR_UNSPECIFIED = 0 + + # Specifically denotes a field as optional. + # While all fields in protocol buffers are optional, this may be specified + # for emphasis if appropriate. + OPTIONAL = 1 + + # Denotes a field as required. + # This indicates that the field **must** be provided as part of the request, + # and failure to do so will cause an error (usually `INVALID_ARGUMENT`). + REQUIRED = 2 + + # Denotes a field as output only. + # This indicates that the field is provided in responses, but including the + # field in a request does nothing (the server *must* ignore it and + # *must not* throw an error as a result of the field's presence). + OUTPUT_ONLY = 3 + + # Denotes a field as input only. + # This indicates that the field is provided in requests, and the + # corresponding field is not included in output. + INPUT_ONLY = 4 + + # Denotes a field as immutable. + # This indicates that the field may be set once in a request to create a + # resource, but may not be changed thereafter. + IMMUTABLE = 5 + + # Denotes that a (repeated) field is an unordered list. + # This indicates that the service may provide the elements of the list + # in any arbitrary order, rather than the order the user originally + # provided. Additionally, the list's order may or may not be stable. + UNORDERED_LIST = 6 + + # Denotes that this field returns a non-empty default value if not set. + # This indicates that if the user provides the empty value in a request, + # a non-empty value will be returned. The user will not be aware of what + # non-empty value to expect. + NON_EMPTY_DEFAULT = 7 + + # Denotes that the field in a resource (a message annotated with + # google.api.resource) is used in the resource name to uniquely identify the + # resource. For AIP-compliant APIs, this should only be applied to the + # `name` field on the resource. + # + # This behavior should not be applied to references to other resources within + # the message. + # + # The identifier field of resources often have different field behavior + # depending on the request it is embedded in (e.g. for Create methods name + # is optional and unused, while for Update methods it is required). Instead + # of method-specific annotations, only `IDENTIFIER` is required. + IDENTIFIER = 8 + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/api/httpbody.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/api/httpbody.rb new file mode 100644 index 000000000000..938f7ac6b2fd --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/api/httpbody.rb @@ -0,0 +1,80 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Api + # Message that represents an arbitrary HTTP body. It should only be used for + # payload formats that can't be represented as JSON, such as raw binary or + # an HTML page. + # + # + # This message can be used both in streaming and non-streaming API methods in + # the request as well as the response. + # + # It can be used as a top-level request field, which is convenient if one + # wants to extract parameters from either the URL or HTTP template into the + # request fields and also want access to the raw HTTP body. + # + # Example: + # + # message GetResourceRequest { + # // A unique request id. + # string request_id = 1; + # + # // The raw HTTP body is bound to this field. + # google.api.HttpBody http_body = 2; + # + # } + # + # service ResourceService { + # rpc GetResource(GetResourceRequest) + # returns (google.api.HttpBody); + # rpc UpdateResource(google.api.HttpBody) + # returns (google.protobuf.Empty); + # + # } + # + # Example with streaming methods: + # + # service CaldavService { + # rpc GetCalendar(stream google.api.HttpBody) + # returns (stream google.api.HttpBody); + # rpc UpdateCalendar(stream google.api.HttpBody) + # returns (stream google.api.HttpBody); + # + # } + # + # Use of this type only changes how the request and response bodies are + # handled, all other features will continue to work unchanged. + # @!attribute [rw] content_type + # @return [::String] + # The HTTP Content-Type header value specifying the content type of the body. + # @!attribute [rw] data + # @return [::String] + # The HTTP request/response body as raw binary. + # @!attribute [rw] extensions + # @return [::Array<::Google::Protobuf::Any>] + # Application specific response metadata. Must be set in the first response + # for streaming APIs. + class HttpBody + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/api/launch_stage.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/api/launch_stage.rb new file mode 100644 index 000000000000..9392a413fb1b --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/api/launch_stage.rb @@ -0,0 +1,71 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Api + # The launch stage as defined by [Google Cloud Platform + # Launch Stages](https://cloud.google.com/terms/launch-stages). + module LaunchStage + # Do not use this default value. + LAUNCH_STAGE_UNSPECIFIED = 0 + + # The feature is not yet implemented. Users can not use it. + UNIMPLEMENTED = 6 + + # Prelaunch features are hidden from users and are only visible internally. + PRELAUNCH = 7 + + # Early Access features are limited to a closed group of testers. To use + # these features, you must sign up in advance and sign a Trusted Tester + # agreement (which includes confidentiality provisions). These features may + # be unstable, changed in backward-incompatible ways, and are not + # guaranteed to be released. + EARLY_ACCESS = 1 + + # Alpha is a limited availability test for releases before they are cleared + # for widespread use. By Alpha, all significant design issues are resolved + # and we are in the process of verifying functionality. Alpha customers + # need to apply for access, agree to applicable terms, and have their + # projects allowlisted. Alpha releases don't have to be feature complete, + # no SLAs are provided, and there are no technical support obligations, but + # they will be far enough along that customers can actually use them in + # test environments or for limited-use tests -- just like they would in + # normal production cases. + ALPHA = 2 + + # Beta is the point at which we are ready to open a release for any + # customer to use. There are no SLA or technical support obligations in a + # Beta release. Products will be complete from a feature perspective, but + # may have some open outstanding issues. Beta releases are suitable for + # limited production use cases. + BETA = 3 + + # GA features are open to all developers and are considered stable and + # fully qualified for production use. + GA = 4 + + # Deprecated features are scheduled to be shut down and removed. For more + # information, see the "Deprecation Policy" section of our [Terms of + # Service](https://cloud.google.com/terms/) + # and the [Google Cloud Platform Subject to the Deprecation + # Policy](https://cloud.google.com/terms/deprecation) documentation. + DEPRECATED = 5 + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/api/resource.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/api/resource.rb new file mode 100644 index 000000000000..25dec4847ac1 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/api/resource.rb @@ -0,0 +1,227 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Api + # A simple descriptor of a resource type. + # + # ResourceDescriptor annotates a resource message (either by means of a + # protobuf annotation or use in the service config), and associates the + # resource's schema, the resource type, and the pattern of the resource name. + # + # Example: + # + # message Topic { + # // Indicates this message defines a resource schema. + # // Declares the resource type in the format of {service}/{kind}. + # // For Kubernetes resources, the format is {api group}/{kind}. + # option (google.api.resource) = { + # type: "pubsub.googleapis.com/Topic" + # pattern: "projects/{project}/topics/{topic}" + # }; + # } + # + # The ResourceDescriptor Yaml config will look like: + # + # resources: + # - type: "pubsub.googleapis.com/Topic" + # pattern: "projects/{project}/topics/{topic}" + # + # Sometimes, resources have multiple patterns, typically because they can + # live under multiple parents. + # + # Example: + # + # message LogEntry { + # option (google.api.resource) = { + # type: "logging.googleapis.com/LogEntry" + # pattern: "projects/{project}/logs/{log}" + # pattern: "folders/{folder}/logs/{log}" + # pattern: "organizations/{organization}/logs/{log}" + # pattern: "billingAccounts/{billing_account}/logs/{log}" + # }; + # } + # + # The ResourceDescriptor Yaml config will look like: + # + # resources: + # - type: 'logging.googleapis.com/LogEntry' + # pattern: "projects/{project}/logs/{log}" + # pattern: "folders/{folder}/logs/{log}" + # pattern: "organizations/{organization}/logs/{log}" + # pattern: "billingAccounts/{billing_account}/logs/{log}" + # @!attribute [rw] type + # @return [::String] + # The resource type. It must be in the format of + # \\{service_name}/\\{resource_type_kind}. The `resource_type_kind` must be + # singular and must not include version numbers. + # + # Example: `storage.googleapis.com/Bucket` + # + # The value of the resource_type_kind must follow the regular expression + # /[A-Za-z][a-zA-Z0-9]+/. It should start with an upper case character and + # should use PascalCase (UpperCamelCase). The maximum number of + # characters allowed for the `resource_type_kind` is 100. + # @!attribute [rw] pattern + # @return [::Array<::String>] + # Optional. The relative resource name pattern associated with this resource + # type. The DNS prefix of the full resource name shouldn't be specified here. + # + # The path pattern must follow the syntax, which aligns with HTTP binding + # syntax: + # + # Template = Segment { "/" Segment } ; + # Segment = LITERAL | Variable ; + # Variable = "{" LITERAL "}" ; + # + # Examples: + # + # - "projects/\\{project}/topics/\\{topic}" + # - "projects/\\{project}/knowledgeBases/\\{knowledge_base}" + # + # The components in braces correspond to the IDs for each resource in the + # hierarchy. It is expected that, if multiple patterns are provided, + # the same component name (e.g. "project") refers to IDs of the same + # type of resource. + # @!attribute [rw] name_field + # @return [::String] + # Optional. The field on the resource that designates the resource name + # field. If omitted, this is assumed to be "name". + # @!attribute [rw] history + # @return [::Google::Api::ResourceDescriptor::History] + # Optional. The historical or future-looking state of the resource pattern. + # + # Example: + # + # // The InspectTemplate message originally only supported resource + # // names with organization, and project was added later. + # message InspectTemplate { + # option (google.api.resource) = { + # type: "dlp.googleapis.com/InspectTemplate" + # pattern: + # "organizations/{organization}/inspectTemplates/{inspect_template}" + # pattern: "projects/{project}/inspectTemplates/{inspect_template}" + # history: ORIGINALLY_SINGLE_PATTERN + # }; + # } + # @!attribute [rw] plural + # @return [::String] + # The plural name used in the resource name and permission names, such as + # 'projects' for the resource name of 'projects/\\{project}' and the permission + # name of 'cloudresourcemanager.googleapis.com/projects.get'. One exception + # to this is for Nested Collections that have stuttering names, as defined + # in [AIP-122](https://google.aip.dev/122#nested-collections), where the + # collection ID in the resource name pattern does not necessarily directly + # match the `plural` value. + # + # It is the same concept of the `plural` field in k8s CRD spec + # https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/ + # + # Note: The plural form is required even for singleton resources. See + # https://aip.dev/156 + # @!attribute [rw] singular + # @return [::String] + # The same concept of the `singular` field in k8s CRD spec + # https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/ + # Such as "project" for the `resourcemanager.googleapis.com/Project` type. + # @!attribute [rw] style + # @return [::Array<::Google::Api::ResourceDescriptor::Style>] + # Style flag(s) for this resource. + # These indicate that a resource is expected to conform to a given + # style. See the specific style flags for additional information. + class ResourceDescriptor + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # A description of the historical or future-looking state of the + # resource pattern. + module History + # The "unset" value. + HISTORY_UNSPECIFIED = 0 + + # The resource originally had one pattern and launched as such, and + # additional patterns were added later. + ORIGINALLY_SINGLE_PATTERN = 1 + + # The resource has one pattern, but the API owner expects to add more + # later. (This is the inverse of ORIGINALLY_SINGLE_PATTERN, and prevents + # that from being necessary once there are multiple patterns.) + FUTURE_MULTI_PATTERN = 2 + end + + # A flag representing a specific style that a resource claims to conform to. + module Style + # The unspecified value. Do not use. + STYLE_UNSPECIFIED = 0 + + # This resource is intended to be "declarative-friendly". + # + # Declarative-friendly resources must be more strictly consistent, and + # setting this to true communicates to tools that this resource should + # adhere to declarative-friendly expectations. + # + # Note: This is used by the API linter (linter.aip.dev) to enable + # additional checks. + DECLARATIVE_FRIENDLY = 1 + end + end + + # Defines a proto annotation that describes a string field that refers to + # an API resource. + # @!attribute [rw] type + # @return [::String] + # The resource type that the annotated field references. + # + # Example: + # + # message Subscription { + # string topic = 2 [(google.api.resource_reference) = { + # type: "pubsub.googleapis.com/Topic" + # }]; + # } + # + # Occasionally, a field may reference an arbitrary resource. In this case, + # APIs use the special value * in their resource reference. + # + # Example: + # + # message GetIamPolicyRequest { + # string resource = 2 [(google.api.resource_reference) = { + # type: "*" + # }]; + # } + # @!attribute [rw] child_type + # @return [::String] + # The resource type of a child collection that the annotated field + # references. This is useful for annotating the `parent` field that + # doesn't have a fixed resource type. + # + # Example: + # + # message ListLogEntriesRequest { + # string parent = 1 [(google.api.resource_reference) = { + # child_type: "logging.googleapis.com/LogEntry" + # }; + # } + class ResourceReference + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/catalog.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/catalog.rb new file mode 100644 index 000000000000..40edde6ddced --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/catalog.rb @@ -0,0 +1,516 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Retail + module V2 + # Configures what level the product should be uploaded with regards to + # how users will be send events and how predictions will be made. + # @!attribute [rw] ingestion_product_type + # @return [::String] + # The type of {::Google::Cloud::Retail::V2::Product Product}s allowed to be + # ingested into the catalog. Acceptable values are: + # + # * `primary` (default): You can ingest + # {::Google::Cloud::Retail::V2::Product Product}s of all types. When + # ingesting a {::Google::Cloud::Retail::V2::Product Product}, its type will + # default to + # {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Product.Type.PRIMARY} if + # unset. + # * `variant` (incompatible with Retail Search): You can only + # ingest + # {::Google::Cloud::Retail::V2::Product::Type::VARIANT Product.Type.VARIANT} + # {::Google::Cloud::Retail::V2::Product Product}s. This means + # {::Google::Cloud::Retail::V2::Product#primary_product_id Product.primary_product_id} + # cannot be empty. + # + # If this field is set to an invalid value other than these, an + # INVALID_ARGUMENT error is returned. + # + # If this field is `variant` and + # {::Google::Cloud::Retail::V2::ProductLevelConfig#merchant_center_product_id_field merchant_center_product_id_field} + # is `itemGroupId`, an INVALID_ARGUMENT error is returned. + # + # See [Product + # levels](https://cloud.google.com/retail/docs/catalog#product-levels) + # for more details. + # @!attribute [rw] merchant_center_product_id_field + # @return [::String] + # Which field of [Merchant Center + # Product](/bigquery-transfer/docs/merchant-center-products-schema) should be + # imported as {::Google::Cloud::Retail::V2::Product#id Product.id}. Acceptable + # values are: + # + # * `offerId` (default): Import `offerId` as the product ID. + # * `itemGroupId`: Import `itemGroupId` as the product ID. Notice that Retail + # API will choose one item from the ones with the same `itemGroupId`, and + # use it to represent the item group. + # + # If this field is set to an invalid value other than these, an + # INVALID_ARGUMENT error is returned. + # + # If this field is `itemGroupId` and + # {::Google::Cloud::Retail::V2::ProductLevelConfig#ingestion_product_type ingestion_product_type} + # is `variant`, an INVALID_ARGUMENT error is returned. + # + # See [Product + # levels](https://cloud.google.com/retail/docs/catalog#product-levels) + # for more details. + class ProductLevelConfig + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Catalog level attribute config for an attribute. For example, if customers + # want to enable/disable facet for a specific attribute. + # @!attribute [rw] key + # @return [::String] + # Required. Attribute name. + # For example: `color`, `brands`, `attributes.custom_attribute`, such as + # `attributes.xyz`. + # To be indexable, the attribute name can contain only alpha-numeric + # characters and underscores. For example, an attribute named + # `attributes.abc_xyz` can be indexed, but an attribute named + # `attributes.abc-xyz` cannot be indexed. + # + # If the attribute key starts with `attributes.`, then the attribute is a + # custom attribute. Attributes such as `brands`, `patterns`, and `title` are + # built-in and called system attributes. + # @!attribute [r] in_use + # @return [::Boolean] + # Output only. Indicates whether this attribute has been used by any + # products. `True` if at least one {::Google::Cloud::Retail::V2::Product Product} + # is using this attribute in + # {::Google::Cloud::Retail::V2::Product#attributes Product.attributes}. Otherwise, + # this field is `False`. + # + # {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} can be + # pre-loaded by using + # {::Google::Cloud::Retail::V2::CatalogService::Client#add_catalog_attribute CatalogService.AddCatalogAttribute} + # or + # {::Google::Cloud::Retail::V2::CatalogService::Client#update_attributes_config CatalogService.UpdateAttributesConfig} + # APIs. This field is `False` for pre-loaded + # {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute}s. + # + # Only pre-loaded [catalog + # attributes][google.cloud.retail.v2.CatalogAttribute] that are neither in + # use by products nor predefined can be deleted. [Catalog + # attributes][google.cloud.retail.v2.CatalogAttribute] that are + # either in use by products or are predefined attributes cannot be deleted; + # however, their configuration properties will reset to default values upon + # removal request. + # + # After catalog changes, it takes about 10 minutes for this field to update. + # @!attribute [r] type + # @return [::Google::Cloud::Retail::V2::CatalogAttribute::AttributeType] + # Output only. The type of this attribute. This is derived from the attribute + # in {::Google::Cloud::Retail::V2::Product#attributes Product.attributes}. + # @!attribute [rw] indexable_option + # @return [::Google::Cloud::Retail::V2::CatalogAttribute::IndexableOption] + # When + # {::Google::Cloud::Retail::V2::AttributesConfig#attribute_config_level AttributesConfig.attribute_config_level} + # is CATALOG_LEVEL_ATTRIBUTE_CONFIG, if INDEXABLE_ENABLED attribute values + # are indexed so that it can be filtered, faceted, or boosted in + # {::Google::Cloud::Retail::V2::SearchService::Client#search SearchService.Search}. + # + # Must be specified when + # {::Google::Cloud::Retail::V2::AttributesConfig#attribute_config_level AttributesConfig.attribute_config_level} + # is CATALOG_LEVEL_ATTRIBUTE_CONFIG, otherwise throws INVALID_FORMAT error. + # @!attribute [rw] dynamic_facetable_option + # @return [::Google::Cloud::Retail::V2::CatalogAttribute::DynamicFacetableOption] + # If DYNAMIC_FACETABLE_ENABLED, attribute values are available for dynamic + # facet. Could only be DYNAMIC_FACETABLE_DISABLED if + # {::Google::Cloud::Retail::V2::CatalogAttribute#indexable_option CatalogAttribute.indexable_option} + # is INDEXABLE_DISABLED. Otherwise, an INVALID_ARGUMENT error is returned. + # + # Must be specified, otherwise throws INVALID_FORMAT error. + # @!attribute [rw] searchable_option + # @return [::Google::Cloud::Retail::V2::CatalogAttribute::SearchableOption] + # When + # {::Google::Cloud::Retail::V2::AttributesConfig#attribute_config_level AttributesConfig.attribute_config_level} + # is CATALOG_LEVEL_ATTRIBUTE_CONFIG, if SEARCHABLE_ENABLED, attribute values + # are searchable by text queries in + # {::Google::Cloud::Retail::V2::SearchService::Client#search SearchService.Search}. + # + # If SEARCHABLE_ENABLED but attribute type is numerical, attribute values + # will not be searchable by text queries in + # {::Google::Cloud::Retail::V2::SearchService::Client#search SearchService.Search}, as + # there are no text values associated to numerical attributes. + # + # Must be specified, when + # {::Google::Cloud::Retail::V2::AttributesConfig#attribute_config_level AttributesConfig.attribute_config_level} + # is CATALOG_LEVEL_ATTRIBUTE_CONFIG, otherwise throws INVALID_FORMAT error. + # @!attribute [rw] exact_searchable_option + # @return [::Google::Cloud::Retail::V2::CatalogAttribute::ExactSearchableOption] + # If EXACT_SEARCHABLE_ENABLED, attribute values will be exact searchable. + # This property only applies to textual custom attributes and requires + # indexable set to enabled to enable exact-searchable. If unset, the server + # behavior defaults to + # {::Google::Cloud::Retail::V2::CatalogAttribute::ExactSearchableOption::EXACT_SEARCHABLE_DISABLED EXACT_SEARCHABLE_DISABLED}. + # @!attribute [rw] retrievable_option + # @return [::Google::Cloud::Retail::V2::CatalogAttribute::RetrievableOption] + # If RETRIEVABLE_ENABLED, attribute values are retrievable in the search + # results. If unset, the server behavior defaults to + # {::Google::Cloud::Retail::V2::CatalogAttribute::RetrievableOption::RETRIEVABLE_DISABLED RETRIEVABLE_DISABLED}. + # @!attribute [rw] facet_config + # @return [::Google::Cloud::Retail::V2::CatalogAttribute::FacetConfig] + # Contains facet options. + class CatalogAttribute + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Possible options for the facet that corresponds to the current attribute + # config. + # @!attribute [rw] facet_intervals + # @return [::Array<::Google::Cloud::Retail::V2::Interval>] + # If you don't set the facet + # {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#intervals SearchRequest.FacetSpec.FacetKey.intervals} + # in the request to a numerical attribute, then we use the computed + # intervals with rounded bounds obtained from all its product numerical + # attribute values. The computed intervals might not be ideal for some + # attributes. Therefore, we give you the option to overwrite them with the + # facet_intervals field. The maximum of facet intervals per + # {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} is 40. Each + # interval must have a lower bound or an upper bound. If both bounds are + # provided, then the lower bound must be smaller or equal than the upper + # bound. + # @!attribute [rw] ignored_facet_values + # @return [::Array<::Google::Cloud::Retail::V2::CatalogAttribute::FacetConfig::IgnoredFacetValues>] + # Each instance represents a list of attribute values to ignore as facet + # values for a specific time range. The maximum number of instances per + # {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} is 25. + # @!attribute [rw] merged_facet_values + # @return [::Array<::Google::Cloud::Retail::V2::CatalogAttribute::FacetConfig::MergedFacetValue>] + # Each instance replaces a list of facet values by a merged facet + # value. If a facet value is not in any list, then it will stay the same. + # To avoid conflicts, only paths of length 1 are accepted. In other words, + # if "dark_blue" merged into "BLUE", then the latter can't merge into + # "blues" because this would create a path of length 2. The maximum number + # of instances of MergedFacetValue per + # {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} is 100. This + # feature is available only for textual custom attributes. + # @!attribute [rw] merged_facet + # @return [::Google::Cloud::Retail::V2::CatalogAttribute::FacetConfig::MergedFacet] + # Use this field only if you want to merge a facet key into another facet + # key. + # @!attribute [rw] rerank_config + # @return [::Google::Cloud::Retail::V2::CatalogAttribute::FacetConfig::RerankConfig] + # Set this field only if you want to rerank based on facet values engaged + # by the user for the current key. This option is only possible for custom + # facetable textual keys. + class FacetConfig + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # {::Google::Cloud::Retail::V2::SearchResponse::Facet#values Facet values} to + # ignore on {::Google::Cloud::Retail::V2::SearchResponse::Facet facets} during + # the specified time range for the given + # {::Google::Cloud::Retail::V2::SearchResponse::Facet#key SearchResponse.Facet.key} + # attribute. + # @!attribute [rw] values + # @return [::Array<::String>] + # List of facet values to ignore for the following time range. The facet + # values are the same as the attribute values. There is a limit of 10 + # values per instance of IgnoredFacetValues. Each value can have at most + # 128 characters. + # @!attribute [rw] start_time + # @return [::Google::Protobuf::Timestamp] + # Time range for the current list of facet values to ignore. + # If multiple time ranges are specified for an facet value for the + # current attribute, consider all of them. If both are empty, ignore + # always. If start time and end time are set, then start time + # must be before end time. + # If start time is not empty and end time is empty, then will ignore + # these facet values after the start time. + # @!attribute [rw] end_time + # @return [::Google::Protobuf::Timestamp] + # If start time is empty and end time is not empty, then ignore these + # facet values before end time. + class IgnoredFacetValues + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Replaces a set of textual facet values by the same (possibly different) + # merged facet value. Each facet value should appear at most once as a + # value per {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute}. + # This feature is available only for textual custom attributes. + # @!attribute [rw] values + # @return [::Array<::String>] + # All the facet values that are replaces by the same + # {::Google::Cloud::Retail::V2::CatalogAttribute::FacetConfig::MergedFacetValue#merged_value merged_value} + # that follows. The maximum number of values per MergedFacetValue is 25. + # Each value can have up to 128 characters. + # @!attribute [rw] merged_value + # @return [::String] + # All the previous values are replaced by this merged facet value. + # This merged_value must be non-empty and can have up to 128 characters. + class MergedFacetValue + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The current facet key (i.e. attribute config) maps into the + # {::Google::Cloud::Retail::V2::CatalogAttribute::FacetConfig::MergedFacet#merged_facet_key merged_facet_key}. + # A facet key can have at most one child. The current facet key and the + # merged facet key need both to be textual custom attributes or both + # numerical custom attributes (same type). + # @!attribute [rw] merged_facet_key + # @return [::String] + # The merged facet key should be a valid facet key that is different than + # the facet key of the current catalog attribute. We refer this is + # merged facet key as the child of the current catalog attribute. This + # merged facet key can't be a parent of another facet key (i.e. no + # directed path of length 2). This merged facet key needs to be either a + # textual custom attribute or a numerical custom attribute. + class MergedFacet + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Options to rerank based on facet values engaged by the user for the + # current key. That key needs to be a custom textual key and facetable. + # To use this control, you also need to pass all the facet keys engaged by + # the user in the request using the field [SearchRequest.FacetSpec]. In + # particular, if you don't pass the facet keys engaged that you want to + # rerank on, this control won't be effective. Moreover, to obtain better + # results, the facet values that you want to rerank on should be close to + # English (ideally made of words, underscores, and spaces). + # @!attribute [rw] rerank_facet + # @return [::Boolean] + # If set to true, then we also rerank the dynamic facets based on the + # facet values engaged by the user for the current attribute key during + # serving. + # @!attribute [rw] facet_values + # @return [::Array<::String>] + # If empty, rerank on all facet values for the current key. Otherwise, + # will rerank on the facet values from this list only. + class RerankConfig + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # The type of an attribute. + module AttributeType + # The type of the attribute is unknown. + # + # Used when type cannot be derived from attribute that is not + # {::Google::Cloud::Retail::V2::CatalogAttribute#in_use in_use}. + UNKNOWN = 0 + + # Textual attribute. + TEXTUAL = 1 + + # Numerical attribute. + NUMERICAL = 2 + end + + # The status of the indexable option of a catalog attribute. + module IndexableOption + # Value used when unset. + INDEXABLE_OPTION_UNSPECIFIED = 0 + + # Indexable option enabled for an attribute. + INDEXABLE_ENABLED = 1 + + # Indexable option disabled for an attribute. + INDEXABLE_DISABLED = 2 + end + + # The status of the dynamic facetable option of a catalog attribute. + module DynamicFacetableOption + # Value used when unset. + DYNAMIC_FACETABLE_OPTION_UNSPECIFIED = 0 + + # Dynamic facetable option enabled for an attribute. + DYNAMIC_FACETABLE_ENABLED = 1 + + # Dynamic facetable option disabled for an attribute. + DYNAMIC_FACETABLE_DISABLED = 2 + end + + # The status of the searchable option of a catalog attribute. + module SearchableOption + # Value used when unset. + SEARCHABLE_OPTION_UNSPECIFIED = 0 + + # Searchable option enabled for an attribute. + SEARCHABLE_ENABLED = 1 + + # Searchable option disabled for an attribute. + SEARCHABLE_DISABLED = 2 + end + + # The status of the exact-searchable option of a catalog attribute. + module ExactSearchableOption + # Value used when unset. + EXACT_SEARCHABLE_OPTION_UNSPECIFIED = 0 + + # Exact searchable option enabled for an attribute. + EXACT_SEARCHABLE_ENABLED = 1 + + # Exact searchable option disabled for an attribute. + EXACT_SEARCHABLE_DISABLED = 2 + end + + # The status of the retrievable option of a catalog attribute. + module RetrievableOption + # Value used when unset. + RETRIEVABLE_OPTION_UNSPECIFIED = 0 + + # Retrievable option enabled for an attribute. + RETRIEVABLE_ENABLED = 1 + + # Retrievable option disabled for an attribute. + RETRIEVABLE_DISABLED = 2 + end + end + + # Catalog level attribute config. + # @!attribute [rw] name + # @return [::String] + # Required. Immutable. The fully qualified resource name of the attribute + # config. Format: `projects/*/locations/*/catalogs/*/attributesConfig` + # @!attribute [rw] catalog_attributes + # @return [::Google::Protobuf::Map{::String => ::Google::Cloud::Retail::V2::CatalogAttribute}] + # Enable attribute(s) config at catalog level. + # For example, indexable, dynamic_facetable, or searchable for each + # attribute. + # + # The key is catalog attribute's name. + # For example: `color`, `brands`, `attributes.custom_attribute`, such as + # `attributes.xyz`. + # + # The maximum number of catalog attributes allowed in a request is 1000. + # @!attribute [r] attribute_config_level + # @return [::Google::Cloud::Retail::V2::AttributeConfigLevel] + # Output only. The + # {::Google::Cloud::Retail::V2::AttributeConfigLevel AttributeConfigLevel} used + # for this catalog. + class AttributesConfig + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # @!attribute [rw] key + # @return [::String] + # @!attribute [rw] value + # @return [::Google::Cloud::Retail::V2::CatalogAttribute] + class CatalogAttributesEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # Catalog level autocomplete config for customers to customize autocomplete + # feature's settings. + # @!attribute [rw] name + # @return [::String] + # Required. Immutable. Fully qualified name + # `projects/*/locations/*/catalogs/*/completionConfig` + # @!attribute [rw] matching_order + # @return [::String] + # Specifies the matching order for autocomplete suggestions, e.g., a query + # consisting of 'sh' with 'out-of-order' specified would suggest "women's + # shoes", whereas a query of 'red s' with 'exact-prefix' specified would + # suggest "red shoes". Currently supported values: + # + # * 'out-of-order' + # * 'exact-prefix' + # + # Default value: 'exact-prefix'. + # @!attribute [rw] max_suggestions + # @return [::Integer] + # The maximum number of autocomplete suggestions returned per term. Default + # value is 20. If left unset or set to 0, then will fallback to default + # value. + # + # Value range is 1 to 20. + # @!attribute [rw] min_prefix_length + # @return [::Integer] + # The minimum number of characters needed to be typed in order to get + # suggestions. Default value is 2. If left unset or set to 0, then will + # fallback to default value. + # + # Value range is 1 to 20. + # @!attribute [rw] auto_learning + # @return [::Boolean] + # If set to true, the auto learning function is enabled. Auto learning uses + # user data to generate suggestions using ML techniques. Default value is + # false. Only after enabling auto learning can users use `cloud-retail` + # data in + # {::Google::Cloud::Retail::V2::CompleteQueryRequest CompleteQueryRequest}. + # @!attribute [r] suggestions_input_config + # @return [::Google::Cloud::Retail::V2::CompletionDataInputConfig] + # Output only. The source data for the latest import of the autocomplete + # suggestion phrases. + # @!attribute [r] last_suggestions_import_operation + # @return [::String] + # Output only. Name of the LRO corresponding to the latest suggestion terms + # list import. + # + # Can use GetOperation API + # method to retrieve the latest state of the Long Running Operation. + # @!attribute [r] denylist_input_config + # @return [::Google::Cloud::Retail::V2::CompletionDataInputConfig] + # Output only. The source data for the latest import of the autocomplete + # denylist phrases. + # @!attribute [r] last_denylist_import_operation + # @return [::String] + # Output only. Name of the LRO corresponding to the latest denylist import. + # + # Can use GetOperation API to + # retrieve the latest state of the Long Running Operation. + # @!attribute [r] allowlist_input_config + # @return [::Google::Cloud::Retail::V2::CompletionDataInputConfig] + # Output only. The source data for the latest import of the autocomplete + # allowlist phrases. + # @!attribute [r] last_allowlist_import_operation + # @return [::String] + # Output only. Name of the LRO corresponding to the latest allowlist import. + # + # Can use GetOperation API to + # retrieve the latest state of the Long Running Operation. + class CompletionConfig + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The catalog configuration. + # @!attribute [rw] name + # @return [::String] + # Required. Immutable. The fully qualified resource name of the catalog. + # @!attribute [rw] display_name + # @return [::String] + # Required. Immutable. The catalog display name. + # + # This field must be a UTF-8 encoded string with a length limit of 128 + # characters. Otherwise, an INVALID_ARGUMENT error is returned. + # @!attribute [rw] product_level_config + # @return [::Google::Cloud::Retail::V2::ProductLevelConfig] + # Required. The product level configuration. + class Catalog + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/catalog_service.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/catalog_service.rb new file mode 100644 index 000000000000..062dd48b9cbe --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/catalog_service.rb @@ -0,0 +1,297 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Retail + module V2 + # Request for + # {::Google::Cloud::Retail::V2::CatalogService::Client#list_catalogs CatalogService.ListCatalogs} + # method. + # @!attribute [rw] parent + # @return [::String] + # Required. The account resource name with an associated location. + # + # If the caller does not have permission to list + # {::Google::Cloud::Retail::V2::Catalog Catalog}s under this location, regardless + # of whether or not this location exists, a PERMISSION_DENIED error is + # returned. + # @!attribute [rw] page_size + # @return [::Integer] + # Maximum number of {::Google::Cloud::Retail::V2::Catalog Catalog}s to return. If + # unspecified, defaults to 50. The maximum allowed value is 1000. Values + # above 1000 will be coerced to 1000. + # + # If this field is negative, an INVALID_ARGUMENT is returned. + # @!attribute [rw] page_token + # @return [::String] + # A page token + # {::Google::Cloud::Retail::V2::ListCatalogsResponse#next_page_token ListCatalogsResponse.next_page_token}, + # received from a previous + # {::Google::Cloud::Retail::V2::CatalogService::Client#list_catalogs CatalogService.ListCatalogs} + # call. Provide this to retrieve the subsequent page. + # + # When paginating, all other parameters provided to + # {::Google::Cloud::Retail::V2::CatalogService::Client#list_catalogs CatalogService.ListCatalogs} + # must match the call that provided the page token. Otherwise, an + # INVALID_ARGUMENT error is returned. + class ListCatalogsRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Response for + # {::Google::Cloud::Retail::V2::CatalogService::Client#list_catalogs CatalogService.ListCatalogs} + # method. + # @!attribute [rw] catalogs + # @return [::Array<::Google::Cloud::Retail::V2::Catalog>] + # All the customer's {::Google::Cloud::Retail::V2::Catalog Catalog}s. + # @!attribute [rw] next_page_token + # @return [::String] + # A token that can be sent as + # {::Google::Cloud::Retail::V2::ListCatalogsRequest#page_token ListCatalogsRequest.page_token} + # to retrieve the next page. If this field is omitted, there are no + # subsequent pages. + class ListCatalogsResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for + # {::Google::Cloud::Retail::V2::CatalogService::Client#update_catalog CatalogService.UpdateCatalog} + # method. + # @!attribute [rw] catalog + # @return [::Google::Cloud::Retail::V2::Catalog] + # Required. The {::Google::Cloud::Retail::V2::Catalog Catalog} to update. + # + # If the caller does not have permission to update the + # {::Google::Cloud::Retail::V2::Catalog Catalog}, regardless of whether or not it + # exists, a PERMISSION_DENIED error is returned. + # + # If the {::Google::Cloud::Retail::V2::Catalog Catalog} to update does not exist, + # a NOT_FOUND error is returned. + # @!attribute [rw] update_mask + # @return [::Google::Protobuf::FieldMask] + # Indicates which fields in the provided + # {::Google::Cloud::Retail::V2::Catalog Catalog} to update. + # + # If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + # is returned. + class UpdateCatalogRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message to set a specified branch as new default_branch. + # @!attribute [rw] catalog + # @return [::String] + # Full resource name of the catalog, such as + # `projects/*/locations/global/catalogs/default_catalog`. + # @!attribute [rw] branch_id + # @return [::String] + # The final component of the resource name of a branch. + # + # This field must be one of "0", "1" or "2". Otherwise, an INVALID_ARGUMENT + # error is returned. + # + # If there are no sufficient active products in the targeted branch and + # {::Google::Cloud::Retail::V2::SetDefaultBranchRequest#force force} is not set, a + # FAILED_PRECONDITION error is returned. + # @!attribute [rw] note + # @return [::String] + # Some note on this request, this can be retrieved by + # {::Google::Cloud::Retail::V2::CatalogService::Client#get_default_branch CatalogService.GetDefaultBranch} + # before next valid default branch set occurs. + # + # This field must be a UTF-8 encoded string with a length limit of 1,000 + # characters. Otherwise, an INVALID_ARGUMENT error is returned. + # @!attribute [rw] force + # @return [::Boolean] + # If set to true, it permits switching to a branch with + # {::Google::Cloud::Retail::V2::SetDefaultBranchRequest#branch_id branch_id} even + # if it has no sufficient active products. + class SetDefaultBranchRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message to show which branch is currently the default branch. + # @!attribute [rw] catalog + # @return [::String] + # The parent catalog resource name, such as + # `projects/*/locations/global/catalogs/default_catalog`. + class GetDefaultBranchRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Response message of + # {::Google::Cloud::Retail::V2::CatalogService::Client#get_default_branch CatalogService.GetDefaultBranch}. + # @!attribute [rw] branch + # @return [::String] + # Full resource name of the branch id currently set as default branch. + # @!attribute [rw] set_time + # @return [::Google::Protobuf::Timestamp] + # The time when this branch is set to default. + # @!attribute [rw] note + # @return [::String] + # This corresponds to + # {::Google::Cloud::Retail::V2::SetDefaultBranchRequest#note SetDefaultBranchRequest.note} + # field, when this branch was set as default. + class GetDefaultBranchResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for + # {::Google::Cloud::Retail::V2::CatalogService::Client#get_completion_config CatalogService.GetCompletionConfig} + # method. + # @!attribute [rw] name + # @return [::String] + # Required. Full CompletionConfig resource name. Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig` + class GetCompletionConfigRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for + # {::Google::Cloud::Retail::V2::CatalogService::Client#update_completion_config CatalogService.UpdateCompletionConfig} + # method. + # @!attribute [rw] completion_config + # @return [::Google::Cloud::Retail::V2::CompletionConfig] + # Required. The {::Google::Cloud::Retail::V2::CompletionConfig CompletionConfig} + # to update. + # + # If the caller does not have permission to update the + # {::Google::Cloud::Retail::V2::CompletionConfig CompletionConfig}, then a + # PERMISSION_DENIED error is returned. + # + # If the {::Google::Cloud::Retail::V2::CompletionConfig CompletionConfig} to + # update does not exist, a NOT_FOUND error is returned. + # @!attribute [rw] update_mask + # @return [::Google::Protobuf::FieldMask] + # Indicates which fields in the provided + # {::Google::Cloud::Retail::V2::CompletionConfig CompletionConfig} to update. The + # following are the only supported fields: + # + # * {::Google::Cloud::Retail::V2::CompletionConfig#matching_order CompletionConfig.matching_order} + # * {::Google::Cloud::Retail::V2::CompletionConfig#max_suggestions CompletionConfig.max_suggestions} + # * {::Google::Cloud::Retail::V2::CompletionConfig#min_prefix_length CompletionConfig.min_prefix_length} + # * {::Google::Cloud::Retail::V2::CompletionConfig#auto_learning CompletionConfig.auto_learning} + # + # If not set, all supported fields are updated. + class UpdateCompletionConfigRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for + # {::Google::Cloud::Retail::V2::CatalogService::Client#get_attributes_config CatalogService.GetAttributesConfig} + # method. + # @!attribute [rw] name + # @return [::String] + # Required. Full AttributesConfig resource name. Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` + class GetAttributesConfigRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for + # {::Google::Cloud::Retail::V2::CatalogService::Client#update_attributes_config CatalogService.UpdateAttributesConfig} + # method. + # @!attribute [rw] attributes_config + # @return [::Google::Cloud::Retail::V2::AttributesConfig] + # Required. The {::Google::Cloud::Retail::V2::AttributesConfig AttributesConfig} + # to update. + # @!attribute [rw] update_mask + # @return [::Google::Protobuf::FieldMask] + # Indicates which fields in the provided + # {::Google::Cloud::Retail::V2::AttributesConfig AttributesConfig} to update. The + # following is the only supported field: + # + # * {::Google::Cloud::Retail::V2::AttributesConfig#catalog_attributes AttributesConfig.catalog_attributes} + # + # If not set, all supported fields are updated. + class UpdateAttributesConfigRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for + # {::Google::Cloud::Retail::V2::CatalogService::Client#add_catalog_attribute CatalogService.AddCatalogAttribute} + # method. + # @!attribute [rw] attributes_config + # @return [::String] + # Required. Full AttributesConfig resource name. Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` + # @!attribute [rw] catalog_attribute + # @return [::Google::Cloud::Retail::V2::CatalogAttribute] + # Required. The {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} + # to add. + class AddCatalogAttributeRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for + # {::Google::Cloud::Retail::V2::CatalogService::Client#remove_catalog_attribute CatalogService.RemoveCatalogAttribute} + # method. + # @!attribute [rw] attributes_config + # @return [::String] + # Required. Full AttributesConfig resource name. Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` + # @!attribute [rw] key + # @return [::String] + # Required. The attribute name key of the + # {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} to remove. + class RemoveCatalogAttributeRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for + # {::Google::Cloud::Retail::V2::CatalogService::Client#replace_catalog_attribute CatalogService.ReplaceCatalogAttribute} + # method. + # @!attribute [rw] attributes_config + # @return [::String] + # Required. Full AttributesConfig resource name. Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` + # @!attribute [rw] catalog_attribute + # @return [::Google::Cloud::Retail::V2::CatalogAttribute] + # Required. The updated + # {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute}. + # @!attribute [rw] update_mask + # @return [::Google::Protobuf::FieldMask] + # Indicates which fields in the provided + # {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} to update. The + # following are NOT supported: + # + # * {::Google::Cloud::Retail::V2::CatalogAttribute#key CatalogAttribute.key} + # + # If not set, all supported fields are updated. + class ReplaceCatalogAttributeRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/common.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/common.rb new file mode 100644 index 000000000000..d73fe6763594 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/common.rb @@ -0,0 +1,1085 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Retail + module V2 + # Metadata that is used to define a condition that triggers an action. + # A valid condition must specify at least one of 'query_terms' or + # 'products_filter'. If multiple fields are specified, the condition is met if + # all the fields are satisfied e.g. if a set of query terms and product_filter + # are set, then only items matching the product_filter for requests with a + # query matching the query terms wil get boosted. + # @!attribute [rw] query_terms + # @return [::Array<::Google::Cloud::Retail::V2::Condition::QueryTerm>] + # A list (up to 10 entries) of terms to match the query on. If not + # specified, match all queries. + # If many query terms are specified, the condition + # is matched if any of the terms is a match (i.e. using the OR operator). + # @!attribute [rw] active_time_range + # @return [::Array<::Google::Cloud::Retail::V2::Condition::TimeRange>] + # Range of time(s) specifying when Condition is active. + # Condition true if any time range matches. + # @!attribute [rw] page_categories + # @return [::Array<::String>] + # Used to support browse uses cases. + # A list (up to 10 entries) of categories or departments. + # The format should be the same as + # {::Google::Cloud::Retail::V2::UserEvent#page_categories UserEvent.page_categories}; + class Condition + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Query terms that we want to match on. + # @!attribute [rw] value + # @return [::String] + # The value of the term to match on. + # Value cannot be empty. + # Value can have at most 3 terms if specified as a partial match. Each + # space separated string is considered as one term. + # For example, "a b c" is 3 terms and allowed, but " a b c d" is 4 terms + # and not allowed for a partial match. + # @!attribute [rw] full_match + # @return [::Boolean] + # Whether this is supposed to be a full or partial match. + class QueryTerm + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Used for time-dependent conditions. + # Example: Want to have rule applied for week long sale. + # @!attribute [rw] start_time + # @return [::Google::Protobuf::Timestamp] + # Start of time range. Range is inclusive. + # @!attribute [rw] end_time + # @return [::Google::Protobuf::Timestamp] + # End of time range. Range is inclusive. + class TimeRange + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # A rule is a condition-action pair + # + # * A condition defines when a rule is to be triggered. + # * An action specifies what occurs on that trigger. + # Currently rules only work for {::Google::Cloud::Retail::V2::Control controls} with + # {::Google::Cloud::Retail::V2::SolutionType::SOLUTION_TYPE_SEARCH SOLUTION_TYPE_SEARCH}. + # @!attribute [rw] boost_action + # @return [::Google::Cloud::Retail::V2::Rule::BoostAction] + # A boost action. + # + # Note: The following fields are mutually exclusive: `boost_action`, `redirect_action`, `oneway_synonyms_action`, `do_not_associate_action`, `replacement_action`, `ignore_action`, `filter_action`, `twoway_synonyms_action`, `force_return_facet_action`, `remove_facet_action`, `pin_action`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [rw] redirect_action + # @return [::Google::Cloud::Retail::V2::Rule::RedirectAction] + # Redirects a shopper to a specific page. + # + # Note: The following fields are mutually exclusive: `redirect_action`, `boost_action`, `oneway_synonyms_action`, `do_not_associate_action`, `replacement_action`, `ignore_action`, `filter_action`, `twoway_synonyms_action`, `force_return_facet_action`, `remove_facet_action`, `pin_action`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [rw] oneway_synonyms_action + # @return [::Google::Cloud::Retail::V2::Rule::OnewaySynonymsAction] + # Treats specific term as a synonym with a group of terms. + # Group of terms will not be treated as synonyms with the specific term. + # + # Note: The following fields are mutually exclusive: `oneway_synonyms_action`, `boost_action`, `redirect_action`, `do_not_associate_action`, `replacement_action`, `ignore_action`, `filter_action`, `twoway_synonyms_action`, `force_return_facet_action`, `remove_facet_action`, `pin_action`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [rw] do_not_associate_action + # @return [::Google::Cloud::Retail::V2::Rule::DoNotAssociateAction] + # Prevents term from being associated with other terms. + # + # Note: The following fields are mutually exclusive: `do_not_associate_action`, `boost_action`, `redirect_action`, `oneway_synonyms_action`, `replacement_action`, `ignore_action`, `filter_action`, `twoway_synonyms_action`, `force_return_facet_action`, `remove_facet_action`, `pin_action`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [rw] replacement_action + # @return [::Google::Cloud::Retail::V2::Rule::ReplacementAction] + # Replaces specific terms in the query. + # + # Note: The following fields are mutually exclusive: `replacement_action`, `boost_action`, `redirect_action`, `oneway_synonyms_action`, `do_not_associate_action`, `ignore_action`, `filter_action`, `twoway_synonyms_action`, `force_return_facet_action`, `remove_facet_action`, `pin_action`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [rw] ignore_action + # @return [::Google::Cloud::Retail::V2::Rule::IgnoreAction] + # Ignores specific terms from query during search. + # + # Note: The following fields are mutually exclusive: `ignore_action`, `boost_action`, `redirect_action`, `oneway_synonyms_action`, `do_not_associate_action`, `replacement_action`, `filter_action`, `twoway_synonyms_action`, `force_return_facet_action`, `remove_facet_action`, `pin_action`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [rw] filter_action + # @return [::Google::Cloud::Retail::V2::Rule::FilterAction] + # Filters results. + # + # Note: The following fields are mutually exclusive: `filter_action`, `boost_action`, `redirect_action`, `oneway_synonyms_action`, `do_not_associate_action`, `replacement_action`, `ignore_action`, `twoway_synonyms_action`, `force_return_facet_action`, `remove_facet_action`, `pin_action`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [rw] twoway_synonyms_action + # @return [::Google::Cloud::Retail::V2::Rule::TwowaySynonymsAction] + # Treats a set of terms as synonyms of one another. + # + # Note: The following fields are mutually exclusive: `twoway_synonyms_action`, `boost_action`, `redirect_action`, `oneway_synonyms_action`, `do_not_associate_action`, `replacement_action`, `ignore_action`, `filter_action`, `force_return_facet_action`, `remove_facet_action`, `pin_action`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [rw] force_return_facet_action + # @return [::Google::Cloud::Retail::V2::Rule::ForceReturnFacetAction] + # Force returns an attribute as a facet in the request. + # + # Note: The following fields are mutually exclusive: `force_return_facet_action`, `boost_action`, `redirect_action`, `oneway_synonyms_action`, `do_not_associate_action`, `replacement_action`, `ignore_action`, `filter_action`, `twoway_synonyms_action`, `remove_facet_action`, `pin_action`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [rw] remove_facet_action + # @return [::Google::Cloud::Retail::V2::Rule::RemoveFacetAction] + # Remove an attribute as a facet in the request (if present). + # + # Note: The following fields are mutually exclusive: `remove_facet_action`, `boost_action`, `redirect_action`, `oneway_synonyms_action`, `do_not_associate_action`, `replacement_action`, `ignore_action`, `filter_action`, `twoway_synonyms_action`, `force_return_facet_action`, `pin_action`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [rw] pin_action + # @return [::Google::Cloud::Retail::V2::Rule::PinAction] + # Pins one or more specified products to a specific position in the + # results. + # + # Note: The following fields are mutually exclusive: `pin_action`, `boost_action`, `redirect_action`, `oneway_synonyms_action`, `do_not_associate_action`, `replacement_action`, `ignore_action`, `filter_action`, `twoway_synonyms_action`, `force_return_facet_action`, `remove_facet_action`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [rw] condition + # @return [::Google::Cloud::Retail::V2::Condition] + # Required. The condition that triggers the rule. + # If the condition is empty, the rule will always apply. + class Rule + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # A boost action to apply to results matching condition specified above. + # @!attribute [rw] boost + # @return [::Float] + # Strength of the condition boost, which must be in [-1, 1]. Negative + # boost means demotion. Default is 0.0. + # + # Setting to 1.0 gives the item a big promotion. However, it does not + # necessarily mean that the boosted item will be the top result at all + # times, nor that other items will be excluded. Results could still be + # shown even when none of them matches the condition. And results that + # are significantly more relevant to the search query can still trump + # your heavily favored but irrelevant items. + # + # Setting to -1.0 gives the item a big demotion. However, results that + # are deeply relevant might still be shown. The item will have an + # upstream battle to get a fairly high ranking, but it is not blocked out + # completely. + # + # Setting to 0.0 means no boost applied. The boosting condition is + # ignored. + # @!attribute [rw] products_filter + # @return [::String] + # The filter can have a max size of 5000 characters. + # An expression which specifies which products to apply an action to. + # The syntax and supported fields are the same as a filter expression. See + # {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter} for + # detail syntax and limitations. + # + # Examples: + # + # * To boost products with product ID "product_1" or "product_2", and + # color + # "Red" or "Blue":
+ # *(id: ANY("product_1", "product_2"))
* + # *AND
* + # *(colorFamilies: ANY("Red", "Blue"))
* + class BoostAction + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # * Rule Condition: + # - No + # {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms} + # provided is a global match. + # - 1 or more + # {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms} + # provided are combined with OR operator. + # + # * Action Input: The request query and filter that are applied to the + # retrieved products, in addition to any filters already provided with the + # SearchRequest. The AND operator is used to combine the query's existing + # filters with the filter rule(s). NOTE: May result in 0 results when + # filters conflict. + # + # * Action Result: Filters the returned objects to be ONLY those that passed + # the filter. + # @!attribute [rw] filter + # @return [::String] + # A filter to apply on the matching condition results. Supported features: + # + # * {::Google::Cloud::Retail::V2::Rule::FilterAction#filter filter} must be set. + # * Filter syntax is identical to + # {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}. For + # more + # information, see [Filter](/retail/docs/filter-and-order#filter). + # * To filter products with product ID "product_1" or "product_2", and + # color + # "Red" or "Blue":
+ # *(id: ANY("product_1", "product_2"))
* + # *AND
* + # *(colorFamilies: ANY("Red", "Blue"))
* + class FilterAction + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Redirects a shopper to a specific page. + # + # * Rule Condition: + # Must specify + # {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}. + # * Action Input: Request Query + # * Action Result: Redirects shopper to provided uri. + # @!attribute [rw] redirect_uri + # @return [::String] + # URL must have length equal or less than 2000 characters. + class RedirectAction + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Creates a set of terms that will be treated as synonyms of each other. + # Example: synonyms of "sneakers" and "shoes": + # + # * "sneakers" will use a synonym of "shoes". + # * "shoes" will use a synonym of "sneakers". + # @!attribute [rw] synonyms + # @return [::Array<::String>] + # Defines a set of synonyms. + # Can specify up to 100 synonyms. + # Must specify at least 2 synonyms. + class TwowaySynonymsAction + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Maps a set of terms to a set of synonyms. + # Set of synonyms will be treated as synonyms of each query term only. + # `query_terms` will not be treated as synonyms of each other. + # Example: "sneakers" will use a synonym of "shoes". + # "shoes" will not use a synonym of "sneakers". + # @!attribute [rw] query_terms + # @return [::Array<::String>] + # Terms from the search query. + # Will treat synonyms as their synonyms. + # Not themselves synonyms of the synonyms. + # Can specify up to 100 terms. + # @!attribute [rw] synonyms + # @return [::Array<::String>] + # Defines a set of synonyms. + # Cannot contain duplicates. + # Can specify up to 100 synonyms. + # @!attribute [rw] oneway_terms + # @return [::Array<::String>] + # Will be [deprecated = true] post migration; + class OnewaySynonymsAction + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Prevents `query_term` from being associated with specified terms during + # search. + # Example: Don't associate "gShoe" and "cheap". + # @!attribute [rw] query_terms + # @return [::Array<::String>] + # Terms from the search query. + # Will not consider do_not_associate_terms for search if in search query. + # Can specify up to 100 terms. + # @!attribute [rw] do_not_associate_terms + # @return [::Array<::String>] + # Cannot contain duplicates or the query term. + # Can specify up to 100 terms. + # @!attribute [rw] terms + # @return [::Array<::String>] + # Will be [deprecated = true] post migration; + class DoNotAssociateAction + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Replaces a term in the query. Multiple replacement candidates can be + # specified. All `query_terms` will be replaced with the replacement term. + # Example: Replace "gShoe" with "google shoe". + # @!attribute [rw] query_terms + # @return [::Array<::String>] + # Terms from the search query. + # Will be replaced by replacement term. + # Can specify up to 100 terms. + # @!attribute [rw] replacement_term + # @return [::String] + # Term that will be used for replacement. + # @!attribute [rw] term + # @return [::String] + # Will be [deprecated = true] post migration; + class ReplacementAction + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Prevents a term in the query from being used in search. + # Example: Don't search for "shoddy". + # @!attribute [rw] ignore_terms + # @return [::Array<::String>] + # Terms to ignore in the search query. + class IgnoreAction + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Force returns an attribute/facet in the request around a certain position + # or above. + # + # * Rule Condition: + # Must specify non-empty + # {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms} + # (for search only) or + # {::Google::Cloud::Retail::V2::Condition#page_categories Condition.page_categories} + # (for browse only), but can't specify both. + # + # * Action Inputs: attribute name, position + # + # * Action Result: Will force return a facet key around a certain position + # or above if the condition is satisfied. + # + # Example: Suppose the query is "shoes", the + # {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms} is + # "shoes", the + # {::Google::Cloud::Retail::V2::Rule::ForceReturnFacetAction::FacetPositionAdjustment#attribute_name ForceReturnFacetAction.FacetPositionAdjustment.attribute_name} + # is "size" and the + # {::Google::Cloud::Retail::V2::Rule::ForceReturnFacetAction::FacetPositionAdjustment#position ForceReturnFacetAction.FacetPositionAdjustment.position} + # is 8. + # + # Two cases: a) The facet key "size" is not already in the top 8 slots, then + # the facet "size" will appear at a position close to 8. b) The facet key + # "size" in among the top 8 positions in the request, then it will stay at + # its current rank. + # @!attribute [rw] facet_position_adjustments + # @return [::Array<::Google::Cloud::Retail::V2::Rule::ForceReturnFacetAction::FacetPositionAdjustment>] + # Each instance corresponds to a force return attribute for the given + # condition. There can't be more 15 instances here. + class ForceReturnFacetAction + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Each facet position adjustment consists of a single attribute name (i.e. + # facet key) along with a specified position. + # @!attribute [rw] attribute_name + # @return [::String] + # The attribute name to force return as a facet. Each attribute name + # should be a valid attribute name, be non-empty and contain at most 80 + # characters long. + # @!attribute [rw] position + # @return [::Integer] + # This is the position in the request as explained above. It should be + # strictly positive be at most 100. + class FacetPositionAdjustment + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # Removes an attribute/facet in the request if is present. + # + # * Rule Condition: + # Must specify non-empty + # {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms} + # (for search only) or + # {::Google::Cloud::Retail::V2::Condition#page_categories Condition.page_categories} + # (for browse only), but can't specify both. + # + # * Action Input: attribute name + # + # * Action Result: Will remove the attribute (as a facet) from the request + # if it is present. + # + # Example: Suppose the query is "shoes", the + # {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms} is + # "shoes" and the attribute name "size", then facet key "size" will be + # removed from the request (if it is present). + # @!attribute [rw] attribute_names + # @return [::Array<::String>] + # The attribute names (i.e. facet keys) to remove from the dynamic facets + # (if present in the request). There can't be more 3 attribute names. + # Each attribute name should be a valid attribute name, be non-empty and + # contain at most 80 characters. + class RemoveFacetAction + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Pins one or more specified products to a specific position in the + # results. + # + # * Rule Condition: + # Must specify non-empty + # {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms} + # (for search only) or + # {::Google::Cloud::Retail::V2::Condition#page_categories Condition.page_categories} + # (for browse only), but can't specify both. + # + # * Action Input: mapping of `[pin_position, product_id]` pairs (pin position + # uses 1-based indexing). + # + # * Action Result: Will pin products with matching ids to the position + # specified in the final result order. + # + # Example: Suppose the query is `shoes`, the + # {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms} is + # `shoes` and the pin_map has `{1, "pid1"}`, then product with `pid1` will be + # pinned to the top position in the final results. + # + # If multiple PinActions are matched to a single request the actions will + # be processed from most to least recently updated. + # + # Pins to positions larger than the max allowed page size of 120 are not + # allowed. + # @!attribute [rw] pin_map + # @return [::Google::Protobuf::Map{::Integer => ::String}] + # Required. A map of positions to product_ids. + # + # Partial matches per action are allowed, if a certain position in the map + # is already filled that `[position, product_id]` pair will be ignored + # but the rest may still be applied. This case will only occur if multiple + # pin actions are matched to a single request, as the map guarantees that + # pin positions are unique within the same action. + # + # Duplicate product_ids are not permitted within a single pin map. + # + # The max size of this map is 120, equivalent to the max [request page + # size](https://cloud.google.com/retail/docs/reference/rest/v2/projects.locations.catalogs.placements/search#request-body). + class PinAction + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # @!attribute [rw] key + # @return [::Integer] + # @!attribute [rw] value + # @return [::String] + class PinMapEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + end + + # An intended audience of the {::Google::Cloud::Retail::V2::Product Product} for + # whom it's sold. + # @!attribute [rw] genders + # @return [::Array<::String>] + # The genders of the audience. Strongly encouraged to use the standard + # values: "male", "female", "unisex". + # + # At most 5 values are allowed. Each value must be a UTF-8 encoded string + # with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error + # is returned. + # + # Google Merchant Center property + # [gender](https://support.google.com/merchants/answer/6324479). Schema.org + # property + # [Product.audience.suggestedGender](https://schema.org/suggestedGender). + # @!attribute [rw] age_groups + # @return [::Array<::String>] + # The age groups of the audience. Strongly encouraged to use the standard + # values: "newborn" (up to 3 months old), "infant" (3–12 months old), + # "toddler" (1–5 years old), "kids" (5–13 years old), "adult" (typically + # teens or older). + # + # At most 5 values are allowed. Each value must be a UTF-8 encoded string + # with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error + # is returned. + # + # Google Merchant Center property + # [age_group](https://support.google.com/merchants/answer/6324463). + # Schema.org property + # [Product.audience.suggestedMinAge](https://schema.org/suggestedMinAge) and + # [Product.audience.suggestedMaxAge](https://schema.org/suggestedMaxAge). + class Audience + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The color information of a {::Google::Cloud::Retail::V2::Product Product}. + # @!attribute [rw] color_families + # @return [::Array<::String>] + # The standard color families. Strongly recommended to use the following + # standard color groups: "Red", "Pink", "Orange", "Yellow", "Purple", + # "Green", "Cyan", "Blue", "Brown", "White", "Gray", "Black" and "Mixed". + # Normally it is expected to have only 1 color family. May consider using + # single "Mixed" instead of multiple values. + # + # A maximum of 5 values are allowed. Each value must be a UTF-8 encoded + # string with a length limit of 128 characters. Otherwise, an + # INVALID_ARGUMENT error is returned. + # + # Google Merchant Center property + # [color](https://support.google.com/merchants/answer/6324487). Schema.org + # property [Product.color](https://schema.org/color). + # + # The colorFamilies field as a system attribute is not a required field but + # strongly recommended to be specified. Google Search models treat this field + # as more important than a custom product attribute when specified. + # @!attribute [rw] colors + # @return [::Array<::String>] + # The color display names, which may be different from standard color family + # names, such as the color aliases used in the website frontend. Normally + # it is expected to have only 1 color. May consider using single "Mixed" + # instead of multiple values. + # + # A maximum of 75 colors are allowed. Each value must be a UTF-8 encoded + # string with a length limit of 128 characters. Otherwise, an + # INVALID_ARGUMENT error is returned. + # + # Google Merchant Center property + # [color](https://support.google.com/merchants/answer/6324487). Schema.org + # property [Product.color](https://schema.org/color). + class ColorInfo + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # A custom attribute that is not explicitly modeled in + # {::Google::Cloud::Retail::V2::Product Product}. + # @!attribute [rw] text + # @return [::Array<::String>] + # The textual values of this custom attribute. For example, `["yellow", + # "green"]` when the key is "color". + # + # Empty string is not allowed. Otherwise, an INVALID_ARGUMENT error is + # returned. + # + # Exactly one of {::Google::Cloud::Retail::V2::CustomAttribute#text text} or + # {::Google::Cloud::Retail::V2::CustomAttribute#numbers numbers} should be set. + # Otherwise, an INVALID_ARGUMENT error is returned. + # @!attribute [rw] numbers + # @return [::Array<::Float>] + # The numerical values of this custom attribute. For example, `[2.3, 15.4]` + # when the key is "lengths_cm". + # + # Exactly one of {::Google::Cloud::Retail::V2::CustomAttribute#text text} or + # {::Google::Cloud::Retail::V2::CustomAttribute#numbers numbers} should be set. + # Otherwise, an INVALID_ARGUMENT error is returned. + # @!attribute [rw] searchable + # @deprecated This field is deprecated and may be removed in the next major version update. + # @return [::Boolean] + # This field is normally ignored unless + # {::Google::Cloud::Retail::V2::AttributesConfig#attribute_config_level AttributesConfig.attribute_config_level} + # of the {::Google::Cloud::Retail::V2::Catalog Catalog} is set to the deprecated + # 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG' mode. For information about product-level + # attribute configuration, see [Configuration + # modes](https://cloud.google.com/retail/docs/attribute-config#config-modes). + # If true, custom attribute values are searchable by text queries in + # {::Google::Cloud::Retail::V2::SearchService::Client#search SearchService.Search}. + # + # This field is ignored in a {::Google::Cloud::Retail::V2::UserEvent UserEvent}. + # + # Only set if type {::Google::Cloud::Retail::V2::CustomAttribute#text text} is + # set. Otherwise, a INVALID_ARGUMENT error is returned. + # @!attribute [rw] indexable + # @deprecated This field is deprecated and may be removed in the next major version update. + # @return [::Boolean] + # This field is normally ignored unless + # {::Google::Cloud::Retail::V2::AttributesConfig#attribute_config_level AttributesConfig.attribute_config_level} + # of the {::Google::Cloud::Retail::V2::Catalog Catalog} is set to the deprecated + # 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG' mode. For information about product-level + # attribute configuration, see [Configuration + # modes](https://cloud.google.com/retail/docs/attribute-config#config-modes). + # If true, custom attribute values are indexed, so that they can be filtered, + # faceted or boosted in + # {::Google::Cloud::Retail::V2::SearchService::Client#search SearchService.Search}. + # + # This field is ignored in a {::Google::Cloud::Retail::V2::UserEvent UserEvent}. + # + # See {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}, + # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs} + # and + # {::Google::Cloud::Retail::V2::SearchRequest#boost_spec SearchRequest.boost_spec} + # for more details. + class CustomAttribute + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Fulfillment information, such as the store IDs for in-store pickup or region + # IDs for different shipping methods. + # @!attribute [rw] type + # @return [::String] + # The fulfillment type, including commonly used types (such as pickup in + # store and same day delivery), and custom types. Customers have to map + # custom types to their display names before rendering UI. + # + # Supported values: + # + # * "pickup-in-store" + # * "ship-to-store" + # * "same-day-delivery" + # * "next-day-delivery" + # * "custom-type-1" + # * "custom-type-2" + # * "custom-type-3" + # * "custom-type-4" + # * "custom-type-5" + # + # If this field is set to an invalid value other than these, an + # INVALID_ARGUMENT error is returned. + # @!attribute [rw] place_ids + # @return [::Array<::String>] + # The IDs for this {::Google::Cloud::Retail::V2::FulfillmentInfo#type type}, such + # as the store IDs for + # {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type.pickup-in-store} + # or the region IDs for + # {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type.same-day-delivery}. + # + # A maximum of 3000 values are allowed. Each value must be a string with a + # length limit of 30 characters, matching the pattern `[a-zA-Z0-9_-]+`, such + # as "store1" or "REGION-2". Otherwise, an INVALID_ARGUMENT error is + # returned. + class FulfillmentInfo + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # {::Google::Cloud::Retail::V2::Product Product} image. Recommendations AI and + # Retail Search use product images to improve prediction and search results. + # Product images can be returned in results, and are shown in prediction or + # search previews in the console. Please try to provide correct product images + # and avoid using images with size too small. + # @!attribute [rw] uri + # @return [::String] + # Required. URI of the image. + # + # This field must be a valid UTF-8 encoded URI with a length limit of 5,000 + # characters. Otherwise, an INVALID_ARGUMENT error is returned. + # + # Google Merchant Center property + # [image_link](https://support.google.com/merchants/answer/6324350). + # Schema.org property [Product.image](https://schema.org/image). + # @!attribute [rw] height + # @return [::Integer] + # Height of the image in number of pixels. + # + # This field must be nonnegative. Otherwise, an INVALID_ARGUMENT error is + # returned. + # @!attribute [rw] width + # @return [::Integer] + # Width of the image in number of pixels. + # + # This field must be nonnegative. Otherwise, an INVALID_ARGUMENT error is + # returned. + class Image + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # A floating point interval. + # @!attribute [rw] minimum + # @return [::Float] + # Inclusive lower bound. + # + # Note: The following fields are mutually exclusive: `minimum`, `exclusive_minimum`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [rw] exclusive_minimum + # @return [::Float] + # Exclusive lower bound. + # + # Note: The following fields are mutually exclusive: `exclusive_minimum`, `minimum`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [rw] maximum + # @return [::Float] + # Inclusive upper bound. + # + # Note: The following fields are mutually exclusive: `maximum`, `exclusive_maximum`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [rw] exclusive_maximum + # @return [::Float] + # Exclusive upper bound. + # + # Note: The following fields are mutually exclusive: `exclusive_maximum`, `maximum`. If a field in that set is populated, all other fields in the set will automatically be cleared. + class Interval + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The price information of a {::Google::Cloud::Retail::V2::Product Product}. + # @!attribute [rw] currency_code + # @return [::String] + # The 3-letter currency code defined in [ISO + # 4217](https://www.iso.org/iso-4217-currency-codes.html). + # + # If this field is an unrecognizable currency code, an INVALID_ARGUMENT + # error is returned. + # + # The {::Google::Cloud::Retail::V2::Product::Type::VARIANT Product.Type.VARIANT} + # {::Google::Cloud::Retail::V2::Product Product}s with the same + # {::Google::Cloud::Retail::V2::Product#primary_product_id Product.primary_product_id} + # must share the same + # {::Google::Cloud::Retail::V2::PriceInfo#currency_code currency_code}. Otherwise, + # a FAILED_PRECONDITION error is returned. + # @!attribute [rw] price + # @return [::Float] + # Price of the product. + # + # Google Merchant Center property + # [price](https://support.google.com/merchants/answer/6324371). Schema.org + # property [Offer.price](https://schema.org/price). + # @!attribute [rw] original_price + # @return [::Float] + # Price of the product without any discount. If zero, by default set to be + # the {::Google::Cloud::Retail::V2::PriceInfo#price price}. If set, + # {::Google::Cloud::Retail::V2::PriceInfo#original_price original_price} should be + # greater than or equal to {::Google::Cloud::Retail::V2::PriceInfo#price price}, + # otherwise an INVALID_ARGUMENT error is thrown. + # @!attribute [rw] cost + # @return [::Float] + # The costs associated with the sale of a particular product. Used for gross + # profit reporting. + # + # * Profit = {::Google::Cloud::Retail::V2::PriceInfo#price price} - + # {::Google::Cloud::Retail::V2::PriceInfo#cost cost} + # + # Google Merchant Center property + # [cost_of_goods_sold](https://support.google.com/merchants/answer/9017895). + # @!attribute [rw] price_effective_time + # @return [::Google::Protobuf::Timestamp] + # The timestamp when the {::Google::Cloud::Retail::V2::PriceInfo#price price} + # starts to be effective. This can be set as a future timestamp, and the + # {::Google::Cloud::Retail::V2::PriceInfo#price price} is only used for search + # after + # {::Google::Cloud::Retail::V2::PriceInfo#price_effective_time price_effective_time}. + # If so, the + # {::Google::Cloud::Retail::V2::PriceInfo#original_price original_price} must be + # set and {::Google::Cloud::Retail::V2::PriceInfo#original_price original_price} + # is used before + # {::Google::Cloud::Retail::V2::PriceInfo#price_effective_time price_effective_time}. + # + # Do not set if {::Google::Cloud::Retail::V2::PriceInfo#price price} is always + # effective because it will cause additional latency during search. + # @!attribute [rw] price_expire_time + # @return [::Google::Protobuf::Timestamp] + # The timestamp when the {::Google::Cloud::Retail::V2::PriceInfo#price price} + # stops to be effective. The {::Google::Cloud::Retail::V2::PriceInfo#price price} + # is used for search before + # {::Google::Cloud::Retail::V2::PriceInfo#price_expire_time price_expire_time}. If + # this field is set, the + # {::Google::Cloud::Retail::V2::PriceInfo#original_price original_price} must be + # set and {::Google::Cloud::Retail::V2::PriceInfo#original_price original_price} + # is used after + # {::Google::Cloud::Retail::V2::PriceInfo#price_expire_time price_expire_time}. + # + # Do not set if {::Google::Cloud::Retail::V2::PriceInfo#price price} is always + # effective because it will cause additional latency during search. + # @!attribute [r] price_range + # @return [::Google::Cloud::Retail::V2::PriceInfo::PriceRange] + # Output only. The price range of all the child + # {::Google::Cloud::Retail::V2::Product::Type::VARIANT Product.Type.VARIANT} + # {::Google::Cloud::Retail::V2::Product Product}s grouped together on the + # {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Product.Type.PRIMARY} + # {::Google::Cloud::Retail::V2::Product Product}. Only populated for + # {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Product.Type.PRIMARY} + # {::Google::Cloud::Retail::V2::Product Product}s. + # + # Note: This field is OUTPUT_ONLY for + # {::Google::Cloud::Retail::V2::ProductService::Client#get_product ProductService.GetProduct}. + # Do not set this field in API requests. + class PriceInfo + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # The price range of all + # {::Google::Cloud::Retail::V2::Product::Type::VARIANT variant} + # {::Google::Cloud::Retail::V2::Product Product} having the same + # {::Google::Cloud::Retail::V2::Product#primary_product_id Product.primary_product_id}. + # @!attribute [rw] price + # @return [::Google::Cloud::Retail::V2::Interval] + # The inclusive + # {::Google::Cloud::Retail::V2::PriceInfo#price Product.pricing_info.price} + # interval of all {::Google::Cloud::Retail::V2::Product::Type::VARIANT variant} + # {::Google::Cloud::Retail::V2::Product Product} having the same + # {::Google::Cloud::Retail::V2::Product#primary_product_id Product.primary_product_id}. + # @!attribute [rw] original_price + # @return [::Google::Cloud::Retail::V2::Interval] + # The inclusive + # {::Google::Cloud::Retail::V2::PriceInfo#original_price Product.pricing_info.original_price} + # internal of all {::Google::Cloud::Retail::V2::Product::Type::VARIANT variant} + # {::Google::Cloud::Retail::V2::Product Product} having the same + # {::Google::Cloud::Retail::V2::Product#primary_product_id Product.primary_product_id}. + class PriceRange + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # The rating of a {::Google::Cloud::Retail::V2::Product Product}. + # @!attribute [rw] rating_count + # @return [::Integer] + # The total number of ratings. This value is independent of the value of + # {::Google::Cloud::Retail::V2::Rating#rating_histogram rating_histogram}. + # + # This value must be nonnegative. Otherwise, an INVALID_ARGUMENT error is + # returned. + # @!attribute [rw] average_rating + # @return [::Float] + # The average rating of the {::Google::Cloud::Retail::V2::Product Product}. + # + # The rating is scaled at 1-5. Otherwise, an INVALID_ARGUMENT error is + # returned. + # @!attribute [rw] rating_histogram + # @return [::Array<::Integer>] + # List of rating counts per rating value (index = rating - 1). The list is + # empty if there is no rating. If the list is non-empty, its size is + # always 5. Otherwise, an INVALID_ARGUMENT error is returned. + # + # For example, [41, 14, 13, 47, 303]. It means that the + # {::Google::Cloud::Retail::V2::Product Product} got 41 ratings with 1 star, 14 + # ratings with 2 star, and so on. + class Rating + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Information of an end user. + # @!attribute [rw] user_id + # @return [::String] + # Highly recommended for logged-in users. Unique identifier for logged-in + # user, such as a user name. Don't set for anonymous users. + # + # Always use a hashed value for this ID. + # + # Don't set the field to the same fixed ID for different users. This mixes + # the event history of those users together, which results in degraded + # model quality. + # + # The field must be a UTF-8 encoded string with a length limit of 128 + # characters. Otherwise, an INVALID_ARGUMENT error is returned. + # @!attribute [rw] ip_address + # @return [::String] + # The end user's IP address. This field is used to extract location + # information for personalization. + # + # This field must be either an IPv4 address (e.g. "104.133.9.80") or an IPv6 + # address (e.g. "2001:0db8:85a3:0000:0000:8a2e:0370:7334"). Otherwise, an + # INVALID_ARGUMENT error is returned. + # + # This should not be set when: + # + # * setting + # {::Google::Cloud::Retail::V2::SearchRequest#user_info SearchRequest.user_info}. + # * using the JavaScript tag in + # {::Google::Cloud::Retail::V2::UserEventService::Client#collect_user_event UserEventService.CollectUserEvent} + # or if + # {::Google::Cloud::Retail::V2::UserInfo#direct_user_request direct_user_request} + # is set. + # @!attribute [rw] user_agent + # @return [::String] + # User agent as included in the HTTP header. + # The field must be a UTF-8 encoded string with a length limit of 1,000 + # characters. Otherwise, an INVALID_ARGUMENT error is returned. + # + # This should not be set when using the client side event reporting with + # GTM or JavaScript tag in + # {::Google::Cloud::Retail::V2::UserEventService::Client#collect_user_event UserEventService.CollectUserEvent} + # or if + # {::Google::Cloud::Retail::V2::UserInfo#direct_user_request direct_user_request} + # is set. + # @!attribute [rw] direct_user_request + # @return [::Boolean] + # True if the request is made directly from the end user, in which case the + # {::Google::Cloud::Retail::V2::UserInfo#ip_address ip_address} and + # {::Google::Cloud::Retail::V2::UserInfo#user_agent user_agent} can be populated + # from the HTTP request. This flag should be set only if the API request is + # made directly from the end user such as a mobile app (and not if a gateway + # or a server is processing and pushing the user events). + # + # This should not be set when using the JavaScript tag in + # {::Google::Cloud::Retail::V2::UserEventService::Client#collect_user_event UserEventService.CollectUserEvent}. + class UserInfo + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The inventory information at a place (e.g. a store) identified + # by a place ID. + # @!attribute [rw] place_id + # @return [::String] + # Optional. The place ID for the current set of inventory information. + # @!attribute [rw] price_info + # @return [::Google::Cloud::Retail::V2::PriceInfo] + # Optional. Product price and cost information. + # + # Google Merchant Center property + # [price](https://support.google.com/merchants/answer/6324371). + # @!attribute [rw] attributes + # @return [::Google::Protobuf::Map{::String => ::Google::Cloud::Retail::V2::CustomAttribute}] + # Optional. Additional local inventory attributes, for example, store name, + # promotion tags, etc. + # + # This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT + # error is returned: + # + # * At most 30 attributes are allowed. + # * The key must be a UTF-8 encoded string with a length limit of 32 + # characters. + # * The key must match the pattern: `[a-zA-Z0-9][a-zA-Z0-9_]*`. For example, + # key0LikeThis or KEY_1_LIKE_THIS. + # * The attribute values must be of the same type (text or number). + # * Only 1 value is allowed for each attribute. + # * For text values, the length limit is 256 UTF-8 characters. + # * The attribute does not support search. The `searchable` field should be + # unset or set to false. + # * The max summed total bytes of custom attribute keys and values per + # product is 5MiB. + # @!attribute [rw] fulfillment_types + # @return [::Array<::String>] + # Optional. Supported fulfillment types. Valid fulfillment type values + # include commonly used types (such as pickup in store and same day + # delivery), and custom types. Customers have to map custom types to their + # display names before rendering UI. + # + # Supported values: + # + # * "pickup-in-store" + # * "ship-to-store" + # * "same-day-delivery" + # * "next-day-delivery" + # * "custom-type-1" + # * "custom-type-2" + # * "custom-type-3" + # * "custom-type-4" + # * "custom-type-5" + # + # If this field is set to an invalid value other than these, an + # INVALID_ARGUMENT error is returned. + # + # All the elements must be distinct. Otherwise, an INVALID_ARGUMENT error is + # returned. + class LocalInventory + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # @!attribute [rw] key + # @return [::String] + # @!attribute [rw] value + # @return [::Google::Cloud::Retail::V2::CustomAttribute] + class AttributesEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # Metadata for pinning to be returned in the response. + # This is used for distinguishing between applied vs dropped pins. + # @!attribute [rw] all_matched_pins + # @return [::Google::Protobuf::Map{::Integer => ::Google::Cloud::Retail::V2::PinControlMetadata::ProductPins}] + # Map of all matched pins, keyed by pin position. + # @!attribute [rw] dropped_pins + # @return [::Google::Protobuf::Map{::Integer => ::Google::Cloud::Retail::V2::PinControlMetadata::ProductPins}] + # Map of pins that were dropped due to overlap with other matching pins, + # keyed by pin position. + class PinControlMetadata + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # List of product ids which have associated pins. + # @!attribute [rw] product_id + # @return [::Array<::String>] + # List of product ids which have associated pins. + class ProductPins + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # @!attribute [rw] key + # @return [::Integer] + # @!attribute [rw] value + # @return [::Google::Cloud::Retail::V2::PinControlMetadata::ProductPins] + class AllMatchedPinsEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # @!attribute [rw] key + # @return [::Integer] + # @!attribute [rw] value + # @return [::Google::Cloud::Retail::V2::PinControlMetadata::ProductPins] + class DroppedPinsEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # A list of string values. + # @!attribute [rw] values + # @return [::Array<::String>] + # String values. + class StringList + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # A message with a list of double values. + # @!attribute [rw] values + # @return [::Array<::Float>] + # The list of double values. + class DoubleList + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # At which level we offer configuration for attributes. + module AttributeConfigLevel + # Value used when unset. In this case, server behavior defaults to + # {::Google::Cloud::Retail::V2::AttributeConfigLevel::CATALOG_LEVEL_ATTRIBUTE_CONFIG CATALOG_LEVEL_ATTRIBUTE_CONFIG}. + ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED = 0 + + # At this level, we honor the attribute configurations set in + # {::Google::Cloud::Retail::V2::Product#attributes Product.attributes}. + PRODUCT_LEVEL_ATTRIBUTE_CONFIG = 1 + + # At this level, we honor the attribute configurations set in + # `CatalogConfig.attribute_configs`. + CATALOG_LEVEL_ATTRIBUTE_CONFIG = 2 + end + + # The type of solution. + module SolutionType + # Default value. + SOLUTION_TYPE_UNSPECIFIED = 0 + + # Used for Recommendations AI. + SOLUTION_TYPE_RECOMMENDATION = 1 + + # Used for Retail Search. + SOLUTION_TYPE_SEARCH = 2 + end + + # If filtering for recommendations is enabled. + module RecommendationsFilteringOption + # Value used when unset. + # In this case, server behavior defaults to + # {::Google::Cloud::Retail::V2::RecommendationsFilteringOption::RECOMMENDATIONS_FILTERING_DISABLED RECOMMENDATIONS_FILTERING_DISABLED}. + RECOMMENDATIONS_FILTERING_OPTION_UNSPECIFIED = 0 + + # Recommendation filtering is disabled. + RECOMMENDATIONS_FILTERING_DISABLED = 1 + + # Recommendation filtering is enabled. + RECOMMENDATIONS_FILTERING_ENABLED = 3 + end + + # The use case of Cloud Retail Search. + module SearchSolutionUseCase + # The value when it's unspecified. In this case, server behavior defaults to + # {::Google::Cloud::Retail::V2::SearchSolutionUseCase::SEARCH_SOLUTION_USE_CASE_SEARCH SEARCH_SOLUTION_USE_CASE_SEARCH}. + SEARCH_SOLUTION_USE_CASE_UNSPECIFIED = 0 + + # Search use case. Expects the traffic has a non-empty + # {::Google::Cloud::Retail::V2::SearchRequest#query query}. + SEARCH_SOLUTION_USE_CASE_SEARCH = 1 + + # Browse use case. Expects the traffic has an empty + # {::Google::Cloud::Retail::V2::SearchRequest#query query}. + SEARCH_SOLUTION_USE_CASE_BROWSE = 2 + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/completion_service.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/completion_service.rb new file mode 100644 index 000000000000..b0608b79614d --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/completion_service.rb @@ -0,0 +1,230 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Retail + module V2 + # Autocomplete parameters. + # @!attribute [rw] catalog + # @return [::String] + # Required. Catalog for which the completion is performed. + # + # Full resource name of catalog, such as + # `projects/*/locations/global/catalogs/default_catalog`. + # @!attribute [rw] query + # @return [::String] + # Required. The query used to generate suggestions. + # + # The maximum number of allowed characters is 255. + # @!attribute [rw] visitor_id + # @return [::String] + # Recommended field. A unique identifier for tracking visitors. For example, + # this could be implemented with an HTTP cookie, which should be able to + # uniquely identify a visitor on a single device. This unique identifier + # should not change if the visitor logs in or out of the website. + # + # The field must be a UTF-8 encoded string with a length limit of 128 + # characters. Otherwise, an INVALID_ARGUMENT error is returned. + # @!attribute [rw] language_codes + # @return [::Array<::String>] + # Note that this field applies for `user-data` dataset only. For requests + # with `cloud-retail` dataset, setting this field has no effect. + # + # The language filters applied to the output suggestions. If set, it should + # contain the language of the query. If not set, suggestions are returned + # without considering language restrictions. This is the BCP-47 language + # code, such as "en-US" or "sr-Latn". For more information, see [Tags for + # Identifying Languages](https://tools.ietf.org/html/bcp47). The maximum + # number of language codes is 3. + # @!attribute [rw] device_type + # @return [::String] + # The device type context for completion suggestions. We recommend that you + # leave this field empty. + # + # It can apply different suggestions on different device types, e.g. + # `DESKTOP`, `MOBILE`. If it is empty, the suggestions are across all device + # types. + # + # Supported formats: + # + # * `UNKNOWN_DEVICE_TYPE` + # + # * `DESKTOP` + # + # * `MOBILE` + # + # * A customized string starts with `OTHER_`, e.g. `OTHER_IPHONE`. + # @!attribute [rw] dataset + # @return [::String] + # Determines which dataset to use for fetching completion. "user-data" will + # use the dataset imported through + # {::Google::Cloud::Retail::V2::CompletionService::Client#import_completion_data CompletionService.ImportCompletionData}. + # `cloud-retail` will use the dataset generated by Cloud Retail based on user + # events. If left empty, completions will be fetched from the `user-data` + # dataset. + # + # Current supported values: + # + # * user-data + # + # * cloud-retail: + # This option requires enabling auto-learning function first. See + # [guidelines](https://cloud.google.com/retail/docs/completion-overview#generated-completion-dataset). + # @!attribute [rw] max_suggestions + # @return [::Integer] + # Completion max suggestions. If left unset or set to 0, then will fallback + # to the configured value + # {::Google::Cloud::Retail::V2::CompletionConfig#max_suggestions CompletionConfig.max_suggestions}. + # + # The maximum allowed max suggestions is 20. If it is set higher, it will be + # capped by 20. + # @!attribute [rw] enable_attribute_suggestions + # @return [::Boolean] + # If true, attribute suggestions are enabled and provided in the response. + # + # This field is only available for the `cloud-retail` dataset. + # @!attribute [rw] entity + # @return [::String] + # The entity for customers who run multiple entities, domains, sites, or + # regions, for example, `Google US`, `Google Ads`, `Waymo`, + # `google.com`, `youtube.com`, etc. + # If this is set, it must be an exact match with + # {::Google::Cloud::Retail::V2::UserEvent#entity UserEvent.entity} to get + # per-entity autocomplete results. This field will be applied to + # `completion_results` only. It has no effect on the `attribute_results`. + # Also, this entity should be limited to 256 characters, if too long, it will + # be truncated to 256 characters in both generation and serving time, and may + # lead to mis-match. To ensure it works, please set the entity with string + # within 256 characters. + class CompleteQueryRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Response of the autocomplete query. + # @!attribute [rw] completion_results + # @return [::Array<::Google::Cloud::Retail::V2::CompleteQueryResponse::CompletionResult>] + # Results of the matching suggestions. The result list is ordered and the + # first result is top suggestion. + # @!attribute [rw] attribution_token + # @return [::String] + # A unique complete token. This should be included in the + # {::Google::Cloud::Retail::V2::UserEvent#completion_detail UserEvent.completion_detail} + # for search events resulting from this completion, which enables accurate + # attribution of complete model performance. + # @!attribute [rw] recent_search_results + # @deprecated This field is deprecated and may be removed in the next major version update. + # @return [::Array<::Google::Cloud::Retail::V2::CompleteQueryResponse::RecentSearchResult>] + # Deprecated. Matched recent searches of this user. The maximum number of + # recent searches is 10. This field is a restricted feature. If you want to + # enable it, contact Retail Search support. + # + # This feature is only available when + # {::Google::Cloud::Retail::V2::CompleteQueryRequest#visitor_id CompleteQueryRequest.visitor_id} + # field is set and {::Google::Cloud::Retail::V2::UserEvent UserEvent} is imported. + # The recent searches satisfy the follow rules: + # + # * They are ordered from latest to oldest. + # + # * They are matched with + # {::Google::Cloud::Retail::V2::CompleteQueryRequest#query CompleteQueryRequest.query} + # case insensitively. + # + # * They are transformed to lower case. + # + # * They are UTF-8 safe. + # + # Recent searches are deduplicated. More recent searches will be reserved + # when duplication happens. + # @!attribute [rw] attribute_results + # @return [::Google::Protobuf::Map{::String => ::Google::Cloud::Retail::V2::CompleteQueryResponse::AttributeResult}] + # A map of matched attribute suggestions. This field is only available for + # `cloud-retail` dataset. + # + # Current supported keys: + # + # * `brands` + # + # * `categories` + class CompleteQueryResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Resource that represents completion results. + # @!attribute [rw] suggestion + # @return [::String] + # The suggestion for the query. + # @!attribute [rw] attributes + # @return [::Google::Protobuf::Map{::String => ::Google::Cloud::Retail::V2::CustomAttribute}] + # Custom attributes for the suggestion term. + # + # * For `user-data`, the attributes are additional custom attributes + # ingested through BigQuery. + # + # * For `cloud-retail`, the attributes are product attributes generated + # by Cloud Retail. It requires + # {::Google::Cloud::Retail::V2::UserEvent#product_details UserEvent.product_details} + # is imported properly. + class CompletionResult + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # @!attribute [rw] key + # @return [::String] + # @!attribute [rw] value + # @return [::Google::Cloud::Retail::V2::CustomAttribute] + class AttributesEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # Deprecated: Recent search of this user. + # @deprecated This message is deprecated and may be removed in the next major version update. + # @!attribute [rw] recent_search + # @return [::String] + # The recent search query. + class RecentSearchResult + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Resource that represents attribute results. + # @!attribute [rw] suggestions + # @return [::Array<::String>] + # The list of suggestions for the attribute. + class AttributeResult + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # @!attribute [rw] key + # @return [::String] + # @!attribute [rw] value + # @return [::Google::Cloud::Retail::V2::CompleteQueryResponse::AttributeResult] + class AttributeResultsEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/control.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/control.rb new file mode 100644 index 000000000000..8a377de74e6d --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/control.rb @@ -0,0 +1,75 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Retail + module V2 + # Configures dynamic metadata that can be linked to a + # {::Google::Cloud::Retail::V2::ServingConfig ServingConfig} and affect search or + # recommendation results at serving time. + # @!attribute [rw] rule + # @return [::Google::Cloud::Retail::V2::Rule] + # A rule control - a condition-action pair. + # Enacts a set action when the condition is triggered. + # For example: Boost "gShoe" when query full matches "Running Shoes". + # @!attribute [rw] name + # @return [::String] + # Immutable. Fully qualified name + # `projects/*/locations/global/catalogs/*/controls/*` + # @!attribute [rw] display_name + # @return [::String] + # Required. The human readable control display name. Used in Retail UI. + # + # This field must be a UTF-8 encoded string with a length limit of 128 + # characters. Otherwise, an INVALID_ARGUMENT error is thrown. + # @!attribute [r] associated_serving_config_ids + # @return [::Array<::String>] + # Output only. List of {::Google::Cloud::Retail::V2::ServingConfig serving config} + # ids that are associated with this control in the same + # {::Google::Cloud::Retail::V2::Catalog Catalog}. + # + # Note the association is managed via the + # {::Google::Cloud::Retail::V2::ServingConfig ServingConfig}, this is an output + # only denormalized view. + # @!attribute [rw] solution_types + # @return [::Array<::Google::Cloud::Retail::V2::SolutionType>] + # Required. Immutable. The solution types that the control is used for. + # Currently we support setting only one type of solution at creation time. + # + # Only `SOLUTION_TYPE_SEARCH` value is supported at the moment. + # If no solution type is provided at creation time, will default to + # {::Google::Cloud::Retail::V2::SolutionType::SOLUTION_TYPE_SEARCH SOLUTION_TYPE_SEARCH}. + # @!attribute [rw] search_solution_use_case + # @return [::Array<::Google::Cloud::Retail::V2::SearchSolutionUseCase>] + # Specifies the use case for the control. + # Affects what condition fields can be set. + # Only settable by search controls. + # Will default to + # {::Google::Cloud::Retail::V2::SearchSolutionUseCase::SEARCH_SOLUTION_USE_CASE_SEARCH SEARCH_SOLUTION_USE_CASE_SEARCH} + # if not specified. Currently only allow one search_solution_use_case per + # control. + class Control + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/control_service.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/control_service.rb new file mode 100644 index 000000000000..317de6e4a175 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/control_service.rb @@ -0,0 +1,122 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Retail + module V2 + # Request for CreateControl method. + # @!attribute [rw] parent + # @return [::String] + # Required. Full resource name of parent catalog. Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` + # @!attribute [rw] control + # @return [::Google::Cloud::Retail::V2::Control] + # Required. The Control to create. + # @!attribute [rw] control_id + # @return [::String] + # Required. The ID to use for the Control, which will become the final + # component of the Control's resource name. + # + # This value should be 4-63 characters, and valid characters + # are /[a-z][0-9]-_/. + class CreateControlRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for UpdateControl method. + # @!attribute [rw] control + # @return [::Google::Cloud::Retail::V2::Control] + # Required. The Control to update. + # @!attribute [rw] update_mask + # @return [::Google::Protobuf::FieldMask] + # Indicates which fields in the provided + # {::Google::Cloud::Retail::V2::Control Control} to update. The following are NOT + # supported: + # + # * {::Google::Cloud::Retail::V2::Control#name Control.name} + # + # If not set or empty, all supported fields are updated. + class UpdateControlRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for DeleteControl method. + # @!attribute [rw] name + # @return [::String] + # Required. The resource name of the Control to delete. Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}` + class DeleteControlRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for GetControl method. + # @!attribute [rw] name + # @return [::String] + # Required. The resource name of the Control to get. Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}` + class GetControlRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for ListControls method. + # @!attribute [rw] parent + # @return [::String] + # Required. The catalog resource name. Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` + # @!attribute [rw] page_size + # @return [::Integer] + # Optional. Maximum number of results to return. If unspecified, defaults + # to 50. Max allowed value is 1000. + # @!attribute [rw] page_token + # @return [::String] + # Optional. A page token, received from a previous `ListControls` call. + # Provide this to retrieve the subsequent page. + # @!attribute [rw] filter + # @return [::String] + # Optional. A filter to apply on the list results. Supported features: + # + # * List all the products under the parent branch if + # {::Google::Cloud::Retail::V2::ListControlsRequest#filter filter} is unset. + # * List controls that are used in a single ServingConfig: + # 'serving_config = "boosted_home_page_cvr"' + class ListControlsRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Response for ListControls method. + # @!attribute [rw] controls + # @return [::Array<::Google::Cloud::Retail::V2::Control>] + # All the Controls for a given catalog. + # @!attribute [rw] next_page_token + # @return [::String] + # Pagination token, if not returned indicates the last page. + class ListControlsResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/conversational_search_service.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/conversational_search_service.rb new file mode 100644 index 000000000000..5d3753d8f9ec --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/conversational_search_service.rb @@ -0,0 +1,358 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Retail + module V2 + # Request message for + # {::Google::Cloud::Retail::V2::ConversationalSearchService::Client#conversational_search ConversationalSearchService.ConversationalSearch} + # method. + # @!attribute [rw] placement + # @return [::String] + # Required. The resource name of the search engine placement, such as + # `projects/*/locations/global/catalogs/default_catalog/placements/default_search` + # or + # `projects/*/locations/global/catalogs/default_catalog/servingConfigs/default_serving_config` + # This field is used to identify the serving config name and the set + # of models that will be used to make the search. + # @!attribute [rw] branch + # @return [::String] + # Required. The branch resource name, such as + # `projects/*/locations/global/catalogs/default_catalog/branches/0`. + # + # Use "default_branch" as the branch ID or leave this field empty, to search + # products under the default branch. + # @!attribute [rw] query + # @return [::String] + # Optional. Raw search query to be searched for. + # + # If this field is empty, the request is considered a category browsing + # request. + # @!attribute [rw] page_categories + # @return [::Array<::String>] + # Optional. The categories associated with a category page. Must be set for + # category navigation queries to achieve good search quality. The format + # should be the same as + # {::Google::Cloud::Retail::V2::UserEvent#page_categories UserEvent.page_categories}; + # + # To represent full path of category, use '>' sign to separate different + # hierarchies. If '>' is part of the category name, replace it with + # other character(s). + # + # Category pages include special pages such as sales or promotions. For + # instance, a special sale page may have the category hierarchy: + # "pageCategories" : ["Sales > 2017 Black Friday Deals"]. + # @!attribute [rw] conversation_id + # @return [::String] + # Optional. This field specifies the conversation id, which maintains the + # state of the conversation between client side and server side. Use the + # value from the previous + # {::Google::Cloud::Retail::V2::ConversationalSearchResponse#conversation_id ConversationalSearchResponse.conversation_id}. + # For the initial request, this should be empty. + # @!attribute [rw] search_params + # @return [::Google::Cloud::Retail::V2::ConversationalSearchRequest::SearchParams] + # Optional. Search parameters. + # @!attribute [rw] visitor_id + # @return [::String] + # Required. A unique identifier for tracking visitors. For example, this + # could be implemented with an HTTP cookie, which should be able to uniquely + # identify a visitor on a single device. This unique identifier should not + # change if the visitor logs in or out of the website. + # + # This should be the same identifier as + # {::Google::Cloud::Retail::V2::UserEvent#visitor_id UserEvent.visitor_id}. + # + # The field must be a UTF-8 encoded string with a length limit of 128 + # characters. Otherwise, an INVALID_ARGUMENT error is returned. + # @!attribute [rw] user_info + # @return [::Google::Cloud::Retail::V2::UserInfo] + # Optional. User information. + # @!attribute [rw] conversational_filtering_spec + # @return [::Google::Cloud::Retail::V2::ConversationalSearchRequest::ConversationalFilteringSpec] + # Optional. This field specifies all conversational filtering related + # parameters. + # @!attribute [rw] user_labels + # @return [::Google::Protobuf::Map{::String => ::String}] + # Optional. The user labels applied to a resource must meet the following + # requirements: + # + # * Each resource can have multiple labels, up to a maximum of 64. + # * Each label must be a key-value pair. + # * Keys have a minimum length of 1 character and a maximum length of 63 + # characters and cannot be empty. Values can be empty and have a maximum + # length of 63 characters. + # * Keys and values can contain only lowercase letters, numeric characters, + # underscores, and dashes. All characters must use UTF-8 encoding, and + # international characters are allowed. + # * The key portion of a label must be unique. However, you can use the same + # key with multiple resources. + # * Keys must start with a lowercase letter or international character. + # + # See [Google Cloud + # Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + # for more details. + # @!attribute [rw] safety_settings + # @return [::Array<::Google::Cloud::Retail::V2::SafetySetting>] + # Optional. The safety settings to be applied to the generated content. + class ConversationalSearchRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Search parameters. + # @!attribute [rw] filter + # @return [::String] + # Optional. The filter string to restrict search results. + # + # The syntax of the filter string is the same as + # {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}. + # @!attribute [rw] canonical_filter + # @return [::String] + # Optional. The canonical filter string to restrict search results. + # + # The syntax of the canonical filter string is the same as + # {::Google::Cloud::Retail::V2::SearchRequest#canonical_filter SearchRequest.canonical_filter}. + # @!attribute [rw] sort_by + # @return [::String] + # Optional. The sort string to specify the sorting of search results. + # + # The syntax of the sort string is the same as + # [SearchRequest.sort][]. + # @!attribute [rw] boost_spec + # @return [::Google::Cloud::Retail::V2::SearchRequest::BoostSpec] + # Optional. The boost spec to specify the boosting of search results. + # + # The syntax of the boost spec is the same as + # {::Google::Cloud::Retail::V2::SearchRequest#boost_spec SearchRequest.boost_spec}. + class SearchParams + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # This field specifies the current user answer during the conversational + # filtering search. This can be either user selected from suggested answers + # or user input plain text. + # @!attribute [rw] text_answer + # @return [::String] + # This field specifies the incremental input text from the user during + # the conversational search. + # + # Note: The following fields are mutually exclusive: `text_answer`, `selected_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [rw] selected_answer + # @return [::Google::Cloud::Retail::V2::ConversationalSearchRequest::UserAnswer::SelectedAnswer] + # Optional. This field specifies the selected answer during the + # conversational search. This should be a subset of + # [ConversationalSearchResponse.followup_question.suggested_answers][]. + # + # Note: The following fields are mutually exclusive: `selected_answer`, `text_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared. + class UserAnswer + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # This field specifies the selected answers during the conversational + # search. + # @!attribute [rw] product_attribute_value + # @return [::Google::Cloud::Retail::V2::ProductAttributeValue] + # Optional. This field specifies the selected answer which is a attribute + # key-value. + class SelectedAnswer + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # This field specifies all conversational filtering related parameters + # addition to conversational retail search. + # @!attribute [rw] enable_conversational_filtering + # @deprecated This field is deprecated and may be removed in the next major version update. + # @return [::Boolean] + # Optional. This field is deprecated. Please use + # {::Google::Cloud::Retail::V2::ConversationalSearchRequest::ConversationalFilteringSpec#conversational_filtering_mode ConversationalFilteringSpec.conversational_filtering_mode} + # instead. + # @!attribute [rw] user_answer + # @return [::Google::Cloud::Retail::V2::ConversationalSearchRequest::UserAnswer] + # Optional. This field specifies the current user answer during the + # conversational filtering search. It can be either user selected from + # suggested answers or user input plain text. + # @!attribute [rw] conversational_filtering_mode + # @return [::Google::Cloud::Retail::V2::ConversationalSearchRequest::ConversationalFilteringSpec::Mode] + # Optional. Mode to control Conversational Filtering. + # Defaults to + # {::Google::Cloud::Retail::V2::ConversationalSearchRequest::ConversationalFilteringSpec::Mode::DISABLED Mode.DISABLED} + # if it's unset. + class ConversationalFilteringSpec + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Enum to control Conversational Filtering mode. + # A single conversation session including multiple turns supports modes for + # Conversational Search OR Conversational Filtering without + # Conversational Search, but not both. + module Mode + # Default value. + MODE_UNSPECIFIED = 0 + + # Disables Conversational Filtering when using Conversational Search. + DISABLED = 1 + + # Enables Conversational Filtering when using Conversational Search. + ENABLED = 2 + + # Enables Conversational Filtering without Conversational Search. + CONVERSATIONAL_FILTER_ONLY = 3 + end + end + + # @!attribute [rw] key + # @return [::String] + # @!attribute [rw] value + # @return [::String] + class UserLabelsEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # Response message for + # {::Google::Cloud::Retail::V2::ConversationalSearchService::Client#conversational_search ConversationalSearchService.ConversationalSearch} + # method. + # @!attribute [rw] user_query_types + # @return [::Array<::String>] + # The types Retail classifies the search query as. + # + # Supported values are: + # + # - "ORDER_SUPPORT" + # - "SIMPLE_PRODUCT_SEARCH" + # - "INTENT_REFINEMENT" + # - "PRODUCT_DETAILS" + # - "PRODUCT_COMPARISON" + # - "DEALS_AND_COUPONS" + # - "STORE_RELEVANT" + # - "BLOCKLISTED" + # - "BEST_PRODUCT" + # - "RETAIL_SUPPORT" + # - "DISABLED" + # @!attribute [rw] conversational_text_response + # @return [::String] + # The conversational answer-based text response generated by the Server. + # @!attribute [rw] followup_question + # @return [::Google::Cloud::Retail::V2::ConversationalSearchResponse::FollowupQuestion] + # The conversational followup question generated for Intent refinement. + # @!attribute [rw] conversation_id + # @return [::String] + # Conversation UUID. This field will be stored in client side storage to + # maintain the conversation session with server and will be used for next + # search request's + # {::Google::Cloud::Retail::V2::ConversationalSearchRequest#conversation_id ConversationalSearchRequest.conversation_id} + # to restore conversation state in server. + # @!attribute [rw] refined_search + # @return [::Array<::Google::Cloud::Retail::V2::ConversationalSearchResponse::RefinedSearch>] + # The proposed refined search queries. They can be used to fetch the relevant + # search results. When using CONVERSATIONAL_FILTER_ONLY mode, the + # refined_query from search response will be populated here. + # @!attribute [rw] conversational_filtering_result + # @return [::Google::Cloud::Retail::V2::ConversationalSearchResponse::ConversationalFilteringResult] + # This field specifies all related information that is needed on client + # side for UI rendering of conversational filtering search. + # @!attribute [r] state + # @return [::Google::Cloud::Retail::V2::ConversationalSearchResponse::State] + # Output only. The state of the response generation. + class ConversationalSearchResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # The conversational followup question generated for Intent refinement. + # @!attribute [rw] followup_question + # @return [::String] + # The conversational followup question generated for Intent refinement. + # @!attribute [rw] suggested_answers + # @return [::Array<::Google::Cloud::Retail::V2::ConversationalSearchResponse::FollowupQuestion::SuggestedAnswer>] + # The answer options provided to client for the follow-up question. + class FollowupQuestion + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Suggested answers to the follow-up question. + # If it's numerical attribute, only ProductAttributeInterval will be set. + # If it's textual attribute, only productAttributeValue will be set. + # @!attribute [rw] product_attribute_value + # @return [::Google::Cloud::Retail::V2::ProductAttributeValue] + # Product attribute value, including an attribute key and an + # attribute value. Other types can be added here in the future. + class SuggestedAnswer + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # The proposed refined search for intent-refinement/bundled shopping + # conversation. When using CONVERSATIONAL_FILTER_ONLY mode, the + # refined_query from search response will be populated here. + # @!attribute [rw] query + # @return [::String] + # The query to be used for search. + class RefinedSearch + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # This field specifies all related information that is needed on client + # side for UI rendering of conversational filtering search. + # @!attribute [rw] followup_question + # @return [::Google::Cloud::Retail::V2::ConversationalSearchResponse::FollowupQuestion] + # The conversational filtering question. + # @!attribute [rw] additional_filter + # @return [::Google::Cloud::Retail::V2::ConversationalSearchResponse::ConversationalFilteringResult::AdditionalFilter] + # This is the incremental additional filters implied from the current + # user answer. User should add the suggested addition filters to the + # previous [ConversationalSearchRequest.search_params.filter][] and + # {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}, and + # use the merged filter in the follow up requests. + class ConversationalFilteringResult + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Additional filter that client side need to apply. + # @!attribute [rw] product_attribute_value + # @return [::Google::Cloud::Retail::V2::ProductAttributeValue] + # Product attribute value, including an attribute key and an + # attribute value. Other types can be added here in the future. + class AdditionalFilter + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # The state of the response generation. + module State + # Unknown. + STATE_UNSPECIFIED = 0 + + # Response generation is being streamed. + STREAMING = 1 + + # Response generation has succeeded. + SUCCEEDED = 2 + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/export_config.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/export_config.rb new file mode 100644 index 000000000000..913e07ef4121 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/export_config.rb @@ -0,0 +1,184 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Retail + module V2 + # The output configuration setting. + # @!attribute [rw] gcs_destination + # @return [::Google::Cloud::Retail::V2::OutputConfig::GcsDestination] + # The Google Cloud Storage location where the output is to be written to. + # + # Note: The following fields are mutually exclusive: `gcs_destination`, `bigquery_destination`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [rw] bigquery_destination + # @return [::Google::Cloud::Retail::V2::OutputConfig::BigQueryDestination] + # The BigQuery location where the output is to be written to. + # + # Note: The following fields are mutually exclusive: `bigquery_destination`, `gcs_destination`. If a field in that set is populated, all other fields in the set will automatically be cleared. + class OutputConfig + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # The Google Cloud Storage output destination configuration. + # @!attribute [rw] output_uri_prefix + # @return [::String] + # Required. The output uri prefix for saving output data to json files. + # Some mapping examples are as follows: + # output_uri_prefix sample output(assuming the object is foo.json) + # ======================== ============================================= + # gs://bucket/ gs://bucket/foo.json + # gs://bucket/folder/ gs://bucket/folder/foo.json + # gs://bucket/folder/item_ gs://bucket/folder/item_foo.json + class GcsDestination + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The BigQuery output destination configuration. + # @!attribute [rw] dataset_id + # @return [::String] + # Required. The ID of a BigQuery Dataset. + # @!attribute [rw] table_id_prefix + # @return [::String] + # Required. The prefix of exported BigQuery tables. + # @!attribute [rw] table_type + # @return [::String] + # Required. Describes the table type. The following values are supported: + # + # * `table`: A BigQuery native table. + # * `view`: A virtual table defined by a SQL query. + class BigQueryDestination + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # Configuration of destination for Export related errors. + # @!attribute [rw] gcs_prefix + # @return [::String] + # Google Cloud Storage path for import errors. This must be an empty, + # existing Cloud Storage bucket. Export errors will be written to a file in + # this bucket, one per line, as a JSON-encoded + # `google.rpc.Status` message. + class ExportErrorsConfig + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for the `ExportAnalyticsMetrics` method. + # @!attribute [rw] catalog + # @return [::String] + # Required. Full resource name of the parent catalog. + # Expected format: `projects/*/locations/*/catalogs/*` + # @!attribute [rw] output_config + # @return [::Google::Cloud::Retail::V2::OutputConfig] + # Required. The output location of the data. + # @!attribute [rw] filter + # @return [::String] + # A filtering expression to specify restrictions on returned metrics. + # The expression is a sequence of terms. Each term applies a restriction to + # the returned metrics. Use this expression to restrict results to a + # specific time range. + # + # Currently we expect only one types of fields: + # + # * `timestamp`: This can be specified twice, once with a + # less than operator and once with a greater than operator. The + # `timestamp` restriction should result in one, contiguous, valid, + # `timestamp` range. + # + # Some examples of valid filters expressions: + # + # * Example 1: `timestamp > "2012-04-23T18:25:43.511Z" + # timestamp < "2012-04-23T18:30:43.511Z"` + # * Example 2: `timestamp > "2012-04-23T18:25:43.511Z"` + class ExportAnalyticsMetricsRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Metadata related to the progress of the Export operation. This is + # returned by the google.longrunning.Operation.metadata field. + # @!attribute [rw] create_time + # @return [::Google::Protobuf::Timestamp] + # Operation create time. + # @!attribute [rw] update_time + # @return [::Google::Protobuf::Timestamp] + # Operation last update time. If the operation is done, this is also the + # finish time. + class ExportMetadata + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Response of the ExportAnalyticsMetricsRequest. If the long running + # operation was successful, then this message is returned by the + # google.longrunning.Operations.response field if the operation was successful. + # @!attribute [rw] error_samples + # @return [::Array<::Google::Rpc::Status>] + # A sample of errors encountered while processing the request. + # @!attribute [rw] errors_config + # @return [::Google::Cloud::Retail::V2::ExportErrorsConfig] + # This field is never set. + # @!attribute [rw] output_result + # @return [::Google::Cloud::Retail::V2::OutputResult] + # Output result indicating where the data were exported to. + class ExportAnalyticsMetricsResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Output result that stores the information about where the exported data is + # stored. + # @!attribute [rw] bigquery_result + # @return [::Array<::Google::Cloud::Retail::V2::BigQueryOutputResult>] + # The BigQuery location where the result is stored. + # @!attribute [rw] gcs_result + # @return [::Array<::Google::Cloud::Retail::V2::GcsOutputResult>] + # The Google Cloud Storage location where the result is stored. + class OutputResult + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # A BigQuery output result. + # @!attribute [rw] dataset_id + # @return [::String] + # The ID of a BigQuery Dataset. + # @!attribute [rw] table_id + # @return [::String] + # The ID of a BigQuery Table. + class BigQueryOutputResult + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # A Gcs output result. + # @!attribute [rw] output_uri + # @return [::String] + # The uri of Gcs output + class GcsOutputResult + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/generative_question.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/generative_question.rb new file mode 100644 index 000000000000..7a58a54f8f3c --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/generative_question.rb @@ -0,0 +1,75 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Retail + module V2 + # Configuration for overall generative question feature state. + # @!attribute [rw] catalog + # @return [::String] + # Required. Resource name of the affected catalog. + # Format: projects/\\{project}/locations/\\{location}/catalogs/\\{catalog} + # @!attribute [rw] feature_enabled + # @return [::Boolean] + # Optional. Determines whether questions will be used at serving time. + # Note: This feature cannot be enabled until initial data requirements are + # satisfied. + # @!attribute [rw] minimum_products + # @return [::Integer] + # Optional. Minimum number of products in the response to trigger follow-up + # questions. Value must be 0 or positive. + class GenerativeQuestionsFeatureConfig + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Configuration for a single generated question. + # @!attribute [rw] catalog + # @return [::String] + # Required. Resource name of the catalog. + # Format: projects/\\{project}/locations/\\{location}/catalogs/\\{catalog} + # @!attribute [rw] facet + # @return [::String] + # Required. The facet to which the question is associated. + # @!attribute [r] generated_question + # @return [::String] + # Output only. The LLM generated question. + # @!attribute [rw] final_question + # @return [::String] + # Optional. The question that will be used at serving time. + # Question can have a max length of 300 bytes. + # When not populated, generated_question should be used. + # @!attribute [r] example_values + # @return [::Array<::String>] + # Output only. Values that can be used to answer the question. + # @!attribute [r] frequency + # @return [::Float] + # Output only. The ratio of how often a question was asked. + # @!attribute [rw] allowed_in_conversation + # @return [::Boolean] + # Optional. Whether the question is asked at serving time. + class GenerativeQuestionConfig + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/generative_question_service.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/generative_question_service.rb new file mode 100644 index 000000000000..dcd3144bc211 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/generative_question_service.rb @@ -0,0 +1,109 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Retail + module V2 + # Request for UpdateGenerativeQuestionsFeatureConfig method. + # @!attribute [rw] generative_questions_feature_config + # @return [::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig] + # Required. The configuration managing the feature state. + # @!attribute [rw] update_mask + # @return [::Google::Protobuf::FieldMask] + # Optional. Indicates which fields in the provided + # {::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig GenerativeQuestionsFeatureConfig} + # to update. If not set or empty, all supported fields are updated. + class UpdateGenerativeQuestionsFeatureConfigRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for GetGenerativeQuestionsFeatureConfig method. + # @!attribute [rw] catalog + # @return [::String] + # Required. Resource name of the parent catalog. + # Format: projects/\\{project}/locations/\\{location}/catalogs/\\{catalog} + class GetGenerativeQuestionsFeatureConfigRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for ListQuestions method. + # @!attribute [rw] parent + # @return [::String] + # Required. Resource name of the parent catalog. + # Format: projects/\\{project}/locations/\\{location}/catalogs/\\{catalog} + class ListGenerativeQuestionConfigsRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Response for ListQuestions method. + # @!attribute [rw] generative_question_configs + # @return [::Array<::Google::Cloud::Retail::V2::GenerativeQuestionConfig>] + # All the questions for a given catalog. + class ListGenerativeQuestionConfigsResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for UpdateGenerativeQuestionConfig method. + # @!attribute [rw] generative_question_config + # @return [::Google::Cloud::Retail::V2::GenerativeQuestionConfig] + # Required. The question to update. + # @!attribute [rw] update_mask + # @return [::Google::Protobuf::FieldMask] + # Optional. Indicates which fields in the provided + # {::Google::Cloud::Retail::V2::GenerativeQuestionConfig GenerativeQuestionConfig} + # to update. The following are NOT supported: + # + # * {::Google::Cloud::Retail::V2::GenerativeQuestionConfig#frequency GenerativeQuestionConfig.frequency} + # + # If not set or empty, all supported fields are updated. + class UpdateGenerativeQuestionConfigRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for BatchUpdateGenerativeQuestionConfig method. + # @!attribute [rw] parent + # @return [::String] + # Optional. Resource name of the parent catalog. + # Format: projects/\\{project}/locations/\\{location}/catalogs/\\{catalog} + # @!attribute [rw] requests + # @return [::Array<::Google::Cloud::Retail::V2::UpdateGenerativeQuestionConfigRequest>] + # Required. The updates question configs. + class BatchUpdateGenerativeQuestionConfigsRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Aggregated response for UpdateGenerativeQuestionConfig method. + # @!attribute [rw] generative_question_configs + # @return [::Array<::Google::Cloud::Retail::V2::GenerativeQuestionConfig>] + # Optional. The updates question configs. + class BatchUpdateGenerativeQuestionConfigsResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/import_config.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/import_config.rb new file mode 100644 index 000000000000..e95a50d7e11c --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/import_config.rb @@ -0,0 +1,404 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Retail + module V2 + # Google Cloud Storage location for input content. + # @!attribute [rw] input_uris + # @return [::Array<::String>] + # Required. Google Cloud Storage URIs to input files. URI can be up to + # 2000 characters long. URIs can match the full object path (for example, + # `gs://bucket/directory/object.json`) or a pattern matching one or more + # files, such as `gs://bucket/directory/*.json`. A request can + # contain at most 100 files, and each file can be up to 2 GB. See + # [Importing product + # information](https://cloud.google.com/retail/recommendations-ai/docs/upload-catalog) + # for the expected file format and setup instructions. + # @!attribute [rw] data_schema + # @return [::String] + # The schema to use when parsing the data from the source. + # + # Supported values for product imports: + # + # * `product` (default): One JSON {::Google::Cloud::Retail::V2::Product Product} + # per line. Each product must + # have a valid {::Google::Cloud::Retail::V2::Product#id Product.id}. + # * `product_merchant_center`: See [Importing catalog data from Merchant + # Center](https://cloud.google.com/retail/recommendations-ai/docs/upload-catalog#mc). + # + # Supported values for user events imports: + # + # * `user_event` (default): One JSON + # {::Google::Cloud::Retail::V2::UserEvent UserEvent} per line. + # * `user_event_ga360`: Using + # https://support.google.com/analytics/answer/3437719. + # + # Supported values for control imports: + # + # * `control` (default): One JSON {::Google::Cloud::Retail::V2::Control Control} + # per line. + # + # Supported values for catalog attribute imports: + # + # * `catalog_attribute` (default): One CSV + # {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} per line. + class GcsSource + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # BigQuery source import data from. + # @!attribute [rw] partition_date + # @return [::Google::Type::Date] + # BigQuery time partitioned table's _PARTITIONDATE in YYYY-MM-DD format. + # @!attribute [rw] project_id + # @return [::String] + # The project ID (can be project # or ID) that the BigQuery source is in with + # a length limit of 128 characters. If not specified, inherits the project + # ID from the parent request. + # @!attribute [rw] dataset_id + # @return [::String] + # Required. The BigQuery data set to copy the data from with a length limit + # of 1,024 characters. + # @!attribute [rw] table_id + # @return [::String] + # Required. The BigQuery table to copy the data from with a length limit of + # 1,024 characters. + # @!attribute [rw] gcs_staging_dir + # @return [::String] + # Intermediate Cloud Storage directory used for the import with a length + # limit of 2,000 characters. Can be specified if one wants to have the + # BigQuery export to a specific Cloud Storage directory. + # @!attribute [rw] data_schema + # @return [::String] + # The schema to use when parsing the data from the source. + # + # Supported values for product imports: + # + # * `product` (default): One JSON {::Google::Cloud::Retail::V2::Product Product} + # per line. Each product must + # have a valid {::Google::Cloud::Retail::V2::Product#id Product.id}. + # * `product_merchant_center`: See [Importing catalog data from Merchant + # Center](https://cloud.google.com/retail/recommendations-ai/docs/upload-catalog#mc). + # + # Supported values for user events imports: + # + # * `user_event` (default): One JSON + # {::Google::Cloud::Retail::V2::UserEvent UserEvent} per line. + # * `user_event_ga360`: + # The schema is available here: + # https://support.google.com/analytics/answer/3437719. + # * `user_event_ga4`: + # The schema is available here: + # https://support.google.com/analytics/answer/7029846. + # + # Supported values for autocomplete imports: + # + # * `suggestions` (default): One JSON completion suggestion per line. + # * `denylist`: One JSON deny suggestion per line. + # * `allowlist`: One JSON allow suggestion per line. + class BigQuerySource + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The inline source for the input config for ImportProducts method. + # @!attribute [rw] products + # @return [::Array<::Google::Cloud::Retail::V2::Product>] + # Required. A list of products to update/create. Each product must have a + # valid {::Google::Cloud::Retail::V2::Product#id Product.id}. Recommended max of + # 100 items. + class ProductInlineSource + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The inline source for the input config for ImportUserEvents method. + # @!attribute [rw] user_events + # @return [::Array<::Google::Cloud::Retail::V2::UserEvent>] + # Required. A list of user events to import. Recommended max of 10k items. + class UserEventInlineSource + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Configuration of destination for Import related errors. + # @!attribute [rw] gcs_prefix + # @return [::String] + # Google Cloud Storage prefix for import errors. This must be an empty, + # existing Cloud Storage directory. Import errors are written to + # sharded files in this directory, one per line, as a JSON-encoded + # `google.rpc.Status` message. + class ImportErrorsConfig + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for Import methods. + # @!attribute [rw] parent + # @return [::String] + # Required. + # `projects/1234/locations/global/catalogs/default_catalog/branches/default_branch` + # + # If no updateMask is specified, requires products.create permission. + # If updateMask is specified, requires products.update permission. + # @!attribute [rw] request_id + # @deprecated This field is deprecated and may be removed in the next major version update. + # @return [::String] + # Deprecated. This field has no effect. + # @!attribute [rw] input_config + # @return [::Google::Cloud::Retail::V2::ProductInputConfig] + # Required. The desired input location of the data. + # @!attribute [rw] errors_config + # @return [::Google::Cloud::Retail::V2::ImportErrorsConfig] + # The desired location of errors incurred during the Import. + # @!attribute [rw] update_mask + # @return [::Google::Protobuf::FieldMask] + # Indicates which fields in the provided imported `products` to update. If + # not set, all fields are updated. If provided, only the existing product + # fields are updated. Missing products will not be created. + # @!attribute [rw] reconciliation_mode + # @return [::Google::Cloud::Retail::V2::ImportProductsRequest::ReconciliationMode] + # The mode of reconciliation between existing products and the products to be + # imported. Defaults to + # {::Google::Cloud::Retail::V2::ImportProductsRequest::ReconciliationMode::INCREMENTAL ReconciliationMode.INCREMENTAL}. + # @!attribute [rw] notification_pubsub_topic + # @return [::String] + # Full Pub/Sub topic name for receiving notification. If this field is set, + # when the import is finished, a notification is sent to + # specified Pub/Sub topic. The message data is JSON string of a + # {::Google::Longrunning::Operation Operation}. + # + # Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. It has + # to be within the same project as + # {::Google::Cloud::Retail::V2::ImportProductsRequest#parent ImportProductsRequest.parent}. + # Make sure that both + # `cloud-retail-customer-data-access@system.gserviceaccount.com` and + # `service-@gcp-sa-retail.iam.gserviceaccount.com` + # have the `pubsub.topics.publish` IAM permission on the topic. + # + # Only supported when + # {::Google::Cloud::Retail::V2::ImportProductsRequest#reconciliation_mode ImportProductsRequest.reconciliation_mode} + # is set to `FULL`. + class ImportProductsRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Indicates how imported products are reconciled with the existing products + # created or imported before. + module ReconciliationMode + # Defaults to INCREMENTAL. + RECONCILIATION_MODE_UNSPECIFIED = 0 + + # Inserts new products or updates existing products. + INCREMENTAL = 1 + + # Calculates diff and replaces the entire product dataset. Existing + # products may be deleted if they are not present in the source location. + FULL = 2 + end + end + + # Request message for the ImportUserEvents request. + # @!attribute [rw] parent + # @return [::String] + # Required. `projects/1234/locations/global/catalogs/default_catalog` + # @!attribute [rw] input_config + # @return [::Google::Cloud::Retail::V2::UserEventInputConfig] + # Required. The desired input location of the data. + # @!attribute [rw] errors_config + # @return [::Google::Cloud::Retail::V2::ImportErrorsConfig] + # The desired location of errors incurred during the Import. Cannot be set + # for inline user event imports. + class ImportUserEventsRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for ImportCompletionData methods. + # @!attribute [rw] parent + # @return [::String] + # Required. The catalog which the suggestions dataset belongs to. + # + # Format: `projects/1234/locations/global/catalogs/default_catalog`. + # @!attribute [rw] input_config + # @return [::Google::Cloud::Retail::V2::CompletionDataInputConfig] + # Required. The desired input location of the data. + # @!attribute [rw] notification_pubsub_topic + # @return [::String] + # Pub/Sub topic for receiving notification. If this field is set, + # when the import is finished, a notification is sent to + # specified Pub/Sub topic. The message data is JSON string of a + # {::Google::Longrunning::Operation Operation}. + # Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. + class ImportCompletionDataRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The input config source for products. + # @!attribute [rw] product_inline_source + # @return [::Google::Cloud::Retail::V2::ProductInlineSource] + # The Inline source for the input content for products. + # + # Note: The following fields are mutually exclusive: `product_inline_source`, `gcs_source`, `big_query_source`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [rw] gcs_source + # @return [::Google::Cloud::Retail::V2::GcsSource] + # Google Cloud Storage location for the input content. + # + # Note: The following fields are mutually exclusive: `gcs_source`, `product_inline_source`, `big_query_source`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [rw] big_query_source + # @return [::Google::Cloud::Retail::V2::BigQuerySource] + # BigQuery input source. + # + # Note: The following fields are mutually exclusive: `big_query_source`, `product_inline_source`, `gcs_source`. If a field in that set is populated, all other fields in the set will automatically be cleared. + class ProductInputConfig + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The input config source for user events. + # @!attribute [rw] user_event_inline_source + # @return [::Google::Cloud::Retail::V2::UserEventInlineSource] + # Required. The Inline source for the input content for UserEvents. + # + # Note: The following fields are mutually exclusive: `user_event_inline_source`, `gcs_source`, `big_query_source`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [rw] gcs_source + # @return [::Google::Cloud::Retail::V2::GcsSource] + # Required. Google Cloud Storage location for the input content. + # + # Note: The following fields are mutually exclusive: `gcs_source`, `user_event_inline_source`, `big_query_source`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [rw] big_query_source + # @return [::Google::Cloud::Retail::V2::BigQuerySource] + # Required. BigQuery input source. + # + # Note: The following fields are mutually exclusive: `big_query_source`, `user_event_inline_source`, `gcs_source`. If a field in that set is populated, all other fields in the set will automatically be cleared. + class UserEventInputConfig + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The input config source for completion data. + # @!attribute [rw] big_query_source + # @return [::Google::Cloud::Retail::V2::BigQuerySource] + # Required. BigQuery input source. + # + # Add the IAM permission "BigQuery Data Viewer" for + # cloud-retail-customer-data-access@system.gserviceaccount.com before + # using this feature otherwise an error is thrown. + class CompletionDataInputConfig + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Metadata related to the progress of the Import operation. This is + # returned by the google.longrunning.Operation.metadata field. + # @!attribute [rw] create_time + # @return [::Google::Protobuf::Timestamp] + # Operation create time. + # @!attribute [rw] update_time + # @return [::Google::Protobuf::Timestamp] + # Operation last update time. If the operation is done, this is also the + # finish time. + # @!attribute [rw] success_count + # @return [::Integer] + # Count of entries that were processed successfully. + # @!attribute [rw] failure_count + # @return [::Integer] + # Count of entries that encountered errors while processing. + # @!attribute [rw] request_id + # @deprecated This field is deprecated and may be removed in the next major version update. + # @return [::String] + # Deprecated. This field is never set. + # @!attribute [rw] notification_pubsub_topic + # @return [::String] + # Pub/Sub topic for receiving notification. If this field is set, + # when the import is finished, a notification is sent to + # specified Pub/Sub topic. The message data is JSON string of a + # {::Google::Longrunning::Operation Operation}. + # Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. + class ImportMetadata + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Response of the + # {::Google::Cloud::Retail::V2::ImportProductsRequest ImportProductsRequest}. If the + # long running operation is done, then this message is returned by the + # google.longrunning.Operations.response field if the operation was successful. + # @!attribute [rw] error_samples + # @return [::Array<::Google::Rpc::Status>] + # A sample of errors encountered while processing the request. + # @!attribute [rw] errors_config + # @return [::Google::Cloud::Retail::V2::ImportErrorsConfig] + # Echoes the destination for the complete errors in the request if set. + class ImportProductsResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Response of the ImportUserEventsRequest. If the long running + # operation was successful, then this message is returned by the + # google.longrunning.Operations.response field if the operation was successful. + # @!attribute [rw] error_samples + # @return [::Array<::Google::Rpc::Status>] + # A sample of errors encountered while processing the request. + # @!attribute [rw] errors_config + # @return [::Google::Cloud::Retail::V2::ImportErrorsConfig] + # Echoes the destination for the complete errors if this field was set in + # the request. + # @!attribute [rw] import_summary + # @return [::Google::Cloud::Retail::V2::UserEventImportSummary] + # Aggregated statistics of user event import status. + class ImportUserEventsResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # A summary of import result. The UserEventImportSummary summarizes + # the import status for user events. + # @!attribute [rw] joined_events_count + # @return [::Integer] + # Count of user events imported with complete existing catalog information. + # @!attribute [rw] unjoined_events_count + # @return [::Integer] + # Count of user events imported, but with catalog information not found + # in the imported catalog. + class UserEventImportSummary + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Response of the + # {::Google::Cloud::Retail::V2::ImportCompletionDataRequest ImportCompletionDataRequest}. + # If the long running operation is done, this message is returned by the + # google.longrunning.Operations.response field if the operation is successful. + # @!attribute [rw] error_samples + # @return [::Array<::Google::Rpc::Status>] + # A sample of errors encountered while processing the request. + class ImportCompletionDataResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/model.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/model.rb new file mode 100644 index 000000000000..76ac3160ed3b --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/model.rb @@ -0,0 +1,267 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Retail + module V2 + # Metadata that describes the training and serving parameters of a + # {::Google::Cloud::Retail::V2::Model Model}. A + # {::Google::Cloud::Retail::V2::Model Model} can be associated with a + # {::Google::Cloud::Retail::V2::ServingConfig ServingConfig} and then queried + # through the Predict API. + # @!attribute [rw] name + # @return [::String] + # Required. The fully qualified resource name of the model. + # + # Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` + # catalog_id has char limit of 50. + # recommendation_model_id has char limit of 40. + # @!attribute [rw] display_name + # @return [::String] + # Required. The display name of the model. + # + # Should be human readable, used to display Recommendation Models in the + # Retail Cloud Console Dashboard. UTF-8 encoded string with limit of 1024 + # characters. + # @!attribute [rw] training_state + # @return [::Google::Cloud::Retail::V2::Model::TrainingState] + # Optional. The training state that the model is in (e.g. + # `TRAINING` or `PAUSED`). + # + # Since part of the cost of running the service + # is frequency of training - this can be used to determine when to train + # model in order to control cost. If not specified: the default value for + # `CreateModel` method is `TRAINING`. The default value for + # `UpdateModel` method is to keep the state the same as before. + # @!attribute [r] serving_state + # @return [::Google::Cloud::Retail::V2::Model::ServingState] + # Output only. The serving state of the model: `ACTIVE`, `NOT_ACTIVE`. + # @!attribute [r] create_time + # @return [::Google::Protobuf::Timestamp] + # Output only. Timestamp the Recommendation Model was created at. + # @!attribute [r] update_time + # @return [::Google::Protobuf::Timestamp] + # Output only. Timestamp the Recommendation Model was last updated. E.g. + # if a Recommendation Model was paused - this would be the time the pause was + # initiated. + # @!attribute [rw] type + # @return [::String] + # Required. The type of model e.g. `home-page`. + # + # Currently supported values: `recommended-for-you`, `others-you-may-like`, + # `frequently-bought-together`, `page-optimization`, `similar-items`, + # `buy-it-again`, `on-sale-items`, and `recently-viewed`(readonly value). + # + # This field together with + # {::Google::Cloud::Retail::V2::Model#optimization_objective optimization_objective} + # describe model metadata to use to control model training and serving. + # See https://cloud.google.com/retail/docs/models + # for more details on what the model metadata control and which combination + # of parameters are valid. For invalid combinations of parameters (e.g. type + # = `frequently-bought-together` and optimization_objective = `ctr`), you + # receive an error 400 if you try to create/update a recommendation with + # this set of knobs. + # @!attribute [rw] optimization_objective + # @return [::String] + # Optional. The optimization objective e.g. `cvr`. + # + # Currently supported + # values: `ctr`, `cvr`, `revenue-per-order`. + # + # If not specified, we choose default based on model type. + # Default depends on type of recommendation: + # + # `recommended-for-you` => `ctr` + # + # `others-you-may-like` => `ctr` + # + # `frequently-bought-together` => `revenue_per_order` + # + # This field together with + # {::Google::Cloud::Retail::V2::Model#type optimization_objective} + # describe model metadata to use to control model training and serving. + # See https://cloud.google.com/retail/docs/models + # for more details on what the model metadata control and which combination + # of parameters are valid. For invalid combinations of parameters (e.g. type + # = `frequently-bought-together` and optimization_objective = `ctr`), you + # receive an error 400 if you try to create/update a recommendation with + # this set of knobs. + # @!attribute [rw] periodic_tuning_state + # @return [::Google::Cloud::Retail::V2::Model::PeriodicTuningState] + # Optional. The state of periodic tuning. + # + # The period we use is 3 months - to do a + # one-off tune earlier use the `TuneModel` method. Default value + # is `PERIODIC_TUNING_ENABLED`. + # @!attribute [r] last_tune_time + # @return [::Google::Protobuf::Timestamp] + # Output only. The timestamp when the latest successful tune finished. + # @!attribute [r] tuning_operation + # @return [::String] + # Output only. The tune operation associated with the model. + # + # Can be used to determine if there is an ongoing tune for this + # recommendation. Empty field implies no tune is goig on. + # @!attribute [r] data_state + # @return [::Google::Cloud::Retail::V2::Model::DataState] + # Output only. The state of data requirements for this model: `DATA_OK` and + # `DATA_ERROR`. + # + # Recommendation model cannot be trained if the data is in + # `DATA_ERROR` state. Recommendation model can have `DATA_ERROR` state even + # if serving state is `ACTIVE`: models were trained successfully before, but + # cannot be refreshed because model no longer has sufficient + # data for training. + # @!attribute [rw] filtering_option + # @return [::Google::Cloud::Retail::V2::RecommendationsFilteringOption] + # Optional. If `RECOMMENDATIONS_FILTERING_ENABLED`, recommendation filtering + # by attributes is enabled for the model. + # @!attribute [r] serving_config_lists + # @return [::Array<::Google::Cloud::Retail::V2::Model::ServingConfigList>] + # Output only. The list of valid serving configs associated with the + # PageOptimizationConfig. + # @!attribute [rw] model_features_config + # @return [::Google::Cloud::Retail::V2::Model::ModelFeaturesConfig] + # Optional. Additional model features config. + class Model + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Represents an ordered combination of valid serving configs, which + # can be used for `PAGE_OPTIMIZATION` recommendations. + # @!attribute [rw] serving_config_ids + # @return [::Array<::String>] + # Optional. A set of valid serving configs that may be used for + # `PAGE_OPTIMIZATION`. + class ServingConfigList + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Additional configs for the frequently-bought-together model type. + # @!attribute [rw] context_products_type + # @return [::Google::Cloud::Retail::V2::Model::ContextProductsType] + # Optional. Specifies the context of the model when it is used in predict + # requests. Can only be set for the `frequently-bought-together` type. If + # it isn't specified, it defaults to + # {::Google::Cloud::Retail::V2::Model::ContextProductsType::MULTIPLE_CONTEXT_PRODUCTS MULTIPLE_CONTEXT_PRODUCTS}. + class FrequentlyBoughtTogetherFeaturesConfig + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Additional model features config. + # @!attribute [rw] frequently_bought_together_config + # @return [::Google::Cloud::Retail::V2::Model::FrequentlyBoughtTogetherFeaturesConfig] + # Additional configs for frequently-bought-together models. + class ModelFeaturesConfig + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The serving state of the model. + module ServingState + # Unspecified serving state. + SERVING_STATE_UNSPECIFIED = 0 + + # The model is not serving. + INACTIVE = 1 + + # The model is serving and can be queried. + ACTIVE = 2 + + # The model is trained on tuned hyperparameters and can be + # queried. + TUNED = 3 + end + + # The training state of the model. + module TrainingState + # Unspecified training state. + TRAINING_STATE_UNSPECIFIED = 0 + + # The model training is paused. + PAUSED = 1 + + # The model is training. + TRAINING = 2 + end + + # Describes whether periodic tuning is enabled for this model + # or not. Periodic tuning is scheduled at most every three months. You can + # start a tuning process manually by using the `TuneModel` + # method, which starts a tuning process immediately and resets the quarterly + # schedule. Enabling or disabling periodic tuning does not affect any + # current tuning processes. + module PeriodicTuningState + # Unspecified default value, should never be explicitly set. + PERIODIC_TUNING_STATE_UNSPECIFIED = 0 + + # The model has periodic tuning disabled. Tuning + # can be reenabled by calling the `EnableModelPeriodicTuning` + # method or by calling the `TuneModel` method. + PERIODIC_TUNING_DISABLED = 1 + + # The model cannot be tuned with periodic tuning OR the + # `TuneModel` method. Hide the options in customer UI and + # reject any requests through the backend self serve API. + ALL_TUNING_DISABLED = 3 + + # The model has periodic tuning enabled. Tuning + # can be disabled by calling the `DisableModelPeriodicTuning` + # method. + PERIODIC_TUNING_ENABLED = 2 + end + + # Describes whether this model have sufficient training data + # to be continuously trained. + module DataState + # Unspecified default value, should never be explicitly set. + DATA_STATE_UNSPECIFIED = 0 + + # The model has sufficient training data. + DATA_OK = 1 + + # The model does not have sufficient training data. Error + # messages can be queried via Stackdriver. + DATA_ERROR = 2 + end + + # Use single or multiple context products for recommendations. + module ContextProductsType + # Unspecified default value, should never be explicitly set. + # Defaults to + # {::Google::Cloud::Retail::V2::Model::ContextProductsType::MULTIPLE_CONTEXT_PRODUCTS MULTIPLE_CONTEXT_PRODUCTS}. + CONTEXT_PRODUCTS_TYPE_UNSPECIFIED = 0 + + # Use only a single product as context for the recommendation. Typically + # used on pages like add-to-cart or product details. + SINGLE_CONTEXT_PRODUCT = 1 + + # Use one or multiple products as context for the recommendation. Typically + # used on shopping cart pages. + MULTIPLE_CONTEXT_PRODUCTS = 2 + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/model_service.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/model_service.rb new file mode 100644 index 000000000000..0fe12a4770c2 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/model_service.rb @@ -0,0 +1,172 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Retail + module V2 + # Request for creating a model. + # @!attribute [rw] parent + # @return [::String] + # Required. The parent resource under which to create the model. Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` + # @!attribute [rw] model + # @return [::Google::Cloud::Retail::V2::Model] + # Required. The payload of the {::Google::Cloud::Retail::V2::Model Model} to + # create. + # @!attribute [rw] dry_run + # @return [::Boolean] + # Optional. Whether to run a dry run to validate the request (without + # actually creating the model). + class CreateModelRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for updating an existing model. + # @!attribute [rw] model + # @return [::Google::Cloud::Retail::V2::Model] + # Required. The body of the updated {::Google::Cloud::Retail::V2::Model Model}. + # @!attribute [rw] update_mask + # @return [::Google::Protobuf::FieldMask] + # Optional. Indicates which fields in the provided 'model' to + # update. If not set, by default updates all fields. + class UpdateModelRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for getting a model. + # @!attribute [rw] name + # @return [::String] + # Required. The resource name of the {::Google::Cloud::Retail::V2::Model Model} to + # get. Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog}/models/{model_id}` + class GetModelRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for pausing training of a model. + # @!attribute [rw] name + # @return [::String] + # Required. The name of the model to pause. + # Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` + class PauseModelRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for resuming training of a model. + # @!attribute [rw] name + # @return [::String] + # Required. The name of the model to resume. + # Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` + class ResumeModelRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for listing models associated with a resource. + # @!attribute [rw] parent + # @return [::String] + # Required. The parent for which to list models. + # Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` + # @!attribute [rw] page_size + # @return [::Integer] + # Optional. Maximum number of results to return. If unspecified, defaults + # to 50. Max allowed value is 1000. + # @!attribute [rw] page_token + # @return [::String] + # Optional. A page token, received from a previous `ListModels` + # call. Provide this to retrieve the subsequent page. + class ListModelsRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for deleting a model. + # @!attribute [rw] name + # @return [::String] + # Required. The resource name of the {::Google::Cloud::Retail::V2::Model Model} to + # delete. Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` + class DeleteModelRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Response to a ListModelRequest. + # @!attribute [rw] models + # @return [::Array<::Google::Cloud::Retail::V2::Model>] + # List of Models. + # @!attribute [rw] next_page_token + # @return [::String] + # Pagination token, if not returned indicates the last page. + class ListModelsResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request to manually start a tuning process now (instead of waiting for + # the periodically scheduled tuning to happen). + # @!attribute [rw] name + # @return [::String] + # Required. The resource name of the model to tune. + # Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` + class TuneModelRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Metadata associated with a create operation. + # @!attribute [rw] model + # @return [::String] + # The resource name of the model that this create applies to. + # Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` + class CreateModelMetadata + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Metadata associated with a tune operation. + # @!attribute [rw] model + # @return [::String] + # The resource name of the model that this tune applies to. + # Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` + class TuneModelMetadata + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Response associated with a tune operation. + class TuneModelResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/prediction_service.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/prediction_service.rb new file mode 100644 index 000000000000..53e46e58df05 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/prediction_service.rb @@ -0,0 +1,237 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Retail + module V2 + # Request message for Predict method. + # @!attribute [rw] placement + # @return [::String] + # Required. Full resource name of the format: + # `{placement=projects/*/locations/global/catalogs/default_catalog/servingConfigs/*}` + # or + # `{placement=projects/*/locations/global/catalogs/default_catalog/placements/*}`. + # We recommend using the `servingConfigs` resource. `placements` is a legacy + # resource. + # The ID of the Recommendations AI serving config or placement. + # Before you can request predictions from your model, you must create at + # least one serving config or placement for it. For more information, see + # [Manage serving configs] + # (https://cloud.google.com/retail/docs/manage-configs). + # + # The full list of available serving configs can be seen at + # https://console.cloud.google.com/ai/retail/catalogs/default_catalog/configs + # @!attribute [rw] user_event + # @return [::Google::Cloud::Retail::V2::UserEvent] + # Required. Context about the user, what they are looking at and what action + # they took to trigger the predict request. Note that this user event detail + # won't be ingested to userEvent logs. Thus, a separate userEvent write + # request is required for event logging. + # + # Don't set + # {::Google::Cloud::Retail::V2::UserEvent#visitor_id UserEvent.visitor_id} or + # {::Google::Cloud::Retail::V2::UserInfo#user_id UserInfo.user_id} to the same + # fixed ID for different users. If you are trying to receive non-personalized + # recommendations (not recommended; this can negatively impact model + # performance), instead set + # {::Google::Cloud::Retail::V2::UserEvent#visitor_id UserEvent.visitor_id} to a + # random unique ID and leave + # {::Google::Cloud::Retail::V2::UserInfo#user_id UserInfo.user_id} unset. + # @!attribute [rw] page_size + # @return [::Integer] + # Maximum number of results to return. Set this property to the number of + # prediction results needed. If zero, the service will choose a reasonable + # default. The maximum allowed value is 100. Values above 100 will be coerced + # to 100. + # @!attribute [rw] page_token + # @deprecated This field is deprecated and may be removed in the next major version update. + # @return [::String] + # This field is not used; leave it unset. + # @!attribute [rw] filter + # @return [::String] + # Filter for restricting prediction results with a length limit of 5,000 + # characters. Accepts values for tags and the `filterOutOfStockItems` flag. + # + # * Tag expressions. Restricts predictions to products that match all of the + # specified tags. Boolean operators `OR` and `NOT` are supported if the + # expression is enclosed in parentheses, and must be separated from the + # tag values by a space. `-"tagA"` is also supported and is equivalent to + # `NOT "tagA"`. Tag values must be double quoted UTF-8 encoded strings + # with a size limit of 1,000 characters. + # + # Note: "Recently viewed" models don't support tag filtering at the + # moment. + # + # * filterOutOfStockItems. Restricts predictions to products that do not + # have a + # stockState value of OUT_OF_STOCK. + # + # Examples: + # + # * tag=("Red" OR "Blue") tag="New-Arrival" tag=(NOT "promotional") + # * filterOutOfStockItems tag=(-"promotional") + # * filterOutOfStockItems + # + # If your filter blocks all prediction results, the API will return *no* + # results. If instead you want empty result sets to return generic + # (unfiltered) popular products, set `strictFiltering` to False in + # `PredictRequest.params`. Note that the API will never return items with + # storageStatus of "EXPIRED" or "DELETED" regardless of filter choices. + # + # If `filterSyntaxV2` is set to true under the `params` field, then + # attribute-based expressions are expected instead of the above described + # tag-based syntax. Examples: + # + # * (colors: ANY("Red", "Blue")) AND NOT (categories: ANY("Phones")) + # * (availability: ANY("IN_STOCK")) AND + # (colors: ANY("Red") OR categories: ANY("Phones")) + # + # For more information, see + # [Filter recommendations](https://cloud.google.com/retail/docs/filter-recs). + # @!attribute [rw] validate_only + # @return [::Boolean] + # Use validate only mode for this prediction query. If set to true, a + # dummy model will be used that returns arbitrary products. + # Note that the validate only mode should only be used for testing the API, + # or if the model is not ready. + # @!attribute [rw] params + # @return [::Google::Protobuf::Map{::String => ::Google::Protobuf::Value}] + # Additional domain specific parameters for the predictions. + # + # Allowed values: + # + # * `returnProduct`: Boolean. If set to true, the associated product + # object will be returned in the `results.metadata` field in the + # prediction response. + # * `returnScore`: Boolean. If set to true, the prediction 'score' + # corresponding to each returned product will be set in the + # `results.metadata` field in the prediction response. The given + # 'score' indicates the probability of a product being clicked/purchased + # given the user's context and history. + # * `strictFiltering`: Boolean. True by default. If set to false, the service + # will return generic (unfiltered) popular products instead of empty if + # your filter blocks all prediction results. + # * `priceRerankLevel`: String. Default empty. If set to be non-empty, then + # it needs to be one of {'no-price-reranking', 'low-price-reranking', + # 'medium-price-reranking', 'high-price-reranking'}. This gives + # request-level control and adjusts prediction results based on product + # price. + # * `diversityLevel`: String. Default empty. If set to be non-empty, then + # it needs to be one of {'no-diversity', 'low-diversity', + # 'medium-diversity', 'high-diversity', 'auto-diversity'}. This gives + # request-level control and adjusts prediction results based on product + # category. + # * `filterSyntaxV2`: Boolean. False by default. If set to true, the `filter` + # field is interpreteted according to the new, attribute-based syntax. + # @!attribute [rw] labels + # @return [::Google::Protobuf::Map{::String => ::String}] + # The labels applied to a resource must meet the following requirements: + # + # * Each resource can have multiple labels, up to a maximum of 64. + # * Each label must be a key-value pair. + # * Keys have a minimum length of 1 character and a maximum length of 63 + # characters and cannot be empty. Values can be empty and have a maximum + # length of 63 characters. + # * Keys and values can contain only lowercase letters, numeric characters, + # underscores, and dashes. All characters must use UTF-8 encoding, and + # international characters are allowed. + # * The key portion of a label must be unique. However, you can use the same + # key with multiple resources. + # * Keys must start with a lowercase letter or international character. + # + # See [Google Cloud + # Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + # for more details. + class PredictRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # @!attribute [rw] key + # @return [::String] + # @!attribute [rw] value + # @return [::Google::Protobuf::Value] + class ParamsEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # @!attribute [rw] key + # @return [::String] + # @!attribute [rw] value + # @return [::String] + class LabelsEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # Response message for predict method. + # @!attribute [rw] results + # @return [::Array<::Google::Cloud::Retail::V2::PredictResponse::PredictionResult>] + # A list of recommended products. The order represents the ranking (from the + # most relevant product to the least). + # @!attribute [rw] attribution_token + # @return [::String] + # A unique attribution token. This should be included in the + # {::Google::Cloud::Retail::V2::UserEvent UserEvent} logs resulting from this + # recommendation, which enables accurate attribution of recommendation model + # performance. + # @!attribute [rw] missing_ids + # @return [::Array<::String>] + # IDs of products in the request that were missing from the inventory. + # @!attribute [rw] validate_only + # @return [::Boolean] + # True if the validateOnly property was set in the request. + class PredictResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # PredictionResult represents the recommendation prediction results. + # @!attribute [rw] id + # @return [::String] + # ID of the recommended product + # @!attribute [rw] metadata + # @return [::Google::Protobuf::Map{::String => ::Google::Protobuf::Value}] + # Additional product metadata / annotations. + # + # Possible values: + # + # * `product`: JSON representation of the product. Is set if + # `returnProduct` is set to true in `PredictRequest.params`. + # * `score`: Prediction score in double value. Is set if + # `returnScore` is set to true in `PredictRequest.params`. + class PredictionResult + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # @!attribute [rw] key + # @return [::String] + # @!attribute [rw] value + # @return [::Google::Protobuf::Value] + class MetadataEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/product.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/product.rb new file mode 100644 index 000000000000..a5c89f524c45 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/product.rb @@ -0,0 +1,588 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Retail + module V2 + # Product captures all metadata information of items to be recommended or + # searched. + # @!attribute [rw] expire_time + # @return [::Google::Protobuf::Timestamp] + # Note that this field is applied in the following ways: + # + # * If the {::Google::Cloud::Retail::V2::Product Product} is already expired + # when it is uploaded, this product + # is not indexed for search. + # + # * If the {::Google::Cloud::Retail::V2::Product Product} is not expired when it + # is uploaded, only the + # {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Type.PRIMARY}'s and + # {::Google::Cloud::Retail::V2::Product::Type::COLLECTION Type.COLLECTION}'s + # expireTime is respected, and + # {::Google::Cloud::Retail::V2::Product::Type::VARIANT Type.VARIANT}'s + # expireTime is not used. + # + # In general, we suggest the users to delete the stale + # products explicitly, instead of using this field to determine staleness. + # + # {::Google::Cloud::Retail::V2::Product#expire_time expire_time} must be later + # than {::Google::Cloud::Retail::V2::Product#available_time available_time} and + # {::Google::Cloud::Retail::V2::Product#publish_time publish_time}, otherwise an + # INVALID_ARGUMENT error is thrown. + # + # Corresponding properties: Google Merchant Center property + # [expiration_date](https://support.google.com/merchants/answer/6324499). + # + # Note: The following fields are mutually exclusive: `expire_time`, `ttl`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [rw] ttl + # @return [::Google::Protobuf::Duration] + # Input only. The TTL (time to live) of the product. Note that this is only + # applicable to {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Type.PRIMARY} + # and {::Google::Cloud::Retail::V2::Product::Type::COLLECTION Type.COLLECTION}, + # and ignored for + # {::Google::Cloud::Retail::V2::Product::Type::VARIANT Type.VARIANT}. In general, + # we suggest the users to delete the stale products explicitly, instead of + # using this field to determine staleness. + # + # If it is set, it must be a non-negative value, and + # {::Google::Cloud::Retail::V2::Product#expire_time expire_time} is set as + # current timestamp plus {::Google::Cloud::Retail::V2::Product#ttl ttl}. The + # derived {::Google::Cloud::Retail::V2::Product#expire_time expire_time} is + # returned in the output and {::Google::Cloud::Retail::V2::Product#ttl ttl} is + # left blank when retrieving the {::Google::Cloud::Retail::V2::Product Product}. + # + # If it is set, the product is not available for + # {::Google::Cloud::Retail::V2::SearchService::Client#search SearchService.Search} after + # current timestamp plus {::Google::Cloud::Retail::V2::Product#ttl ttl}. + # However, the product can still be retrieved by + # {::Google::Cloud::Retail::V2::ProductService::Client#get_product ProductService.GetProduct} + # and + # {::Google::Cloud::Retail::V2::ProductService::Client#list_products ProductService.ListProducts}. + # + # Note: The following fields are mutually exclusive: `ttl`, `expire_time`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [rw] name + # @return [::String] + # Immutable. Full resource name of the product, such as + # `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/product_id`. + # @!attribute [rw] id + # @return [::String] + # Immutable. {::Google::Cloud::Retail::V2::Product Product} identifier, which is + # the final component of {::Google::Cloud::Retail::V2::Product#name name}. For + # example, this field is "id_1", if + # {::Google::Cloud::Retail::V2::Product#name name} is + # `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/id_1`. + # + # This field must be a UTF-8 encoded string with a length limit of 128 + # characters. Otherwise, an INVALID_ARGUMENT error is returned. + # + # Corresponding properties: Google Merchant Center property + # [id](https://support.google.com/merchants/answer/6324405). Schema.org + # property [Product.sku](https://schema.org/sku). + # @!attribute [rw] type + # @return [::Google::Cloud::Retail::V2::Product::Type] + # Immutable. The type of the product. Default to + # {::Google::Cloud::Retail::V2::ProductLevelConfig#ingestion_product_type Catalog.product_level_config.ingestion_product_type} + # if unset. + # @!attribute [rw] primary_product_id + # @return [::String] + # Variant group identifier. Must be an + # {::Google::Cloud::Retail::V2::Product#id id}, with the same parent branch with + # this product. Otherwise, an error is thrown. + # + # For {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Type.PRIMARY} + # {::Google::Cloud::Retail::V2::Product Product}s, this field can only be empty or + # set to the same value as {::Google::Cloud::Retail::V2::Product#id id}. + # + # For VARIANT {::Google::Cloud::Retail::V2::Product Product}s, this field cannot + # be empty. A maximum of 2,000 products are allowed to share the same + # {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Type.PRIMARY} + # {::Google::Cloud::Retail::V2::Product Product}. Otherwise, an INVALID_ARGUMENT + # error is returned. + # + # Corresponding properties: Google Merchant Center property + # [item_group_id](https://support.google.com/merchants/answer/6324507). + # Schema.org property + # [Product.inProductGroupWithID](https://schema.org/inProductGroupWithID). + # @!attribute [rw] collection_member_ids + # @return [::Array<::String>] + # The {::Google::Cloud::Retail::V2::Product#id id} of the collection members when + # {::Google::Cloud::Retail::V2::Product#type type} is + # {::Google::Cloud::Retail::V2::Product::Type::COLLECTION Type.COLLECTION}. + # + # Non-existent product ids are allowed. + # The {::Google::Cloud::Retail::V2::Product#type type} of the members must be + # either {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Type.PRIMARY} or + # {::Google::Cloud::Retail::V2::Product::Type::VARIANT Type.VARIANT} otherwise an + # INVALID_ARGUMENT error is thrown. Should not set it for other types. A + # maximum of 1000 values are allowed. Otherwise, an INVALID_ARGUMENT error is + # return. + # @!attribute [rw] gtin + # @return [::String] + # The Global Trade Item Number (GTIN) of the product. + # + # This field must be a UTF-8 encoded string with a length limit of 128 + # characters. Otherwise, an INVALID_ARGUMENT error is returned. + # + # This field must be a Unigram. Otherwise, an INVALID_ARGUMENT error is + # returned. + # + # Corresponding properties: Google Merchant Center property + # [gtin](https://support.google.com/merchants/answer/6324461). + # Schema.org property + # [Product.isbn](https://schema.org/isbn), + # [Product.gtin8](https://schema.org/gtin8), + # [Product.gtin12](https://schema.org/gtin12), + # [Product.gtin13](https://schema.org/gtin13), or + # [Product.gtin14](https://schema.org/gtin14). + # + # If the value is not a valid GTIN, an INVALID_ARGUMENT error is returned. + # @!attribute [rw] categories + # @return [::Array<::String>] + # Product categories. This field is repeated for supporting one product + # belonging to several parallel categories. Strongly recommended using the + # full path for better search / recommendation quality. + # + # + # To represent full path of category, use '>' sign to separate different + # hierarchies. If '>' is part of the category name, replace it with + # other character(s). + # + # For example, if a shoes product belongs to both + # ["Shoes & Accessories" -> "Shoes"] and + # ["Sports & Fitness" -> "Athletic Clothing" -> "Shoes"], it could be + # represented as: + # + # "categories": [ + # "Shoes & Accessories > Shoes", + # "Sports & Fitness > Athletic Clothing > Shoes" + # ] + # + # Must be set for {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Type.PRIMARY} + # {::Google::Cloud::Retail::V2::Product Product} otherwise an INVALID_ARGUMENT + # error is returned. + # + # At most 250 values are allowed per + # {::Google::Cloud::Retail::V2::Product Product} unless overridden through the + # Google Cloud console. Empty values are not allowed. Each value must be a + # UTF-8 encoded string with a length limit of 5,000 characters. Otherwise, an + # INVALID_ARGUMENT error is returned. + # + # Corresponding properties: Google Merchant Center property + # [google_product_category][mc_google_product_category]. Schema.org property + # [Product.category] (https://schema.org/category). + # + # [mc_google_product_category]: + # https://support.google.com/merchants/answer/6324436 + # @!attribute [rw] title + # @return [::String] + # Required. Product title. + # + # This field must be a UTF-8 encoded string with a length limit of 1,000 + # characters. Otherwise, an INVALID_ARGUMENT error is returned. + # + # Corresponding properties: Google Merchant Center property + # [title](https://support.google.com/merchants/answer/6324415). Schema.org + # property [Product.name](https://schema.org/name). + # @!attribute [rw] brands + # @return [::Array<::String>] + # The brands of the product. + # + # A maximum of 30 brands are allowed unless overridden through the Google + # Cloud console. Each + # brand must be a UTF-8 encoded string with a length limit of 1,000 + # characters. Otherwise, an INVALID_ARGUMENT error is returned. + # + # Corresponding properties: Google Merchant Center property + # [brand](https://support.google.com/merchants/answer/6324351). Schema.org + # property [Product.brand](https://schema.org/brand). + # @!attribute [rw] description + # @return [::String] + # Product description. + # + # This field must be a UTF-8 encoded string with a length limit of 5,000 + # characters. Otherwise, an INVALID_ARGUMENT error is returned. + # + # Corresponding properties: Google Merchant Center property + # [description](https://support.google.com/merchants/answer/6324468). + # Schema.org property [Product.description](https://schema.org/description). + # @!attribute [rw] language_code + # @return [::String] + # Language of the title/description and other string attributes. Use language + # tags defined by [BCP 47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt). + # + # For product prediction, this field is ignored and the model automatically + # detects the text language. The {::Google::Cloud::Retail::V2::Product Product} + # can include text in different languages, but duplicating + # {::Google::Cloud::Retail::V2::Product Product}s to provide text in multiple + # languages can result in degraded model performance. + # + # For product search this field is in use. It defaults to "en-US" if unset. + # @!attribute [rw] attributes + # @return [::Google::Protobuf::Map{::String => ::Google::Cloud::Retail::V2::CustomAttribute}] + # Highly encouraged. Extra product attributes to be included. For example, + # for products, this could include the store name, vendor, style, color, etc. + # These are very strong signals for recommendation model, thus we highly + # recommend providing the attributes here. + # + # Features that can take on one of a limited number of possible values. Two + # types of features can be set are: + # + # Textual features. some examples would be the brand/maker of a product, or + # country of a customer. Numerical features. Some examples would be the + # height/weight of a product, or age of a customer. + # + # For example: `{ "vendor": {"text": ["vendor123", "vendor456"]}, + # "lengths_cm": \\{"numbers":[2.3, 15.4]}, "heights_cm": \\{"numbers":[8.1, 6.4]} + # }`. + # + # This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT + # error is returned: + # + # * Max entries count: 200. + # * The key must be a UTF-8 encoded string with a length limit of 128 + # characters. + # * For indexable attribute, the key must match the pattern: + # `[a-zA-Z0-9][a-zA-Z0-9_]*`. For example, `key0LikeThis` or + # `KEY_1_LIKE_THIS`. + # * For text attributes, at most 400 values are allowed. Empty values are not + # allowed. Each value must be a non-empty UTF-8 encoded string with a + # length limit of 256 characters. + # * For number attributes, at most 400 values are allowed. + # @!attribute [rw] tags + # @return [::Array<::String>] + # Custom tags associated with the product. + # + # At most 250 values are allowed per + # {::Google::Cloud::Retail::V2::Product Product}. This value must be a UTF-8 + # encoded string with a length limit of 1,000 characters. Otherwise, an + # INVALID_ARGUMENT error is returned. + # + # This tag can be used for filtering recommendation results by passing the + # tag as part of the + # {::Google::Cloud::Retail::V2::PredictRequest#filter PredictRequest.filter}. + # + # Corresponding properties: Google Merchant Center property + # [custom_label_0–4](https://support.google.com/merchants/answer/6324473). + # @!attribute [rw] price_info + # @return [::Google::Cloud::Retail::V2::PriceInfo] + # Product price and cost information. + # + # Corresponding properties: Google Merchant Center property + # [price](https://support.google.com/merchants/answer/6324371). + # @!attribute [rw] rating + # @return [::Google::Cloud::Retail::V2::Rating] + # The rating of this product. + # @!attribute [rw] available_time + # @return [::Google::Protobuf::Timestamp] + # The timestamp when this {::Google::Cloud::Retail::V2::Product Product} becomes + # available for + # {::Google::Cloud::Retail::V2::SearchService::Client#search SearchService.Search}. Note + # that this is only applicable to + # {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Type.PRIMARY} and + # {::Google::Cloud::Retail::V2::Product::Type::COLLECTION Type.COLLECTION}, and + # ignored for {::Google::Cloud::Retail::V2::Product::Type::VARIANT Type.VARIANT}. + # @!attribute [rw] availability + # @return [::Google::Cloud::Retail::V2::Product::Availability] + # The online availability of the {::Google::Cloud::Retail::V2::Product Product}. + # Default to + # {::Google::Cloud::Retail::V2::Product::Availability::IN_STOCK Availability.IN_STOCK}. + # + # For primary products with variants set the availability of the primary as + # {::Google::Cloud::Retail::V2::Product::Availability::OUT_OF_STOCK Availability.OUT_OF_STOCK} + # and set the true availability at the variant level. This way the primary + # product will be considered "in stock" as long as it has at least one + # variant in stock. + # + # For primary products with no variants set the true availability at the + # primary level. + # + # Corresponding properties: Google Merchant Center property + # [availability](https://support.google.com/merchants/answer/6324448). + # Schema.org property [Offer.availability](https://schema.org/availability). + # @!attribute [rw] available_quantity + # @return [::Google::Protobuf::Int32Value] + # The available quantity of the item. + # @!attribute [rw] fulfillment_info + # @return [::Array<::Google::Cloud::Retail::V2::FulfillmentInfo>] + # Fulfillment information, such as the store IDs for in-store pickup or + # region IDs for different shipping methods. + # + # All the elements must have distinct + # {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type}. + # Otherwise, an INVALID_ARGUMENT error is returned. + # @!attribute [rw] uri + # @return [::String] + # Canonical URL directly linking to the product detail page. + # + # It is strongly recommended to provide a valid uri for the product, + # otherwise the service performance could be significantly degraded. + # + # This field must be a UTF-8 encoded string with a length limit of 5,000 + # characters. Otherwise, an INVALID_ARGUMENT error is returned. + # + # Corresponding properties: Google Merchant Center property + # [link](https://support.google.com/merchants/answer/6324416). Schema.org + # property [Offer.url](https://schema.org/url). + # @!attribute [rw] images + # @return [::Array<::Google::Cloud::Retail::V2::Image>] + # Product images for the product. We highly recommend putting the main + # image first. + # + # A maximum of 300 images are allowed. + # + # Corresponding properties: Google Merchant Center property + # [image_link](https://support.google.com/merchants/answer/6324350). + # Schema.org property [Product.image](https://schema.org/image). + # @!attribute [rw] audience + # @return [::Google::Cloud::Retail::V2::Audience] + # The target group associated with a given audience (e.g. male, veterans, + # car owners, musicians, etc.) of the product. + # @!attribute [rw] color_info + # @return [::Google::Cloud::Retail::V2::ColorInfo] + # The color of the product. + # + # Corresponding properties: Google Merchant Center property + # [color](https://support.google.com/merchants/answer/6324487). Schema.org + # property [Product.color](https://schema.org/color). + # @!attribute [rw] sizes + # @return [::Array<::String>] + # The size of the product. To represent different size systems or size types, + # consider using this format: [[[size_system:]size_type:]size_value]. + # + # For example, in "US:MENS:M", "US" represents size system; "MENS" represents + # size type; "M" represents size value. In "GIRLS:27", size system is empty; + # "GIRLS" represents size type; "27" represents size value. In "32 inches", + # both size system and size type are empty, while size value is "32 inches". + # + # A maximum of 20 values are allowed per + # {::Google::Cloud::Retail::V2::Product Product}. Each value must be a UTF-8 + # encoded string with a length limit of 128 characters. Otherwise, an + # INVALID_ARGUMENT error is returned. + # + # Corresponding properties: Google Merchant Center property + # [size](https://support.google.com/merchants/answer/6324492), + # [size_type](https://support.google.com/merchants/answer/6324497), and + # [size_system](https://support.google.com/merchants/answer/6324502). + # Schema.org property [Product.size](https://schema.org/size). + # @!attribute [rw] materials + # @return [::Array<::String>] + # The material of the product. For example, "leather", "wooden". + # + # A maximum of 20 values are allowed. Each value must be a UTF-8 encoded + # string with a length limit of 200 characters. Otherwise, an + # INVALID_ARGUMENT error is returned. + # + # Corresponding properties: Google Merchant Center property + # [material](https://support.google.com/merchants/answer/6324410). Schema.org + # property [Product.material](https://schema.org/material). + # @!attribute [rw] patterns + # @return [::Array<::String>] + # The pattern or graphic print of the product. For example, "striped", "polka + # dot", "paisley". + # + # A maximum of 20 values are allowed per + # {::Google::Cloud::Retail::V2::Product Product}. Each value must be a UTF-8 + # encoded string with a length limit of 128 characters. Otherwise, an + # INVALID_ARGUMENT error is returned. + # + # Corresponding properties: Google Merchant Center property + # [pattern](https://support.google.com/merchants/answer/6324483). Schema.org + # property [Product.pattern](https://schema.org/pattern). + # @!attribute [rw] conditions + # @return [::Array<::String>] + # The condition of the product. Strongly encouraged to use the standard + # values: "new", "refurbished", "used". + # + # A maximum of 1 value is allowed per + # {::Google::Cloud::Retail::V2::Product Product}. Each value must be a UTF-8 + # encoded string with a length limit of 128 characters. Otherwise, an + # INVALID_ARGUMENT error is returned. + # + # Corresponding properties: Google Merchant Center property + # [condition](https://support.google.com/merchants/answer/6324469). + # Schema.org property + # [Offer.itemCondition](https://schema.org/itemCondition). + # @!attribute [rw] promotions + # @return [::Array<::Google::Cloud::Retail::V2::Promotion>] + # The promotions applied to the product. A maximum of 10 values are allowed + # per {::Google::Cloud::Retail::V2::Product Product}. Only + # {::Google::Cloud::Retail::V2::Promotion#promotion_id Promotion.promotion_id} + # will be used, other fields will be ignored if set. + # @!attribute [rw] publish_time + # @return [::Google::Protobuf::Timestamp] + # The timestamp when the product is published by the retailer for the first + # time, which indicates the freshness of the products. Note that this field + # is different from + # {::Google::Cloud::Retail::V2::Product#available_time available_time}, given it + # purely describes product freshness regardless of when it is available on + # search and recommendation. + # @!attribute [rw] retrievable_fields + # @deprecated This field is deprecated and may be removed in the next major version update. + # @return [::Google::Protobuf::FieldMask] + # Indicates which fields in the {::Google::Cloud::Retail::V2::Product Product}s + # are returned in {::Google::Cloud::Retail::V2::SearchResponse SearchResponse}. + # + # Supported fields for all {::Google::Cloud::Retail::V2::Product#type type}s: + # + # * {::Google::Cloud::Retail::V2::Product#audience audience} + # * {::Google::Cloud::Retail::V2::Product#availability availability} + # * {::Google::Cloud::Retail::V2::Product#brands brands} + # * {::Google::Cloud::Retail::V2::Product#color_info color_info} + # * {::Google::Cloud::Retail::V2::Product#conditions conditions} + # * {::Google::Cloud::Retail::V2::Product#gtin gtin} + # * {::Google::Cloud::Retail::V2::Product#materials materials} + # * {::Google::Cloud::Retail::V2::Product#name name} + # * {::Google::Cloud::Retail::V2::Product#patterns patterns} + # * {::Google::Cloud::Retail::V2::Product#price_info price_info} + # * {::Google::Cloud::Retail::V2::Product#rating rating} + # * {::Google::Cloud::Retail::V2::Product#sizes sizes} + # * {::Google::Cloud::Retail::V2::Product#title title} + # * {::Google::Cloud::Retail::V2::Product#uri uri} + # + # Supported fields only for + # {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Type.PRIMARY} and + # {::Google::Cloud::Retail::V2::Product::Type::COLLECTION Type.COLLECTION}: + # + # * {::Google::Cloud::Retail::V2::Product#categories categories} + # * {::Google::Cloud::Retail::V2::Product#description description} + # * {::Google::Cloud::Retail::V2::Product#images images} + # + # Supported fields only for + # {::Google::Cloud::Retail::V2::Product::Type::VARIANT Type.VARIANT}: + # + # * Only the first image in {::Google::Cloud::Retail::V2::Product#images images} + # + # To mark {::Google::Cloud::Retail::V2::Product#attributes attributes} as + # retrievable, include paths of the form "attributes.key" where "key" is the + # key of a custom attribute, as specified in + # {::Google::Cloud::Retail::V2::Product#attributes attributes}. + # + # For {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Type.PRIMARY} and + # {::Google::Cloud::Retail::V2::Product::Type::COLLECTION Type.COLLECTION}, the + # following fields are always returned in + # {::Google::Cloud::Retail::V2::SearchResponse SearchResponse} by default: + # + # * {::Google::Cloud::Retail::V2::Product#name name} + # + # For {::Google::Cloud::Retail::V2::Product::Type::VARIANT Type.VARIANT}, the + # following fields are always returned in by default: + # + # * {::Google::Cloud::Retail::V2::Product#name name} + # * {::Google::Cloud::Retail::V2::Product#color_info color_info} + # + # Note: Returning more fields in + # {::Google::Cloud::Retail::V2::SearchResponse SearchResponse} can increase + # response payload size and serving latency. + # + # This field is deprecated. Use the retrievable site-wide control instead. + # @!attribute [r] variants + # @return [::Array<::Google::Cloud::Retail::V2::Product>] + # Output only. Product variants grouped together on primary product which + # share similar product attributes. It's automatically grouped by + # {::Google::Cloud::Retail::V2::Product#primary_product_id primary_product_id} for + # all the product variants. Only populated for + # {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Type.PRIMARY} + # {::Google::Cloud::Retail::V2::Product Product}s. + # + # Note: This field is OUTPUT_ONLY for + # {::Google::Cloud::Retail::V2::ProductService::Client#get_product ProductService.GetProduct}. + # Do not set this field in API requests. + # @!attribute [r] local_inventories + # @return [::Array<::Google::Cloud::Retail::V2::LocalInventory>] + # Output only. A list of local inventories specific to different places. + # + # This field can be managed by + # {::Google::Cloud::Retail::V2::ProductService::Client#add_local_inventories ProductService.AddLocalInventories} + # and + # {::Google::Cloud::Retail::V2::ProductService::Client#remove_local_inventories ProductService.RemoveLocalInventories} + # APIs if fine-grained, high-volume updates are necessary. + class Product + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # @!attribute [rw] key + # @return [::String] + # @!attribute [rw] value + # @return [::Google::Cloud::Retail::V2::CustomAttribute] + class AttributesEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The type of this product. + module Type + # Default value. Default to + # {::Google::Cloud::Retail::V2::ProductLevelConfig#ingestion_product_type Catalog.product_level_config.ingestion_product_type} + # if unset. + TYPE_UNSPECIFIED = 0 + + # The primary type. + # + # As the primary unit for predicting, indexing and search serving, a + # {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Type.PRIMARY} + # {::Google::Cloud::Retail::V2::Product Product} is grouped with multiple + # {::Google::Cloud::Retail::V2::Product::Type::VARIANT Type.VARIANT} + # {::Google::Cloud::Retail::V2::Product Product}s. + PRIMARY = 1 + + # The variant type. + # + # {::Google::Cloud::Retail::V2::Product::Type::VARIANT Type.VARIANT} + # {::Google::Cloud::Retail::V2::Product Product}s usually share some common + # attributes on the same + # {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Type.PRIMARY} + # {::Google::Cloud::Retail::V2::Product Product}s, but they have variant + # attributes like different colors, sizes and prices, etc. + VARIANT = 2 + + # The collection type. Collection products are bundled + # {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Type.PRIMARY} + # {::Google::Cloud::Retail::V2::Product Product}s or + # {::Google::Cloud::Retail::V2::Product::Type::VARIANT Type.VARIANT} + # {::Google::Cloud::Retail::V2::Product Product}s that are sold together, such + # as a jewelry set with necklaces, earrings and rings, etc. + COLLECTION = 3 + end + + # Product availability. If this field is unspecified, the product is + # assumed to be in stock. + module Availability + # Default product availability. Default to + # {::Google::Cloud::Retail::V2::Product::Availability::IN_STOCK Availability.IN_STOCK} + # if unset. + AVAILABILITY_UNSPECIFIED = 0 + + # Product in stock. + IN_STOCK = 1 + + # Product out of stock. + OUT_OF_STOCK = 2 + + # Product that is in pre-order state. + PREORDER = 3 + + # Product that is back-ordered (i.e. temporarily out of stock). + BACKORDER = 4 + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/product_service.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/product_service.rb new file mode 100644 index 000000000000..c6fb71059137 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/product_service.rb @@ -0,0 +1,653 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Retail + module V2 + # Request message for + # {::Google::Cloud::Retail::V2::ProductService::Client#create_product ProductService.CreateProduct} + # method. + # @!attribute [rw] parent + # @return [::String] + # Required. The parent catalog resource name, such as + # `projects/*/locations/global/catalogs/default_catalog/branches/default_branch`. + # @!attribute [rw] product + # @return [::Google::Cloud::Retail::V2::Product] + # Required. The {::Google::Cloud::Retail::V2::Product Product} to create. + # @!attribute [rw] product_id + # @return [::String] + # Required. The ID to use for the {::Google::Cloud::Retail::V2::Product Product}, + # which will become the final component of the + # {::Google::Cloud::Retail::V2::Product#name Product.name}. + # + # If the caller does not have permission to create the + # {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it + # exists, a PERMISSION_DENIED error is returned. + # + # This field must be unique among all + # {::Google::Cloud::Retail::V2::Product Product}s with the same + # {::Google::Cloud::Retail::V2::CreateProductRequest#parent parent}. Otherwise, an + # ALREADY_EXISTS error is returned. + # + # This field must be a UTF-8 encoded string with a length limit of 128 + # characters. Otherwise, an INVALID_ARGUMENT error is returned. + class CreateProductRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for + # {::Google::Cloud::Retail::V2::ProductService::Client#get_product ProductService.GetProduct} + # method. + # @!attribute [rw] name + # @return [::String] + # Required. Full resource name of {::Google::Cloud::Retail::V2::Product Product}, + # such as + # `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. + # + # If the caller does not have permission to access the + # {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it + # exists, a PERMISSION_DENIED error is returned. + # + # If the requested {::Google::Cloud::Retail::V2::Product Product} does not exist, + # a NOT_FOUND error is returned. + class GetProductRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for + # {::Google::Cloud::Retail::V2::ProductService::Client#update_product ProductService.UpdateProduct} + # method. + # @!attribute [rw] product + # @return [::Google::Cloud::Retail::V2::Product] + # Required. The product to update/create. + # + # If the caller does not have permission to update the + # {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it + # exists, a PERMISSION_DENIED error is returned. + # + # If the {::Google::Cloud::Retail::V2::Product Product} to update does not exist + # and + # {::Google::Cloud::Retail::V2::UpdateProductRequest#allow_missing allow_missing} + # is not set, a NOT_FOUND error is returned. + # @!attribute [rw] update_mask + # @return [::Google::Protobuf::FieldMask] + # Indicates which fields in the provided + # {::Google::Cloud::Retail::V2::Product Product} to update. The immutable and + # output only fields are NOT supported. If not set, all supported fields (the + # fields that are neither immutable nor output only) are updated. + # + # If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + # is returned. + # + # The attribute key can be updated by setting the mask path as + # "attributes.$\\{key_name}". If a key name is present in the mask but not in + # the patching product from the request, this key will be deleted after the + # update. + # @!attribute [rw] allow_missing + # @return [::Boolean] + # If set to true, and the {::Google::Cloud::Retail::V2::Product Product} is not + # found, a new {::Google::Cloud::Retail::V2::Product Product} will be created. In + # this situation, `update_mask` is ignored. + class UpdateProductRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for + # {::Google::Cloud::Retail::V2::ProductService::Client#delete_product ProductService.DeleteProduct} + # method. + # @!attribute [rw] name + # @return [::String] + # Required. Full resource name of {::Google::Cloud::Retail::V2::Product Product}, + # such as + # `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. + # + # If the caller does not have permission to delete the + # {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it + # exists, a PERMISSION_DENIED error is returned. + # + # If the {::Google::Cloud::Retail::V2::Product Product} to delete does not exist, + # a NOT_FOUND error is returned. + # + # The {::Google::Cloud::Retail::V2::Product Product} to delete can neither be a + # {::Google::Cloud::Retail::V2::Product::Type::COLLECTION Product.Type.COLLECTION} + # {::Google::Cloud::Retail::V2::Product Product} member nor a + # {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Product.Type.PRIMARY} + # {::Google::Cloud::Retail::V2::Product Product} with more than one + # {::Google::Cloud::Retail::V2::Product::Type::VARIANT variants}. Otherwise, an + # INVALID_ARGUMENT error is returned. + # + # All inventory information for the named + # {::Google::Cloud::Retail::V2::Product Product} will be deleted. + class DeleteProductRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for + # {::Google::Cloud::Retail::V2::ProductService::Client#list_products ProductService.ListProducts} + # method. + # @!attribute [rw] parent + # @return [::String] + # Required. The parent branch resource name, such as + # `projects/*/locations/global/catalogs/default_catalog/branches/0`. Use + # `default_branch` as the branch ID, to list products under the default + # branch. + # + # If the caller does not have permission to list + # {::Google::Cloud::Retail::V2::Product Product}s under this branch, regardless of + # whether or not this branch exists, a PERMISSION_DENIED error is returned. + # @!attribute [rw] page_size + # @return [::Integer] + # Maximum number of {::Google::Cloud::Retail::V2::Product Product}s to return. If + # unspecified, defaults to 100. The maximum allowed value is 1000. Values + # above 1000 will be coerced to 1000. + # + # If this field is negative, an INVALID_ARGUMENT error is returned. + # @!attribute [rw] page_token + # @return [::String] + # A page token + # {::Google::Cloud::Retail::V2::ListProductsResponse#next_page_token ListProductsResponse.next_page_token}, + # received from a previous + # {::Google::Cloud::Retail::V2::ProductService::Client#list_products ProductService.ListProducts} + # call. Provide this to retrieve the subsequent page. + # + # When paginating, all other parameters provided to + # {::Google::Cloud::Retail::V2::ProductService::Client#list_products ProductService.ListProducts} + # must match the call that provided the page token. Otherwise, an + # INVALID_ARGUMENT error is returned. + # @!attribute [rw] filter + # @return [::String] + # A filter to apply on the list results. Supported features: + # + # * List all the products under the parent branch if + # {::Google::Cloud::Retail::V2::ListProductsRequest#filter filter} is unset. + # * List {::Google::Cloud::Retail::V2::Product::Type::VARIANT Product.Type.VARIANT} + # {::Google::Cloud::Retail::V2::Product Product}s sharing the same + # {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Product.Type.PRIMARY} + # {::Google::Cloud::Retail::V2::Product Product}. For example: + # `primary_product_id = "some_product_id"` + # * List {::Google::Cloud::Retail::V2::Product Product}s bundled in a + # {::Google::Cloud::Retail::V2::Product::Type::COLLECTION Product.Type.COLLECTION} + # {::Google::Cloud::Retail::V2::Product Product}. + # For example: + # `collection_product_id = "some_product_id"` + # * List {::Google::Cloud::Retail::V2::Product Product}s with a partibular type. + # For example: + # `type = "PRIMARY"` + # `type = "VARIANT"` + # `type = "COLLECTION"` + # + # If the field is unrecognizable, an INVALID_ARGUMENT error is returned. + # + # If the specified + # {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Product.Type.PRIMARY} + # {::Google::Cloud::Retail::V2::Product Product} or + # {::Google::Cloud::Retail::V2::Product::Type::COLLECTION Product.Type.COLLECTION} + # {::Google::Cloud::Retail::V2::Product Product} does not exist, a NOT_FOUND error + # is returned. + # @!attribute [rw] read_mask + # @return [::Google::Protobuf::FieldMask] + # The fields of {::Google::Cloud::Retail::V2::Product Product} to return in the + # responses. If not set or empty, the following fields are returned: + # + # * {::Google::Cloud::Retail::V2::Product#name Product.name} + # * {::Google::Cloud::Retail::V2::Product#id Product.id} + # * {::Google::Cloud::Retail::V2::Product#title Product.title} + # * {::Google::Cloud::Retail::V2::Product#uri Product.uri} + # * {::Google::Cloud::Retail::V2::Product#images Product.images} + # * {::Google::Cloud::Retail::V2::Product#price_info Product.price_info} + # * {::Google::Cloud::Retail::V2::Product#brands Product.brands} + # + # If "*" is provided, all fields are returned. + # {::Google::Cloud::Retail::V2::Product#name Product.name} is always returned no + # matter what mask is set. + # + # If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + # is returned. + class ListProductsRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Response message for + # {::Google::Cloud::Retail::V2::ProductService::Client#list_products ProductService.ListProducts} + # method. + # @!attribute [rw] products + # @return [::Array<::Google::Cloud::Retail::V2::Product>] + # The {::Google::Cloud::Retail::V2::Product Product}s. + # @!attribute [rw] next_page_token + # @return [::String] + # A token that can be sent as + # {::Google::Cloud::Retail::V2::ListProductsRequest#page_token ListProductsRequest.page_token} + # to retrieve the next page. If this field is omitted, there are no + # subsequent pages. + class ListProductsResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for + # {::Google::Cloud::Retail::V2::ProductService::Client#set_inventory ProductService.SetInventory} + # method. + # @!attribute [rw] inventory + # @return [::Google::Cloud::Retail::V2::Product] + # Required. The inventory information to update. The allowable fields to + # update are: + # + # * {::Google::Cloud::Retail::V2::Product#price_info Product.price_info} + # * {::Google::Cloud::Retail::V2::Product#availability Product.availability} + # * {::Google::Cloud::Retail::V2::Product#available_quantity Product.available_quantity} + # * {::Google::Cloud::Retail::V2::Product#fulfillment_info Product.fulfillment_info} + # The updated inventory fields must be specified in + # {::Google::Cloud::Retail::V2::SetInventoryRequest#set_mask SetInventoryRequest.set_mask}. + # + # If + # {::Google::Cloud::Retail::V2::Product#name SetInventoryRequest.inventory.name} + # is empty or invalid, an INVALID_ARGUMENT error is returned. + # + # If the caller does not have permission to update the + # {::Google::Cloud::Retail::V2::Product Product} named in + # {::Google::Cloud::Retail::V2::Product#name Product.name}, regardless of whether + # or not it exists, a PERMISSION_DENIED error is returned. + # + # If the {::Google::Cloud::Retail::V2::Product Product} to update does not have + # existing inventory information, the provided inventory information will be + # inserted. + # + # If the {::Google::Cloud::Retail::V2::Product Product} to update has existing + # inventory information, the provided inventory information will be merged + # while respecting the last update time for each inventory field, using the + # provided or default value for + # {::Google::Cloud::Retail::V2::SetInventoryRequest#set_time SetInventoryRequest.set_time}. + # + # The caller can replace place IDs for a subset of fulfillment types in the + # following ways: + # + # * Adds "fulfillment_info" in + # {::Google::Cloud::Retail::V2::SetInventoryRequest#set_mask SetInventoryRequest.set_mask} + # * Specifies only the desired fulfillment types and corresponding place IDs + # to update in + # {::Google::Cloud::Retail::V2::Product#fulfillment_info SetInventoryRequest.inventory.fulfillment_info} + # + # The caller can clear all place IDs from a subset of fulfillment types in + # the following ways: + # + # * Adds "fulfillment_info" in + # {::Google::Cloud::Retail::V2::SetInventoryRequest#set_mask SetInventoryRequest.set_mask} + # * Specifies only the desired fulfillment types to clear in + # {::Google::Cloud::Retail::V2::Product#fulfillment_info SetInventoryRequest.inventory.fulfillment_info} + # * Checks that only the desired fulfillment info types have empty + # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids SetInventoryRequest.inventory.fulfillment_info.place_ids} + # + # The last update time is recorded for the following inventory fields: + # * {::Google::Cloud::Retail::V2::Product#price_info Product.price_info} + # * {::Google::Cloud::Retail::V2::Product#availability Product.availability} + # * {::Google::Cloud::Retail::V2::Product#available_quantity Product.available_quantity} + # * {::Google::Cloud::Retail::V2::Product#fulfillment_info Product.fulfillment_info} + # + # If a full overwrite of inventory information while ignoring timestamps is + # needed, + # {::Google::Cloud::Retail::V2::ProductService::Client#update_product ProductService.UpdateProduct} + # should be invoked instead. + # @!attribute [rw] set_mask + # @return [::Google::Protobuf::FieldMask] + # Indicates which inventory fields in the provided + # {::Google::Cloud::Retail::V2::Product Product} to update. + # + # At least one field must be provided. + # + # If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + # is returned and the entire update will be ignored. + # @!attribute [rw] set_time + # @return [::Google::Protobuf::Timestamp] + # The time when the request is issued, used to prevent + # out-of-order updates on inventory fields with the last update time + # recorded. If not provided, the internal system time will be used. + # @!attribute [rw] allow_missing + # @return [::Boolean] + # If set to true, and the {::Google::Cloud::Retail::V2::Product Product} with name + # {::Google::Cloud::Retail::V2::Product#name Product.name} is not found, the + # inventory update will still be processed and retained for at most 1 day + # until the {::Google::Cloud::Retail::V2::Product Product} is created. If set to + # false, a NOT_FOUND error is returned if the + # {::Google::Cloud::Retail::V2::Product Product} is not found. + class SetInventoryRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Metadata related to the progress of the SetInventory operation. + # Currently empty because there is no meaningful metadata populated from the + # {::Google::Cloud::Retail::V2::ProductService::Client#set_inventory ProductService.SetInventory} + # method. + class SetInventoryMetadata + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Response of the SetInventoryRequest. Currently empty because + # there is no meaningful response populated from the + # {::Google::Cloud::Retail::V2::ProductService::Client#set_inventory ProductService.SetInventory} + # method. + class SetInventoryResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for + # {::Google::Cloud::Retail::V2::ProductService::Client#add_fulfillment_places ProductService.AddFulfillmentPlaces} + # method. + # @!attribute [rw] product + # @return [::String] + # Required. Full resource name of {::Google::Cloud::Retail::V2::Product Product}, + # such as + # `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. + # + # If the caller does not have permission to access the + # {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it + # exists, a PERMISSION_DENIED error is returned. + # @!attribute [rw] type + # @return [::String] + # Required. The fulfillment type, including commonly used types (such as + # pickup in store and same day delivery), and custom types. + # + # Supported values: + # + # * "pickup-in-store" + # * "ship-to-store" + # * "same-day-delivery" + # * "next-day-delivery" + # * "custom-type-1" + # * "custom-type-2" + # * "custom-type-3" + # * "custom-type-4" + # * "custom-type-5" + # + # If this field is set to an invalid value other than these, an + # INVALID_ARGUMENT error is returned. + # + # This field directly corresponds to + # {::Google::Cloud::Retail::V2::FulfillmentInfo#type Product.fulfillment_info.type}. + # @!attribute [rw] place_ids + # @return [::Array<::String>] + # Required. The IDs for this + # {::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest#type type}, such as + # the store IDs for "pickup-in-store" or the region IDs for + # "same-day-delivery" to be added for this + # {::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest#type type}. Duplicate + # IDs will be automatically ignored. + # + # At least 1 value is required, and a maximum of 2000 values are allowed. + # Each value must be a string with a length limit of 10 characters, matching + # the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an + # INVALID_ARGUMENT error is returned. + # + # If the total number of place IDs exceeds 2000 for this + # {::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest#type type} after + # adding, then the update will be rejected. + # @!attribute [rw] add_time + # @return [::Google::Protobuf::Timestamp] + # The time when the fulfillment updates are issued, used to prevent + # out-of-order updates on fulfillment information. If not provided, the + # internal system time will be used. + # @!attribute [rw] allow_missing + # @return [::Boolean] + # If set to true, and the {::Google::Cloud::Retail::V2::Product Product} is not + # found, the fulfillment information will still be processed and retained for + # at most 1 day and processed once the + # {::Google::Cloud::Retail::V2::Product Product} is created. If set to false, a + # NOT_FOUND error is returned if the + # {::Google::Cloud::Retail::V2::Product Product} is not found. + class AddFulfillmentPlacesRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Metadata related to the progress of the AddFulfillmentPlaces operation. + # Currently empty because there is no meaningful metadata populated from the + # {::Google::Cloud::Retail::V2::ProductService::Client#add_fulfillment_places ProductService.AddFulfillmentPlaces} + # method. + class AddFulfillmentPlacesMetadata + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Response of the AddFulfillmentPlacesRequest. Currently empty because + # there is no meaningful response populated from the + # {::Google::Cloud::Retail::V2::ProductService::Client#add_fulfillment_places ProductService.AddFulfillmentPlaces} + # method. + class AddFulfillmentPlacesResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for + # {::Google::Cloud::Retail::V2::ProductService::Client#add_local_inventories ProductService.AddLocalInventories} + # method. + # @!attribute [rw] product + # @return [::String] + # Required. Full resource name of {::Google::Cloud::Retail::V2::Product Product}, + # such as + # `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. + # + # If the caller does not have permission to access the + # {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it + # exists, a PERMISSION_DENIED error is returned. + # @!attribute [rw] local_inventories + # @return [::Array<::Google::Cloud::Retail::V2::LocalInventory>] + # Required. A list of inventory information at difference places. Each place + # is identified by its place ID. At most 3000 inventories are allowed per + # request. + # @!attribute [rw] add_mask + # @return [::Google::Protobuf::FieldMask] + # Indicates which inventory fields in the provided list of + # {::Google::Cloud::Retail::V2::LocalInventory LocalInventory} to update. The + # field is updated to the provided value. + # + # If a field is set while the place does not have a previous local inventory, + # the local inventory at that store is created. + # + # If a field is set while the value of that field is not provided, the + # original field value, if it exists, is deleted. + # + # If the mask is not set or set with empty paths, all inventory fields will + # be updated. + # + # If an unsupported or unknown field is provided, an INVALID_ARGUMENT error + # is returned and the entire update will be ignored. + # @!attribute [rw] add_time + # @return [::Google::Protobuf::Timestamp] + # The time when the inventory updates are issued. Used to prevent + # out-of-order updates on local inventory fields. If not provided, the + # internal system time will be used. + # @!attribute [rw] allow_missing + # @return [::Boolean] + # If set to true, and the {::Google::Cloud::Retail::V2::Product Product} is not + # found, the local inventory will still be processed and retained for at most + # 1 day and processed once the {::Google::Cloud::Retail::V2::Product Product} is + # created. If set to false, a NOT_FOUND error is returned if the + # {::Google::Cloud::Retail::V2::Product Product} is not found. + class AddLocalInventoriesRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Metadata related to the progress of the AddLocalInventories operation. + # Currently empty because there is no meaningful metadata populated from the + # {::Google::Cloud::Retail::V2::ProductService::Client#add_local_inventories ProductService.AddLocalInventories} + # method. + class AddLocalInventoriesMetadata + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Response of the + # {::Google::Cloud::Retail::V2::ProductService::Client#add_local_inventories ProductService.AddLocalInventories} + # API. Currently empty because there is no meaningful response populated from + # the + # {::Google::Cloud::Retail::V2::ProductService::Client#add_local_inventories ProductService.AddLocalInventories} + # method. + class AddLocalInventoriesResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for + # {::Google::Cloud::Retail::V2::ProductService::Client#remove_local_inventories ProductService.RemoveLocalInventories} + # method. + # @!attribute [rw] product + # @return [::String] + # Required. Full resource name of {::Google::Cloud::Retail::V2::Product Product}, + # such as + # `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. + # + # If the caller does not have permission to access the + # {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it + # exists, a PERMISSION_DENIED error is returned. + # @!attribute [rw] place_ids + # @return [::Array<::String>] + # Required. A list of place IDs to have their inventory deleted. + # At most 3000 place IDs are allowed per request. + # @!attribute [rw] remove_time + # @return [::Google::Protobuf::Timestamp] + # The time when the inventory deletions are issued. Used to prevent + # out-of-order updates and deletions on local inventory fields. If not + # provided, the internal system time will be used. + # @!attribute [rw] allow_missing + # @return [::Boolean] + # If set to true, and the {::Google::Cloud::Retail::V2::Product Product} is not + # found, the local inventory removal request will still be processed and + # retained for at most 1 day and processed once the + # {::Google::Cloud::Retail::V2::Product Product} is created. If set to false, a + # NOT_FOUND error is returned if the + # {::Google::Cloud::Retail::V2::Product Product} is not found. + class RemoveLocalInventoriesRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Metadata related to the progress of the RemoveLocalInventories operation. + # Currently empty because there is no meaningful metadata populated from the + # {::Google::Cloud::Retail::V2::ProductService::Client#remove_local_inventories ProductService.RemoveLocalInventories} + # method. + class RemoveLocalInventoriesMetadata + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Response of the + # {::Google::Cloud::Retail::V2::ProductService::Client#remove_local_inventories ProductService.RemoveLocalInventories} + # API. Currently empty because there is no meaningful response populated from + # the + # {::Google::Cloud::Retail::V2::ProductService::Client#remove_local_inventories ProductService.RemoveLocalInventories} + # method. + class RemoveLocalInventoriesResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for + # {::Google::Cloud::Retail::V2::ProductService::Client#remove_fulfillment_places ProductService.RemoveFulfillmentPlaces} + # method. + # @!attribute [rw] product + # @return [::String] + # Required. Full resource name of {::Google::Cloud::Retail::V2::Product Product}, + # such as + # `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. + # + # If the caller does not have permission to access the + # {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it + # exists, a PERMISSION_DENIED error is returned. + # @!attribute [rw] type + # @return [::String] + # Required. The fulfillment type, including commonly used types (such as + # pickup in store and same day delivery), and custom types. + # + # Supported values: + # + # * "pickup-in-store" + # * "ship-to-store" + # * "same-day-delivery" + # * "next-day-delivery" + # * "custom-type-1" + # * "custom-type-2" + # * "custom-type-3" + # * "custom-type-4" + # * "custom-type-5" + # + # If this field is set to an invalid value other than these, an + # INVALID_ARGUMENT error is returned. + # + # This field directly corresponds to + # {::Google::Cloud::Retail::V2::FulfillmentInfo#type Product.fulfillment_info.type}. + # @!attribute [rw] place_ids + # @return [::Array<::String>] + # Required. The IDs for this + # {::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest#type type}, such as + # the store IDs for "pickup-in-store" or the region IDs for + # "same-day-delivery", to be removed for this + # {::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest#type type}. + # + # At least 1 value is required, and a maximum of 2000 values are allowed. + # Each value must be a string with a length limit of 10 characters, matching + # the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an + # INVALID_ARGUMENT error is returned. + # @!attribute [rw] remove_time + # @return [::Google::Protobuf::Timestamp] + # The time when the fulfillment updates are issued, used to prevent + # out-of-order updates on fulfillment information. If not provided, the + # internal system time will be used. + # @!attribute [rw] allow_missing + # @return [::Boolean] + # If set to true, and the {::Google::Cloud::Retail::V2::Product Product} is not + # found, the fulfillment information will still be processed and retained for + # at most 1 day and processed once the + # {::Google::Cloud::Retail::V2::Product Product} is created. If set to false, a + # NOT_FOUND error is returned if the + # {::Google::Cloud::Retail::V2::Product Product} is not found. + class RemoveFulfillmentPlacesRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Metadata related to the progress of the RemoveFulfillmentPlaces operation. + # Currently empty because there is no meaningful metadata populated from the + # {::Google::Cloud::Retail::V2::ProductService::Client#remove_fulfillment_places ProductService.RemoveFulfillmentPlaces} + # method. + class RemoveFulfillmentPlacesMetadata + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Response of the RemoveFulfillmentPlacesRequest. Currently empty because there + # is no meaningful response populated from the + # {::Google::Cloud::Retail::V2::ProductService::Client#remove_fulfillment_places ProductService.RemoveFulfillmentPlaces} + # method. + class RemoveFulfillmentPlacesResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/promotion.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/promotion.rb new file mode 100644 index 000000000000..1b9a47b22ebd --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/promotion.rb @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Retail + module V2 + # Promotion information. + # @!attribute [rw] promotion_id + # @return [::String] + # ID of the promotion. For example, "free gift". + # + # The value must be a UTF-8 encoded string with a length limit of 128 + # characters, and match the pattern: `[a-zA-Z][a-zA-Z0-9_]*`. For example, + # id0LikeThis or ID_1_LIKE_THIS. Otherwise, an INVALID_ARGUMENT error is + # returned. + # + # Corresponds to Google Merchant Center property + # [promotion_id](https://support.google.com/merchants/answer/7050148). + class Promotion + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/purge_config.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/purge_config.rb new file mode 100644 index 000000000000..cfeb05692659 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/purge_config.rb @@ -0,0 +1,178 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Retail + module V2 + # Metadata related to the progress of the Purge operation. + # This will be returned by the google.longrunning.Operation.metadata field. + class PurgeMetadata + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Metadata related to the progress of the PurgeProducts operation. + # This will be returned by the google.longrunning.Operation.metadata field. + # @!attribute [rw] create_time + # @return [::Google::Protobuf::Timestamp] + # Operation create time. + # @!attribute [rw] update_time + # @return [::Google::Protobuf::Timestamp] + # Operation last update time. If the operation is done, this is also the + # finish time. + # @!attribute [rw] success_count + # @return [::Integer] + # Count of entries that were deleted successfully. + # @!attribute [rw] failure_count + # @return [::Integer] + # Count of entries that encountered errors while processing. + class PurgeProductsMetadata + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for PurgeProducts method. + # @!attribute [rw] parent + # @return [::String] + # Required. The resource name of the branch under which the products are + # created. The format is + # `projects/${projectId}/locations/global/catalogs/${catalogId}/branches/${branchId}` + # @!attribute [rw] filter + # @return [::String] + # Required. The filter string to specify the products to be deleted with a + # length limit of 5,000 characters. + # + # Empty string filter is not allowed. "*" implies delete all items in a + # branch. + # + # The eligible fields for filtering are: + # + # * `availability`: Double quoted + # {::Google::Cloud::Retail::V2::Product#availability Product.availability} string. + # * `create_time` : in ISO 8601 "zulu" format. + # + # Supported syntax: + # + # * Comparators (">", "<", ">=", "<=", "="). + # Examples: + # * create_time <= "2015-02-13T17:05:46Z" + # * availability = "IN_STOCK" + # + # * Conjunctions ("AND") + # Examples: + # * create_time <= "2015-02-13T17:05:46Z" AND availability = "PREORDER" + # + # * Disjunctions ("OR") + # Examples: + # * create_time <= "2015-02-13T17:05:46Z" OR availability = "IN_STOCK" + # + # * Can support nested queries. + # Examples: + # * (create_time <= "2015-02-13T17:05:46Z" AND availability = "PREORDER") + # OR (create_time >= "2015-02-14T13:03:32Z" AND availability = "IN_STOCK") + # + # * Filter Limits: + # * Filter should not contain more than 6 conditions. + # * Max nesting depth should not exceed 2 levels. + # + # Examples queries: + # * Delete back order products created before a timestamp. + # create_time <= "2015-02-13T17:05:46Z" OR availability = "BACKORDER" + # @!attribute [rw] force + # @return [::Boolean] + # Actually perform the purge. + # If `force` is set to false, the method will return the expected purge count + # without deleting any products. + class PurgeProductsRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Response of the PurgeProductsRequest. If the long running operation is + # successfully done, then this message is returned by the + # google.longrunning.Operations.response field. + # @!attribute [rw] purge_count + # @return [::Integer] + # The total count of products purged as a result of the operation. + # @!attribute [rw] purge_sample + # @return [::Array<::String>] + # A sample of the product names that will be deleted. + # Only populated if `force` is set to false. A max of 100 names will be + # returned and the names are chosen at random. + class PurgeProductsResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for PurgeUserEvents method. + # @!attribute [rw] parent + # @return [::String] + # Required. The resource name of the catalog under which the events are + # created. The format is + # `projects/${projectId}/locations/global/catalogs/${catalogId}` + # @!attribute [rw] filter + # @return [::String] + # Required. The filter string to specify the events to be deleted with a + # length limit of 5,000 characters. Empty string filter is not allowed. The + # eligible fields for filtering are: + # + # * `eventType`: Double quoted + # {::Google::Cloud::Retail::V2::UserEvent#event_type UserEvent.event_type} string. + # * `eventTime`: in ISO 8601 "zulu" format. + # * `visitorId`: Double quoted string. Specifying this will delete all + # events associated with a visitor. + # * `userId`: Double quoted string. Specifying this will delete all events + # associated with a user. + # + # Examples: + # + # * Deleting all events in a time range: + # `eventTime > "2012-04-23T18:25:43.511Z" + # eventTime < "2012-04-23T18:30:43.511Z"` + # * Deleting specific eventType in time range: + # `eventTime > "2012-04-23T18:25:43.511Z" eventType = "detail-page-view"` + # * Deleting all events for a specific visitor: + # `visitorId = "visitor1024"` + # + # The filtering fields are assumed to have an implicit AND. + # @!attribute [rw] force + # @return [::Boolean] + # Actually perform the purge. + # If `force` is set to false, the method will return the expected purge count + # without deleting any user events. + class PurgeUserEventsRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Response of the PurgeUserEventsRequest. If the long running operation is + # successfully done, then this message is returned by the + # google.longrunning.Operations.response field. + # @!attribute [rw] purged_events_count + # @return [::Integer] + # The total count of events purged as a result of the operation. + class PurgeUserEventsResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/safety.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/safety.rb new file mode 100644 index 000000000000..c4c11c6cbd93 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/safety.rb @@ -0,0 +1,96 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Retail + module V2 + # Safety settings. + # @!attribute [rw] category + # @return [::Google::Cloud::Retail::V2::HarmCategory] + # Harm category. + # @!attribute [rw] threshold + # @return [::Google::Cloud::Retail::V2::SafetySetting::HarmBlockThreshold] + # The harm block threshold. + # @!attribute [rw] method + # @return [::Google::Cloud::Retail::V2::SafetySetting::HarmBlockMethod] + # Optional. Specify if the threshold is used for probability or severity + # score. If not specified, the threshold is used for probability score. + class SafetySetting + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Probability based thresholds levels for blocking. + module HarmBlockThreshold + # Unspecified harm block threshold. + HARM_BLOCK_THRESHOLD_UNSPECIFIED = 0 + + # Block low threshold and above (i.e. block more). + BLOCK_LOW_AND_ABOVE = 1 + + # Block medium threshold and above. + BLOCK_MEDIUM_AND_ABOVE = 2 + + # Block only high threshold (i.e. block less). + BLOCK_ONLY_HIGH = 3 + + # Block none. + BLOCK_NONE = 4 + + # Turn off the safety filter. + OFF = 5 + end + + # Probability vs severity. + module HarmBlockMethod + # The harm block method is unspecified. + HARM_BLOCK_METHOD_UNSPECIFIED = 0 + + # The harm block method uses both probability and severity scores. + SEVERITY = 1 + + # The harm block method uses the probability score. + PROBABILITY = 2 + end + end + + # Harm categories that will block the content. + module HarmCategory + # The harm category is unspecified. + HARM_CATEGORY_UNSPECIFIED = 0 + + # The harm category is hate speech. + HARM_CATEGORY_HATE_SPEECH = 1 + + # The harm category is dangerous content. + HARM_CATEGORY_DANGEROUS_CONTENT = 2 + + # The harm category is harassment. + HARM_CATEGORY_HARASSMENT = 3 + + # The harm category is sexually explicit content. + HARM_CATEGORY_SEXUALLY_EXPLICIT = 4 + + # The harm category is civic integrity. + HARM_CATEGORY_CIVIC_INTEGRITY = 5 + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/search_service.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/search_service.rb new file mode 100644 index 000000000000..beb964cfdc66 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/search_service.rb @@ -0,0 +1,1301 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Retail + module V2 + # Product attribute which structured by an attribute name and value. This + # structure is used in conversational search filters and answers. For example, + # if we have `name=color` and `value=red`, this means that the color is `red`. + # @!attribute [rw] name + # @return [::String] + # The attribute name. + # @!attribute [rw] value + # @return [::String] + # The attribute value. + class ProductAttributeValue + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Product attribute name and numeric interval. + # @!attribute [rw] name + # @return [::String] + # The attribute name (e.g. "length") + # @!attribute [rw] interval + # @return [::Google::Cloud::Retail::V2::Interval] + # The numeric interval (e.g. [10, 20)) + class ProductAttributeInterval + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # This field specifies the tile information including an attribute key, + # attribute value. More fields will be added in the future, eg: product id + # or product counts, etc. + # @!attribute [rw] product_attribute_value + # @return [::Google::Cloud::Retail::V2::ProductAttributeValue] + # The product attribute key-value. + # + # Note: The following fields are mutually exclusive: `product_attribute_value`, `product_attribute_interval`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [rw] product_attribute_interval + # @return [::Google::Cloud::Retail::V2::ProductAttributeInterval] + # The product attribute key-numeric interval. + # + # Note: The following fields are mutually exclusive: `product_attribute_interval`, `product_attribute_value`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [rw] representative_product_id + # @return [::String] + # The representative product id for this tile. + class Tile + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for + # {::Google::Cloud::Retail::V2::SearchService::Client#search SearchService.Search} method. + # @!attribute [rw] placement + # @return [::String] + # Required. The resource name of the Retail Search serving config, such as + # `projects/*/locations/global/catalogs/default_catalog/servingConfigs/default_serving_config` + # or the name of the legacy placement resource, such as + # `projects/*/locations/global/catalogs/default_catalog/placements/default_search`. + # This field is used to identify the serving config name and the set + # of models that are used to make the search. + # @!attribute [rw] branch + # @return [::String] + # The branch resource name, such as + # `projects/*/locations/global/catalogs/default_catalog/branches/0`. + # + # Use "default_branch" as the branch ID or leave this field empty, to search + # products under the default branch. + # @!attribute [rw] query + # @return [::String] + # Raw search query. + # + # If this field is empty, the request is considered a category browsing + # request and returned results are based on + # {::Google::Cloud::Retail::V2::SearchRequest#filter filter} and + # {::Google::Cloud::Retail::V2::SearchRequest#page_categories page_categories}. + # @!attribute [rw] visitor_id + # @return [::String] + # Required. A unique identifier for tracking visitors. For example, this + # could be implemented with an HTTP cookie, which should be able to uniquely + # identify a visitor on a single device. This unique identifier should not + # change if the visitor logs in or out of the website. + # + # This should be the same identifier as + # {::Google::Cloud::Retail::V2::UserEvent#visitor_id UserEvent.visitor_id}. + # + # The field must be a UTF-8 encoded string with a length limit of 128 + # characters. Otherwise, an INVALID_ARGUMENT error is returned. + # @!attribute [rw] user_info + # @return [::Google::Cloud::Retail::V2::UserInfo] + # User information. + # @!attribute [rw] page_size + # @return [::Integer] + # Maximum number of {::Google::Cloud::Retail::V2::Product Product}s to return. If + # unspecified, defaults to a reasonable value. The maximum allowed value is + # 120. Values above 120 will be coerced to 120. + # + # If this field is negative, an INVALID_ARGUMENT is returned. + # @!attribute [rw] page_token + # @return [::String] + # A page token + # {::Google::Cloud::Retail::V2::SearchResponse#next_page_token SearchResponse.next_page_token}, + # received from a previous + # {::Google::Cloud::Retail::V2::SearchService::Client#search SearchService.Search} call. + # Provide this to retrieve the subsequent page. + # + # When paginating, all other parameters provided to + # {::Google::Cloud::Retail::V2::SearchService::Client#search SearchService.Search} must + # match the call that provided the page token. Otherwise, an INVALID_ARGUMENT + # error is returned. + # @!attribute [rw] offset + # @return [::Integer] + # A 0-indexed integer that specifies the current offset (that is, starting + # result location, amongst the {::Google::Cloud::Retail::V2::Product Product}s + # deemed by the API as relevant) in search results. This field is only + # considered if {::Google::Cloud::Retail::V2::SearchRequest#page_token page_token} + # is unset. + # + # If this field is negative, an INVALID_ARGUMENT is returned. + # @!attribute [rw] filter + # @return [::String] + # The filter syntax consists of an expression language for constructing a + # predicate from one or more fields of the products being filtered. Filter + # expression is case-sensitive. For more information, see + # [Filter](https://cloud.google.com/retail/docs/filter-and-order#filter). + # + # If this field is unrecognizable, an INVALID_ARGUMENT is returned. + # @!attribute [rw] canonical_filter + # @return [::String] + # The default filter that is applied when a user performs a search without + # checking any filters on the search page. + # + # The filter applied to every search request when quality improvement such as + # query expansion is needed. In the case a query does not have a sufficient + # amount of results this filter will be used to determine whether or not to + # enable the query expansion flow. The original filter will still be used for + # the query expanded search. + # This field is strongly recommended to achieve high search quality. + # + # For more information about filter syntax, see + # {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}. + # @!attribute [rw] order_by + # @return [::String] + # The order in which products are returned. Products can be ordered by + # a field in an {::Google::Cloud::Retail::V2::Product Product} object. Leave it + # unset if ordered by relevance. OrderBy expression is case-sensitive. For + # more information, see + # [Order](https://cloud.google.com/retail/docs/filter-and-order#order). + # + # If this field is unrecognizable, an INVALID_ARGUMENT is returned. + # @!attribute [rw] facet_specs + # @return [::Array<::Google::Cloud::Retail::V2::SearchRequest::FacetSpec>] + # Facet specifications for faceted search. If empty, no facets are returned. + # + # A maximum of 200 values are allowed. Otherwise, an INVALID_ARGUMENT error + # is returned. + # @!attribute [rw] dynamic_facet_spec + # @deprecated This field is deprecated and may be removed in the next major version update. + # @return [::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec] + # Deprecated. Refer to https://cloud.google.com/retail/docs/configs#dynamic + # to enable dynamic facets. Do not set this field. + # + # The specification for dynamically generated facets. Notice that only + # textual facets can be dynamically generated. + # @!attribute [rw] boost_spec + # @return [::Google::Cloud::Retail::V2::SearchRequest::BoostSpec] + # Boost specification to boost certain products. For more information, see + # [Boost results](https://cloud.google.com/retail/docs/boosting). + # + # Notice that if both + # {::Google::Cloud::Retail::V2::ServingConfig#boost_control_ids ServingConfig.boost_control_ids} + # and + # {::Google::Cloud::Retail::V2::SearchRequest#boost_spec SearchRequest.boost_spec} + # are set, the boost conditions from both places are evaluated. If a search + # request matches multiple boost conditions, the final boost score is equal + # to the sum of the boost scores from all matched boost conditions. + # @!attribute [rw] query_expansion_spec + # @return [::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec] + # The query expansion specification that specifies the conditions under which + # query expansion occurs. For more information, see [Query + # expansion](https://cloud.google.com/retail/docs/result-size#query_expansion). + # @!attribute [rw] variant_rollup_keys + # @return [::Array<::String>] + # The keys to fetch and rollup the matching + # {::Google::Cloud::Retail::V2::Product::Type::VARIANT variant} + # {::Google::Cloud::Retail::V2::Product Product}s attributes, + # {::Google::Cloud::Retail::V2::FulfillmentInfo FulfillmentInfo} or + # {::Google::Cloud::Retail::V2::LocalInventory LocalInventory}s attributes. The + # attributes from all the matching + # {::Google::Cloud::Retail::V2::Product::Type::VARIANT variant} + # {::Google::Cloud::Retail::V2::Product Product}s or + # {::Google::Cloud::Retail::V2::LocalInventory LocalInventory}s are merged and + # de-duplicated. Notice that rollup attributes will lead to extra query + # latency. Maximum number of keys is 30. + # + # For {::Google::Cloud::Retail::V2::FulfillmentInfo FulfillmentInfo}, a + # fulfillment type and a fulfillment ID must be provided in the format of + # "fulfillmentType.fulfillmentId". E.g., in "pickupInStore.store123", + # "pickupInStore" is fulfillment type and "store123" is the store ID. + # + # Supported keys are: + # + # * colorFamilies + # * price + # * originalPrice + # * discount + # * variantId + # * inventory(place_id,price) + # * inventory(place_id,original_price) + # * inventory(place_id,attributes.key), where key is any key in the + # {::Google::Cloud::Retail::V2::LocalInventory#attributes Product.local_inventories.attributes} + # map. + # * attributes.key, where key is any key in the + # {::Google::Cloud::Retail::V2::Product#attributes Product.attributes} map. + # * pickupInStore.id, where id is any + # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} + # for {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type} + # "pickup-in-store". + # * shipToStore.id, where id is any + # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} + # for {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type} + # "ship-to-store". + # * sameDayDelivery.id, where id is any + # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} + # for {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type} + # "same-day-delivery". + # * nextDayDelivery.id, where id is any + # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} + # for {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type} + # "next-day-delivery". + # * customFulfillment1.id, where id is any + # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} + # for {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type} + # "custom-type-1". + # * customFulfillment2.id, where id is any + # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} + # for {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type} + # "custom-type-2". + # * customFulfillment3.id, where id is any + # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} + # for {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type} + # "custom-type-3". + # * customFulfillment4.id, where id is any + # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} + # for {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type} + # "custom-type-4". + # * customFulfillment5.id, where id is any + # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} + # for {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type} + # "custom-type-5". + # + # If this field is set to an invalid value other than these, an + # INVALID_ARGUMENT error is returned. + # @!attribute [rw] page_categories + # @return [::Array<::String>] + # The categories associated with a category page. Must be set for category + # navigation queries to achieve good search quality. The format should be + # the same as + # {::Google::Cloud::Retail::V2::UserEvent#page_categories UserEvent.page_categories}; + # + # To represent full path of category, use '>' sign to separate different + # hierarchies. If '>' is part of the category name, replace it with + # other character(s). + # + # Category pages include special pages such as sales or promotions. For + # instance, a special sale page may have the category hierarchy: + # "pageCategories" : ["Sales > 2017 Black Friday Deals"]. + # @!attribute [rw] search_mode + # @return [::Google::Cloud::Retail::V2::SearchRequest::SearchMode] + # The search mode of the search request. If not specified, a single search + # request triggers both product search and faceted search. + # @!attribute [rw] personalization_spec + # @return [::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec] + # The specification for personalization. + # + # Notice that if both + # {::Google::Cloud::Retail::V2::ServingConfig#personalization_spec ServingConfig.personalization_spec} + # and + # {::Google::Cloud::Retail::V2::SearchRequest#personalization_spec SearchRequest.personalization_spec} + # are set. + # {::Google::Cloud::Retail::V2::SearchRequest#personalization_spec SearchRequest.personalization_spec} + # will override + # {::Google::Cloud::Retail::V2::ServingConfig#personalization_spec ServingConfig.personalization_spec}. + # @!attribute [rw] labels + # @return [::Google::Protobuf::Map{::String => ::String}] + # The labels applied to a resource must meet the following requirements: + # + # * Each resource can have multiple labels, up to a maximum of 64. + # * Each label must be a key-value pair. + # * Keys have a minimum length of 1 character and a maximum length of 63 + # characters and cannot be empty. Values can be empty and have a maximum + # length of 63 characters. + # * Keys and values can contain only lowercase letters, numeric characters, + # underscores, and dashes. All characters must use UTF-8 encoding, and + # international characters are allowed. + # * The key portion of a label must be unique. However, you can use the same + # key with multiple resources. + # * Keys must start with a lowercase letter or international character. + # + # For more information, see [Requirements for + # labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + # in the Resource Manager documentation. + # @!attribute [rw] spell_correction_spec + # @return [::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec] + # The spell correction specification that specifies the mode under + # which spell correction will take effect. + # @!attribute [rw] entity + # @return [::String] + # The entity for customers that may run multiple different entities, domains, + # sites or regions, for example, `Google US`, `Google Ads`, `Waymo`, + # `google.com`, `youtube.com`, etc. + # If this is set, it should be exactly matched with + # {::Google::Cloud::Retail::V2::UserEvent#entity UserEvent.entity} to get search + # results boosted by entity. + # @!attribute [rw] conversational_search_spec + # @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec] + # Optional. This field specifies all conversational related parameters + # addition to traditional retail search. + # @!attribute [rw] tile_navigation_spec + # @return [::Google::Cloud::Retail::V2::SearchRequest::TileNavigationSpec] + # Optional. This field specifies tile navigation related parameters. + # @!attribute [rw] language_code + # @return [::String] + # Optional. The BCP-47 language code, such as "en-US" or "sr-Latn" + # [list](https://www.unicode.org/cldr/charts/46/summary/root.html). For more + # information, see [Standardized codes](https://google.aip.dev/143). This + # field helps to better interpret the query. If a value isn't specified, the + # query language code is automatically detected, which may not be accurate. + # @!attribute [rw] region_code + # @return [::String] + # Optional. The Unicode country/region code (CLDR) of a location, such as + # "US" and "419" + # [list](https://www.unicode.org/cldr/charts/46/supplemental/territory_information.html). + # For more information, see [Standardized codes](https://google.aip.dev/143). + # If set, then results will be boosted based on the region_code provided. + # @!attribute [rw] place_id + # @return [::String] + # Optional. An id corresponding to a place, such as a store id or region id. + # When specified, we use the price from the local inventory with the matching + # product's + # {::Google::Cloud::Retail::V2::LocalInventory#place_id LocalInventory.place_id} + # for revenue optimization. + # @!attribute [rw] user_attributes + # @return [::Google::Protobuf::Map{::String => ::Google::Cloud::Retail::V2::StringList}] + # Optional. The user attributes that could be used for personalization of + # search results. + # * Populate at most 100 key-value pairs per query. + # * Only supports string keys and repeated string values. + # * Duplcate keys are not allowed within a single query. + # + # Example: + # user_attributes: [ + # { key: "pets" + # value { + # values: "dog" + # values: "cat" + # } + # }, + # { key: "state" + # value { + # values: "CA" + # } + # } + # ] + class SearchRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # A facet specification to perform faceted search. + # @!attribute [rw] facet_key + # @return [::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey] + # Required. The facet key specification. + # @!attribute [rw] limit + # @return [::Integer] + # Maximum of facet values that should be returned for this facet. If + # unspecified, defaults to 50. The maximum allowed value is 300. Values + # above 300 will be coerced to 300. + # + # If this field is negative, an INVALID_ARGUMENT is returned. + # @!attribute [rw] excluded_filter_keys + # @return [::Array<::String>] + # List of keys to exclude when faceting. + # + # By default, + # {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key FacetKey.key} + # is not excluded from the filter unless it is listed in this field. + # + # Listing a facet key in this field allows its values to appear as facet + # results, even when they are filtered out of search results. Using this + # field does not affect what search results are returned. + # + # For example, suppose there are 100 products with the color facet "Red" + # and 200 products with the color facet "Blue". A query containing the + # filter "colorFamilies:ANY("Red")" and having "colorFamilies" as + # {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key FacetKey.key} + # would by default return only "Red" products in the search results, and + # also return "Red" with count 100 as the only color facet. Although there + # are also blue products available, "Blue" would not be shown as an + # available facet value. + # + # If "colorFamilies" is listed in "excludedFilterKeys", then the query + # returns the facet values "Red" with count 100 and "Blue" with count + # 200, because the "colorFamilies" key is now excluded from the filter. + # Because this field doesn't affect search results, the search results + # are still correctly filtered to return only "Red" products. + # + # A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error + # is returned. + # @!attribute [rw] enable_dynamic_position + # @return [::Boolean] + # Enables dynamic position for this facet. If set to true, the position of + # this facet among all facets in the response is determined by Google + # Retail Search. It is ordered together with dynamic facets if dynamic + # facets is enabled. If set to false, the position of this facet in the + # response is the same as in the request, and it is ranked before + # the facets with dynamic position enable and all dynamic facets. + # + # For example, you may always want to have rating facet returned in + # the response, but it's not necessarily to always display the rating facet + # at the top. In that case, you can set enable_dynamic_position to true so + # that the position of rating facet in response is determined by + # Google Retail Search. + # + # Another example, assuming you have the following facets in the request: + # + # * "rating", enable_dynamic_position = true + # + # * "price", enable_dynamic_position = false + # + # * "brands", enable_dynamic_position = false + # + # And also you have a dynamic facets enable, which generates a facet + # "gender". Then, the final order of the facets in the response can be + # ("price", "brands", "rating", "gender") or ("price", "brands", "gender", + # "rating") depends on how Google Retail Search orders "gender" and + # "rating" facets. However, notice that "price" and "brands" are always + # ranked at first and second position because their enable_dynamic_position + # values are false. + class FacetSpec + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Specifies how a facet is computed. + # @!attribute [rw] key + # @return [::String] + # Required. Supported textual and numerical facet keys in + # {::Google::Cloud::Retail::V2::Product Product} object, over which the facet + # values are computed. Facet key is case-sensitive. + # + # Allowed facet keys when + # {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#query FacetKey.query} + # is not specified: + # + # * textual_field = + # * "brands" + # * "categories" + # * "genders" + # * "ageGroups" + # * "availability" + # * "colorFamilies" + # * "colors" + # * "sizes" + # * "materials" + # * "patterns" + # * "conditions" + # * "attributes.key" + # * "pickupInStore" + # * "shipToStore" + # * "sameDayDelivery" + # * "nextDayDelivery" + # * "customFulfillment1" + # * "customFulfillment2" + # * "customFulfillment3" + # * "customFulfillment4" + # * "customFulfillment5" + # * "inventory(place_id,attributes.key)" + # + # * numerical_field = + # * "price" + # * "discount" + # * "rating" + # * "ratingCount" + # * "attributes.key" + # * "inventory(place_id,price)" + # * "inventory(place_id,original_price)" + # * "inventory(place_id,attributes.key)" + # @!attribute [rw] intervals + # @return [::Array<::Google::Cloud::Retail::V2::Interval>] + # Set only if values should be bucketized into intervals. Must be set + # for facets with numerical values. Must not be set for facet with text + # values. Maximum number of intervals is 40. + # + # For all numerical facet keys that appear in the list of products from + # the catalog, the percentiles 0, 10, 30, 50, 70, 90, and 100 are + # computed from their distribution weekly. If the model assigns a high + # score to a numerical facet key and its intervals are not specified in + # the search request, these percentiles become the bounds + # for its intervals and are returned in the response. If the + # facet key intervals are specified in the request, then the specified + # intervals are returned instead. + # @!attribute [rw] restricted_values + # @return [::Array<::String>] + # Only get facet for the given restricted values. For example, when using + # "pickupInStore" as key and set restricted values to + # ["store123", "store456"], only facets for "store123" and "store456" are + # returned. Only supported on predefined textual fields, custom textual + # attributes and fulfillments. Maximum is 20. + # + # Must be set for the fulfillment facet keys: + # + # * pickupInStore + # + # * shipToStore + # + # * sameDayDelivery + # + # * nextDayDelivery + # + # * customFulfillment1 + # + # * customFulfillment2 + # + # * customFulfillment3 + # + # * customFulfillment4 + # + # * customFulfillment5 + # @!attribute [rw] prefixes + # @return [::Array<::String>] + # Only get facet values that start with the given string prefix. For + # example, suppose "categories" has three values "Women > Shoe", + # "Women > Dress" and "Men > Shoe". If set "prefixes" to "Women", the + # "categories" facet gives only "Women > Shoe" and "Women > Dress". + # Only supported on textual fields. Maximum is 10. + # @!attribute [rw] contains + # @return [::Array<::String>] + # Only get facet values that contains the given strings. For example, + # suppose "categories" has three values "Women > Shoe", + # "Women > Dress" and "Men > Shoe". If set "contains" to "Shoe", the + # "categories" facet gives only "Women > Shoe" and "Men > Shoe". + # Only supported on textual fields. Maximum is 10. + # @!attribute [rw] case_insensitive + # @return [::Boolean] + # True to make facet keys case insensitive when getting faceting + # values with prefixes or contains; false otherwise. + # @!attribute [rw] order_by + # @return [::String] + # The order in which + # {::Google::Cloud::Retail::V2::SearchResponse::Facet#values SearchResponse.Facet.values} + # are returned. + # + # Allowed values are: + # + # * "count desc", which means order by + # {::Google::Cloud::Retail::V2::SearchResponse::Facet::FacetValue#count SearchResponse.Facet.values.count} + # descending. + # + # * "value desc", which means order by + # {::Google::Cloud::Retail::V2::SearchResponse::Facet::FacetValue#value SearchResponse.Facet.values.value} + # descending. + # Only applies to textual facets. + # + # If not set, textual values are sorted in [natural + # order](https://en.wikipedia.org/wiki/Natural_sort_order); numerical + # intervals are sorted in the order given by + # {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#intervals FacetSpec.FacetKey.intervals}; + # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} + # are sorted in the order given by + # {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#restricted_values FacetSpec.FacetKey.restricted_values}. + # @!attribute [rw] query + # @return [::String] + # The query that is used to compute facet for the given facet key. + # When provided, it overrides the default behavior of facet + # computation. The query syntax is the same as a filter expression. See + # {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter} for + # detail syntax and limitations. Notice that there is no limitation on + # {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key FacetKey.key} + # when query is specified. + # + # In the response, + # {::Google::Cloud::Retail::V2::SearchResponse::Facet::FacetValue#value SearchResponse.Facet.values.value} + # is always "1" and + # {::Google::Cloud::Retail::V2::SearchResponse::Facet::FacetValue#count SearchResponse.Facet.values.count} + # is the number of results that match the query. + # + # For example, you can set a customized facet for "shipToStore", + # where + # {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key FacetKey.key} + # is "customizedShipToStore", and + # {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#query FacetKey.query} + # is "availability: ANY(\"IN_STOCK\") AND shipToStore: ANY(\"123\")". + # Then the facet counts the products that are both in stock and ship + # to store "123". + # @!attribute [rw] return_min_max + # @return [::Boolean] + # Returns the min and max value for each numerical facet intervals. + # Ignored for textual facets. + class FacetKey + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # The specifications of dynamically generated facets. + # @!attribute [rw] mode + # @return [::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode] + # Mode of the DynamicFacet feature. + # Defaults to + # {::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode::DISABLED Mode.DISABLED} + # if it's unset. + class DynamicFacetSpec + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Enum to control DynamicFacet mode + module Mode + # Default value. + MODE_UNSPECIFIED = 0 + + # Disable Dynamic Facet. + DISABLED = 1 + + # Automatic mode built by Google Retail Search. + ENABLED = 2 + end + end + + # Boost specification to boost certain items. + # @!attribute [rw] condition_boost_specs + # @return [::Array<::Google::Cloud::Retail::V2::SearchRequest::BoostSpec::ConditionBoostSpec>] + # Condition boost specifications. If a product matches multiple conditions + # in the specifications, boost scores from these specifications are all + # applied and combined in a non-linear way. Maximum number of + # specifications is 20. + # @!attribute [rw] skip_boost_spec_validation + # @return [::Boolean] + # Whether to skip boostspec validation. If this field is set to true, + # invalid + # {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs} + # will be ignored and valid + # {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs} + # will still be applied. + class BoostSpec + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Boost applies to products which match a condition. + # @!attribute [rw] condition + # @return [::String] + # An expression which specifies a boost condition. The syntax and + # supported fields are the same as a filter expression. See + # {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter} for + # detail syntax and limitations. + # + # Examples: + # + # * To boost products with product ID "product_1" or "product_2", and + # color + # "Red" or "Blue": + # * (id: ANY("product_1", "product_2")) AND (colorFamilies: + # ANY("Red","Blue")) + # @!attribute [rw] boost + # @return [::Float] + # Strength of the condition boost, which should be in [-1, 1]. Negative + # boost means demotion. Default is 0.0. + # + # Setting to 1.0 gives the item a big promotion. However, it does not + # necessarily mean that the boosted item will be the top result at all + # times, nor that other items will be excluded. Results could still be + # shown even when none of them matches the condition. And results that + # are significantly more relevant to the search query can still trump + # your heavily favored but irrelevant items. + # + # Setting to -1.0 gives the item a big demotion. However, results that + # are deeply relevant might still be shown. The item will have an + # upstream battle to get a fairly high ranking, but it is not blocked out + # completely. + # + # Setting to 0.0 means no boost applied. The boosting condition is + # ignored. + class ConditionBoostSpec + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # Specification to determine under which conditions query expansion should + # occur. + # @!attribute [rw] condition + # @return [::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition] + # The condition under which query expansion should occur. Default to + # {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}. + # @!attribute [rw] pin_unexpanded_results + # @return [::Boolean] + # Whether to pin unexpanded results. The default value is false. If this + # field is set to true, + # unexpanded products are always at the top of the search results, followed + # by the expanded results. + class QueryExpansionSpec + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Enum describing under which condition query expansion should occur. + module Condition + # Unspecified query expansion condition. In this case, server behavior + # defaults to + # {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}. + CONDITION_UNSPECIFIED = 0 + + # Disabled query expansion. Only the exact search query is used, even if + # {::Google::Cloud::Retail::V2::SearchResponse#total_size SearchResponse.total_size} + # is zero. + DISABLED = 1 + + # Automatic query expansion built by Google Retail Search. + AUTO = 3 + end + end + + # The specification for personalization. + # @!attribute [rw] mode + # @return [::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode] + # Defaults to + # {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}. + class PersonalizationSpec + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # The personalization mode of each search request. + module Mode + # Default value. In this case, server behavior defaults to + # {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}. + MODE_UNSPECIFIED = 0 + + # Let CRS decide whether to use personalization based on quality of user + # event data. + AUTO = 1 + + # Disable personalization. + DISABLED = 2 + end + end + + # The specification for query spell correction. + # @!attribute [rw] mode + # @return [::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode] + # The mode under which spell correction should take effect to + # replace the original search query. Default to + # {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}. + class SpellCorrectionSpec + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Enum describing under which mode spell correction should occur. + module Mode + # Unspecified spell correction mode. In this case, server behavior + # defaults to + # {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}. + MODE_UNSPECIFIED = 0 + + # Google Retail Search will try to find a spell suggestion if there + # is any and put in the + # {::Google::Cloud::Retail::V2::SearchResponse#corrected_query SearchResponse.corrected_query}. + # The spell suggestion will not be used as the search query. + SUGGESTION_ONLY = 1 + + # Automatic spell correction built by Google Retail Search. Search will + # be based on the corrected query if found. + AUTO = 2 + end + end + + # This field specifies all conversational related parameters addition to + # traditional retail search. + # @!attribute [rw] followup_conversation_requested + # @return [::Boolean] + # This field specifies whether the customer would like to do conversational + # search. If this field is set to true, conversational related extra + # information will be returned from server side, including follow-up + # question, answer options, etc. + # @!attribute [rw] conversation_id + # @return [::String] + # This field specifies the conversation id, which maintains the state of + # the conversation between client side and server side. Use the value from + # the previous [ConversationalSearchResult.conversation_id][]. For the + # initial request, this should be empty. + # @!attribute [rw] user_answer + # @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer] + # This field specifies the current user answer during the conversational + # search. This can be either user selected from suggested answers or user + # input plain text. + class ConversationalSearchSpec + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # This field specifies the current user answer during the conversational + # search. This can be either user selected from suggested answers or user + # input plain text. + # @!attribute [rw] text_answer + # @return [::String] + # This field specifies the incremental input text from the user during + # the conversational search. + # + # Note: The following fields are mutually exclusive: `text_answer`, `selected_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [rw] selected_answer + # @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer::SelectedAnswer] + # This field specifies the selected attributes during the + # conversational search. This should be a subset of + # [ConversationalSearchResult.suggested_answers][]. + # + # Note: The following fields are mutually exclusive: `selected_answer`, `text_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared. + class UserAnswer + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # This field specifies the selected answers during the conversational + # search. + # @!attribute [rw] product_attribute_values + # @deprecated This field is deprecated and may be removed in the next major version update. + # @return [::Array<::Google::Cloud::Retail::V2::ProductAttributeValue>] + # This field is deprecated and should not be set. + # @!attribute [rw] product_attribute_value + # @return [::Google::Cloud::Retail::V2::ProductAttributeValue] + # This field specifies the selected answer which is a attribute + # key-value. + class SelectedAnswer + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + end + + # This field specifies tile navigation related parameters. + # @!attribute [rw] tile_navigation_requested + # @return [::Boolean] + # This field specifies whether the customer would like to request tile + # navigation. + # @!attribute [rw] applied_tiles + # @return [::Array<::Google::Cloud::Retail::V2::Tile>] + # This optional field specifies the tiles which are already clicked in + # client side. While the feature works without this field set, particularly + # for an initial query, it is highly recommended to set this field because + # it can improve the quality of the search response and removes possible + # duplicate tiles. + # + # NOTE: This field is not being used for filtering search + # products. Client side should also put all the applied tiles in + # {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}. + class TileNavigationSpec + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # @!attribute [rw] key + # @return [::String] + # @!attribute [rw] value + # @return [::String] + class LabelsEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # @!attribute [rw] key + # @return [::String] + # @!attribute [rw] value + # @return [::Google::Cloud::Retail::V2::StringList] + class UserAttributesEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The search mode of each search request. + module SearchMode + # Default value. In this case both product search and faceted search will + # be performed. Both + # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult} + # and {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} + # will be returned. + SEARCH_MODE_UNSPECIFIED = 0 + + # Only product search will be performed. The faceted search will be + # disabled. + # + # Only + # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult} + # will be returned. + # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will + # not be returned, even if + # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs} + # or + # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec} + # is set. + PRODUCT_SEARCH_ONLY = 1 + + # Only faceted search will be performed. The product search will be + # disabled. + # + # When in this mode, one or both of + # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs} + # and + # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec} + # should be set. Otherwise, an INVALID_ARGUMENT error is returned. Only + # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will + # be returned. + # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult} + # will not be returned. + FACETED_SEARCH_ONLY = 2 + end + end + + # Response message for + # {::Google::Cloud::Retail::V2::SearchService::Client#search SearchService.Search} method. + # @!attribute [rw] results + # @return [::Array<::Google::Cloud::Retail::V2::SearchResponse::SearchResult>] + # A list of matched items. The order represents the ranking. + # @!attribute [rw] facets + # @return [::Array<::Google::Cloud::Retail::V2::SearchResponse::Facet>] + # Results of facets requested by user. + # @!attribute [rw] total_size + # @return [::Integer] + # The estimated total count of matched items irrespective of pagination. The + # count of {::Google::Cloud::Retail::V2::SearchResponse#results results} returned + # by pagination may be less than the + # {::Google::Cloud::Retail::V2::SearchResponse#total_size total_size} that + # matches. + # @!attribute [rw] corrected_query + # @return [::String] + # Contains the spell corrected query, if found. If the spell correction type + # is AUTOMATIC, then the search results are based on corrected_query. + # Otherwise the original query is used for search. + # @!attribute [rw] attribution_token + # @return [::String] + # A unique search token. This should be included in the + # {::Google::Cloud::Retail::V2::UserEvent UserEvent} logs resulting from this + # search, which enables accurate attribution of search model performance. + # @!attribute [rw] next_page_token + # @return [::String] + # A token that can be sent as + # {::Google::Cloud::Retail::V2::SearchRequest#page_token SearchRequest.page_token} + # to retrieve the next page. If this field is omitted, there are no + # subsequent pages. + # @!attribute [rw] query_expansion_info + # @return [::Google::Cloud::Retail::V2::SearchResponse::QueryExpansionInfo] + # Query expansion information for the returned results. + # @!attribute [rw] redirect_uri + # @return [::String] + # The URI of a customer-defined redirect page. If redirect action is + # triggered, no search is performed, and only + # {::Google::Cloud::Retail::V2::SearchResponse#redirect_uri redirect_uri} and + # {::Google::Cloud::Retail::V2::SearchResponse#attribution_token attribution_token} + # are set in the response. + # @!attribute [rw] applied_controls + # @return [::Array<::String>] + # The fully qualified resource name of applied + # [controls](https://cloud.google.com/retail/docs/serving-control-rules). + # @!attribute [rw] pin_control_metadata + # @return [::Google::Cloud::Retail::V2::PinControlMetadata] + # Metadata for pin controls which were applicable to the request. + # This contains two map fields, one for all matched pins and one for pins + # which were matched but not applied. + # + # The two maps are keyed by pin position, and the values are the product ids + # which were matched to that pin. + # @!attribute [rw] invalid_condition_boost_specs + # @return [::Array<::Google::Cloud::Retail::V2::SearchRequest::BoostSpec::ConditionBoostSpec>] + # The invalid + # {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs SearchRequest.BoostSpec.condition_boost_specs} + # that are not applied during serving. + # @!attribute [rw] experiment_info + # @return [::Array<::Google::Cloud::Retail::V2::ExperimentInfo>] + # Metadata related to A/B testing experiment associated with this + # response. Only exists when an experiment is triggered. + # @!attribute [rw] conversational_search_result + # @return [::Google::Cloud::Retail::V2::SearchResponse::ConversationalSearchResult] + # This field specifies all related information that is needed on client + # side for UI rendering of conversational retail search. + # @!attribute [rw] tile_navigation_result + # @return [::Google::Cloud::Retail::V2::SearchResponse::TileNavigationResult] + # This field specifies all related information for tile navigation that will + # be used in client side. + class SearchResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Represents the search results. + # @!attribute [rw] id + # @return [::String] + # {::Google::Cloud::Retail::V2::Product#id Product.id} of the searched + # {::Google::Cloud::Retail::V2::Product Product}. + # @!attribute [rw] product + # @return [::Google::Cloud::Retail::V2::Product] + # The product data snippet in the search response. Only + # {::Google::Cloud::Retail::V2::Product#name Product.name} is guaranteed to be + # populated. + # + # {::Google::Cloud::Retail::V2::Product#variants Product.variants} contains the + # product variants that match the search query. If there are multiple + # product variants matching the query, top 5 most relevant product variants + # are returned and ordered by relevancy. + # + # If relevancy can be deternmined, use + # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult#matching_variant_fields matching_variant_fields} + # to look up matched product variants fields. If relevancy cannot be + # determined, e.g. when searching "shoe" all products in a shoe product can + # be a match, 5 product variants are returned but order is meaningless. + # @!attribute [rw] matching_variant_count + # @return [::Integer] + # The count of matched + # {::Google::Cloud::Retail::V2::Product::Type::VARIANT variant} + # {::Google::Cloud::Retail::V2::Product Product}s. + # @!attribute [rw] matching_variant_fields + # @return [::Google::Protobuf::Map{::String => ::Google::Protobuf::FieldMask}] + # If a {::Google::Cloud::Retail::V2::Product::Type::VARIANT variant} + # {::Google::Cloud::Retail::V2::Product Product} matches the search query, this + # map indicates which {::Google::Cloud::Retail::V2::Product Product} fields are + # matched. The key is the + # {::Google::Cloud::Retail::V2::Product#name Product.name}, the value is a field + # mask of the matched {::Google::Cloud::Retail::V2::Product Product} fields. If + # matched attributes cannot be determined, this map will be empty. + # + # For example, a key "sku1" with field mask + # "products.color_info" indicates there is a match between + # "sku1" {::Google::Cloud::Retail::V2::ColorInfo ColorInfo} and the query. + # @!attribute [rw] variant_rollup_values + # @return [::Google::Protobuf::Map{::String => ::Google::Protobuf::Value}] + # The rollup matching + # {::Google::Cloud::Retail::V2::Product::Type::VARIANT variant} + # {::Google::Cloud::Retail::V2::Product Product} attributes. The key is one of + # the + # {::Google::Cloud::Retail::V2::SearchRequest#variant_rollup_keys SearchRequest.variant_rollup_keys}. + # The values are the merged and de-duplicated + # {::Google::Cloud::Retail::V2::Product Product} attributes. Notice that the + # rollup values are respect filter. For example, when filtering by + # "colorFamilies:ANY(\"red\")" and rollup "colorFamilies", only "red" is + # returned. + # + # For textual and numerical attributes, the rollup values is a list of + # string or double values with type + # {::Google::Protobuf::ListValue google.protobuf.ListValue}. For example, if + # there are two variants with colors "red" and "blue", the rollup values + # are + # + # { key: "colorFamilies" + # value { + # list_value { + # values { string_value: "red" } + # values { string_value: "blue" } + # } + # } + # } + # + # For {::Google::Cloud::Retail::V2::FulfillmentInfo FulfillmentInfo}, the rollup + # values is a double value with type + # {::Google::Protobuf::Value google.protobuf.Value}. For example, + # `{key: "pickupInStore.store1" value { number_value: 10 }}` means a there + # are 10 variants in this product are available in the store "store1". + # @!attribute [rw] personal_labels + # @return [::Array<::String>] + # Specifies previous events related to this product for this user based on + # {::Google::Cloud::Retail::V2::UserEvent UserEvent} with same + # {::Google::Cloud::Retail::V2::SearchRequest#visitor_id SearchRequest.visitor_id} + # or {::Google::Cloud::Retail::V2::UserInfo#user_id UserInfo.user_id}. + # + # This is set only when + # {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec#mode SearchRequest.PersonalizationSpec.mode} + # is + # {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO SearchRequest.PersonalizationSpec.Mode.AUTO}. + # + # Possible values: + # + # * `purchased`: Indicates that this product has been purchased before. + # @!attribute [rw] model_scores + # @return [::Google::Protobuf::Map{::String => ::Google::Cloud::Retail::V2::DoubleList}] + # Google provided available scores. + class SearchResult + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # @!attribute [rw] key + # @return [::String] + # @!attribute [rw] value + # @return [::Google::Protobuf::FieldMask] + class MatchingVariantFieldsEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # @!attribute [rw] key + # @return [::String] + # @!attribute [rw] value + # @return [::Google::Protobuf::Value] + class VariantRollupValuesEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # @!attribute [rw] key + # @return [::String] + # @!attribute [rw] value + # @return [::Google::Cloud::Retail::V2::DoubleList] + class ModelScoresEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # A facet result. + # @!attribute [rw] key + # @return [::String] + # The key for this facet. E.g., "colorFamilies" or "price" or + # "attributes.attr1". + # @!attribute [rw] values + # @return [::Array<::Google::Cloud::Retail::V2::SearchResponse::Facet::FacetValue>] + # The facet values for this field. + # @!attribute [rw] dynamic_facet + # @return [::Boolean] + # Whether the facet is dynamically generated. + class Facet + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # A facet value which contains value names and their count. + # @!attribute [rw] value + # @return [::String] + # Text value of a facet, such as "Black" for facet "colorFamilies". + # + # Note: The following fields are mutually exclusive: `value`, `interval`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [rw] interval + # @return [::Google::Cloud::Retail::V2::Interval] + # Interval value for a facet, such as [10, 20) for facet "price". + # + # Note: The following fields are mutually exclusive: `interval`, `value`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [rw] count + # @return [::Integer] + # Number of items that have this facet value. + # @!attribute [rw] min_value + # @return [::Float] + # The minimum value in the + # {::Google::Cloud::Retail::V2::SearchResponse::Facet::FacetValue#interval FacetValue.interval}. + # Only supported on numerical facets and returned if + # {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#return_min_max SearchRequest.FacetSpec.FacetKey.return_min_max} + # is true. + # @!attribute [rw] max_value + # @return [::Float] + # The maximum value in the + # {::Google::Cloud::Retail::V2::SearchResponse::Facet::FacetValue#interval FacetValue.interval}. + # Only supported on numerical facets and returned if + # {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#return_min_max SearchRequest.FacetSpec.FacetKey.return_min_max} + # is true. + class FacetValue + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # Information describing query expansion including whether expansion has + # occurred. + # @!attribute [rw] expanded_query + # @return [::Boolean] + # Bool describing whether query expansion has occurred. + # @!attribute [rw] pinned_result_count + # @return [::Integer] + # Number of pinned results. This field will only be set when expansion + # happens and + # {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec#pin_unexpanded_results SearchRequest.QueryExpansionSpec.pin_unexpanded_results} + # is set to true. + class QueryExpansionInfo + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # This field specifies all related information that is needed on client + # side for UI rendering of conversational retail search. + # @!attribute [rw] conversation_id + # @return [::String] + # Conversation UUID. This field will be stored in client side storage to + # maintain the conversation session with server and will be used for next + # search request's + # {::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec#conversation_id SearchRequest.ConversationalSearchSpec.conversation_id} + # to restore conversation state in server. + # @!attribute [rw] refined_query + # @return [::String] + # The current refined query for the conversational search. This field + # will be used in customer UI that the query in the search bar should be + # replaced with the refined query. For example, if + # {::Google::Cloud::Retail::V2::SearchRequest#query SearchRequest.query} is + # `dress` and next + # {::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer#text_answer SearchRequest.ConversationalSearchSpec.UserAnswer.text_answer} + # is `red color`, which does not match any product attribute value filters, + # the refined query will be `dress, red color`. + # @!attribute [rw] additional_filters + # @deprecated This field is deprecated and may be removed in the next major version update. + # @return [::Array<::Google::Cloud::Retail::V2::SearchResponse::ConversationalSearchResult::AdditionalFilter>] + # This field is deprecated but will be kept for backward compatibility. + # There is expected to have only one additional filter and the value will + # be the same to the same as field `additional_filter`. + # @!attribute [rw] followup_question + # @return [::String] + # The follow-up question. e.g., `What is the color?` + # @!attribute [rw] suggested_answers + # @return [::Array<::Google::Cloud::Retail::V2::SearchResponse::ConversationalSearchResult::SuggestedAnswer>] + # The answer options provided to client for the follow-up question. + # @!attribute [rw] additional_filter + # @return [::Google::Cloud::Retail::V2::SearchResponse::ConversationalSearchResult::AdditionalFilter] + # This is the incremental additional filters implied from the current + # user answer. User should add the suggested addition filters to the + # previous + # {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}, and + # use the merged filter in the follow up search request. + class ConversationalSearchResult + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Suggested answers to the follow-up question. + # @!attribute [rw] product_attribute_value + # @return [::Google::Cloud::Retail::V2::ProductAttributeValue] + # Product attribute value, including an attribute key and an + # attribute value. Other types can be added here in the future. + class SuggestedAnswer + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Additional filter that client side need to apply. + # @!attribute [rw] product_attribute_value + # @return [::Google::Cloud::Retail::V2::ProductAttributeValue] + # Product attribute value, including an attribute key and an + # attribute value. Other types can be added here in the future. + class AdditionalFilter + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # This field specifies all related information for tile navigation that will + # be used in client side. + # @!attribute [rw] tiles + # @return [::Array<::Google::Cloud::Retail::V2::Tile>] + # The current tiles that are used for tile navigation, sorted by + # engagement. + class TileNavigationResult + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # Metadata for active A/B testing experiment. + # @!attribute [rw] serving_config_experiment + # @return [::Google::Cloud::Retail::V2::ExperimentInfo::ServingConfigExperiment] + # A/B test between existing Cloud Retail Search + # {::Google::Cloud::Retail::V2::ServingConfig ServingConfig}s. + # @!attribute [rw] experiment + # @return [::String] + # The fully qualified resource name of the experiment that provides the + # serving config under test, should an active experiment exist. For example: + # `projects/*/locations/global/catalogs/default_catalog/experiments/experiment_id` + class ExperimentInfo + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Metadata for active serving config A/B tests. + # @!attribute [rw] original_serving_config + # @return [::String] + # The fully qualified resource name of the original + # {::Google::Cloud::Retail::V2::SearchRequest#placement SearchRequest.placement} + # in the search request prior to reassignment by experiment API. For + # example: `projects/*/locations/*/catalogs/*/servingConfigs/*`. + # @!attribute [rw] experiment_serving_config + # @return [::String] + # The fully qualified resource name of the serving config + # `Experiment.VariantArm.serving_config_id` responsible for generating + # the search response. For example: + # `projects/*/locations/*/catalogs/*/servingConfigs/*`. + class ServingConfigExperiment + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/serving_config.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/serving_config.rb new file mode 100644 index 000000000000..2237b3c08193 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/serving_config.rb @@ -0,0 +1,259 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Retail + module V2 + # Configures metadata that is used to generate serving time results (e.g. + # search results or recommendation predictions). + # @!attribute [rw] name + # @return [::String] + # Immutable. Fully qualified name + # `projects/*/locations/global/catalogs/*/servingConfig/*` + # @!attribute [rw] display_name + # @return [::String] + # Required. The human readable serving config display name. Used in Retail + # UI. + # + # This field must be a UTF-8 encoded string with a length limit of 128 + # characters. Otherwise, an INVALID_ARGUMENT error is returned. + # @!attribute [rw] model_id + # @return [::String] + # The id of the model in the same {::Google::Cloud::Retail::V2::Catalog Catalog} + # to use at serving time. Currently only RecommendationModels are supported: + # https://cloud.google.com/retail/recommendations-ai/docs/create-models + # Can be changed but only to a compatible model (e.g. + # others-you-may-like CTR to others-you-may-like CVR). + # + # Required when + # {::Google::Cloud::Retail::V2::ServingConfig#solution_types solution_types} is + # {::Google::Cloud::Retail::V2::SolutionType::SOLUTION_TYPE_RECOMMENDATION SOLUTION_TYPE_RECOMMENDATION}. + # @!attribute [rw] price_reranking_level + # @return [::String] + # How much price ranking we want in serving results. + # Price reranking causes product items with a similar + # recommendation probability to be ordered by price, with the + # highest-priced items first. This setting could result in a decrease in + # click-through and conversion rates. + # Allowed values are: + # + # * `no-price-reranking` + # * `low-price-reranking` + # * `medium-price-reranking` + # * `high-price-reranking` + # + # If not specified, we choose default based on model type. Default value: + # `no-price-reranking`. + # + # Can only be set if + # {::Google::Cloud::Retail::V2::ServingConfig#solution_types solution_types} is + # {::Google::Cloud::Retail::V2::SolutionType::SOLUTION_TYPE_RECOMMENDATION SOLUTION_TYPE_RECOMMENDATION}. + # @!attribute [rw] facet_control_ids + # @return [::Array<::String>] + # Facet specifications for faceted search. If empty, no facets are returned. + # The ids refer to the ids of {::Google::Cloud::Retail::V2::Control Control} + # resources with only the Facet control set. These controls are assumed to be + # in the same {::Google::Cloud::Retail::V2::Catalog Catalog} as the + # {::Google::Cloud::Retail::V2::ServingConfig ServingConfig}. + # A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error + # is returned. + # + # Can only be set if + # {::Google::Cloud::Retail::V2::ServingConfig#solution_types solution_types} is + # {::Google::Cloud::Retail::V2::SolutionType::SOLUTION_TYPE_SEARCH SOLUTION_TYPE_SEARCH}. + # @!attribute [rw] dynamic_facet_spec + # @return [::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec] + # The specification for dynamically generated facets. Notice that only + # textual facets can be dynamically generated. + # + # Can only be set if + # {::Google::Cloud::Retail::V2::ServingConfig#solution_types solution_types} is + # {::Google::Cloud::Retail::V2::SolutionType::SOLUTION_TYPE_SEARCH SOLUTION_TYPE_SEARCH}. + # @!attribute [rw] boost_control_ids + # @return [::Array<::String>] + # Condition boost specifications. If a product matches multiple conditions + # in the specifications, boost scores from these specifications are all + # applied and combined in a non-linear way. Maximum number of + # specifications is 100. + # + # Notice that if both + # {::Google::Cloud::Retail::V2::ServingConfig#boost_control_ids ServingConfig.boost_control_ids} + # and + # {::Google::Cloud::Retail::V2::SearchRequest#boost_spec SearchRequest.boost_spec} + # are set, the boost conditions from both places are evaluated. If a search + # request matches multiple boost conditions, the final boost score is equal + # to the sum of the boost scores from all matched boost conditions. + # + # Can only be set if + # {::Google::Cloud::Retail::V2::ServingConfig#solution_types solution_types} is + # {::Google::Cloud::Retail::V2::SolutionType::SOLUTION_TYPE_SEARCH SOLUTION_TYPE_SEARCH}. + # @!attribute [rw] filter_control_ids + # @return [::Array<::String>] + # Condition filter specifications. If a product matches multiple conditions + # in the specifications, filters from these specifications are all + # applied and combined via the AND operator. Maximum number of + # specifications is 100. + # + # Can only be set if + # {::Google::Cloud::Retail::V2::ServingConfig#solution_types solution_types} is + # {::Google::Cloud::Retail::V2::SolutionType::SOLUTION_TYPE_SEARCH SOLUTION_TYPE_SEARCH}. + # @!attribute [rw] redirect_control_ids + # @return [::Array<::String>] + # Condition redirect specifications. Only the first triggered redirect action + # is applied, even if multiple apply. Maximum number of specifications is + # 1000. + # + # Can only be set if + # {::Google::Cloud::Retail::V2::ServingConfig#solution_types solution_types} is + # {::Google::Cloud::Retail::V2::SolutionType::SOLUTION_TYPE_SEARCH SOLUTION_TYPE_SEARCH}. + # @!attribute [rw] twoway_synonyms_control_ids + # @return [::Array<::String>] + # Condition synonyms specifications. If multiple syonyms conditions match, + # all matching synonyms control in the list will execute. Order of controls + # in the list will not matter. Maximum number of specifications is + # 100. + # + # Can only be set if + # {::Google::Cloud::Retail::V2::ServingConfig#solution_types solution_types} is + # {::Google::Cloud::Retail::V2::SolutionType::SOLUTION_TYPE_SEARCH SOLUTION_TYPE_SEARCH}. + # @!attribute [rw] oneway_synonyms_control_ids + # @return [::Array<::String>] + # Condition oneway synonyms specifications. If multiple oneway synonyms + # conditions match, all matching oneway synonyms controls in the list will + # execute. Order of controls in the list will not matter. Maximum number of + # specifications is 100. + # + # Can only be set if + # {::Google::Cloud::Retail::V2::ServingConfig#solution_types solution_types} is + # {::Google::Cloud::Retail::V2::SolutionType::SOLUTION_TYPE_SEARCH SOLUTION_TYPE_SEARCH}. + # @!attribute [rw] do_not_associate_control_ids + # @return [::Array<::String>] + # Condition do not associate specifications. If multiple do not associate + # conditions match, all matching do not associate controls in the list will + # execute. + # - Order does not matter. + # - Maximum number of specifications is 100. + # + # Can only be set if + # {::Google::Cloud::Retail::V2::ServingConfig#solution_types solution_types} is + # {::Google::Cloud::Retail::V2::SolutionType::SOLUTION_TYPE_SEARCH SOLUTION_TYPE_SEARCH}. + # @!attribute [rw] replacement_control_ids + # @return [::Array<::String>] + # Condition replacement specifications. + # - Applied according to the order in the list. + # - A previously replaced term can not be re-replaced. + # - Maximum number of specifications is 100. + # + # Can only be set if + # {::Google::Cloud::Retail::V2::ServingConfig#solution_types solution_types} is + # {::Google::Cloud::Retail::V2::SolutionType::SOLUTION_TYPE_SEARCH SOLUTION_TYPE_SEARCH}. + # @!attribute [rw] ignore_control_ids + # @return [::Array<::String>] + # Condition ignore specifications. If multiple ignore + # conditions match, all matching ignore controls in the list will + # execute. + # - Order does not matter. + # - Maximum number of specifications is 100. + # + # Can only be set if + # {::Google::Cloud::Retail::V2::ServingConfig#solution_types solution_types} is + # {::Google::Cloud::Retail::V2::SolutionType::SOLUTION_TYPE_SEARCH SOLUTION_TYPE_SEARCH}. + # @!attribute [rw] diversity_level + # @return [::String] + # How much diversity to use in recommendation model results e.g. + # `medium-diversity` or `high-diversity`. Currently supported values: + # + # * `no-diversity` + # * `low-diversity` + # * `medium-diversity` + # * `high-diversity` + # * `auto-diversity` + # + # If not specified, we choose default based on recommendation model + # type. Default value: `no-diversity`. + # + # Can only be set if + # {::Google::Cloud::Retail::V2::ServingConfig#solution_types solution_types} is + # {::Google::Cloud::Retail::V2::SolutionType::SOLUTION_TYPE_RECOMMENDATION SOLUTION_TYPE_RECOMMENDATION}. + # @!attribute [rw] diversity_type + # @return [::Google::Cloud::Retail::V2::ServingConfig::DiversityType] + # What kind of diversity to use - data driven or rule based. If unset, the + # server behavior defaults to + # {::Google::Cloud::Retail::V2::ServingConfig::DiversityType::RULE_BASED_DIVERSITY RULE_BASED_DIVERSITY}. + # @!attribute [rw] enable_category_filter_level + # @return [::String] + # Whether to add additional category filters on the `similar-items` model. + # If not specified, we enable it by default. + # Allowed values are: + # + # * `no-category-match`: No additional filtering of original results from + # the model and the customer's filters. + # * `relaxed-category-match`: Only keep results with categories that match + # at least one item categories in the PredictRequests's context item. + # * If customer also sends filters in the PredictRequest, then the results + # will satisfy both conditions (user given and category match). + # + # Can only be set if + # {::Google::Cloud::Retail::V2::ServingConfig#solution_types solution_types} is + # {::Google::Cloud::Retail::V2::SolutionType::SOLUTION_TYPE_RECOMMENDATION SOLUTION_TYPE_RECOMMENDATION}. + # @!attribute [rw] ignore_recs_denylist + # @return [::Boolean] + # When the flag is enabled, the products in the denylist will not be filtered + # out in the recommendation filtering results. + # @!attribute [rw] personalization_spec + # @return [::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec] + # The specification for personalization spec. + # + # Can only be set if + # {::Google::Cloud::Retail::V2::ServingConfig#solution_types solution_types} is + # {::Google::Cloud::Retail::V2::SolutionType::SOLUTION_TYPE_SEARCH SOLUTION_TYPE_SEARCH}. + # + # Notice that if both + # {::Google::Cloud::Retail::V2::ServingConfig#personalization_spec ServingConfig.personalization_spec} + # and + # {::Google::Cloud::Retail::V2::SearchRequest#personalization_spec SearchRequest.personalization_spec} + # are set. + # {::Google::Cloud::Retail::V2::SearchRequest#personalization_spec SearchRequest.personalization_spec} + # will override + # {::Google::Cloud::Retail::V2::ServingConfig#personalization_spec ServingConfig.personalization_spec}. + # @!attribute [rw] solution_types + # @return [::Array<::Google::Cloud::Retail::V2::SolutionType>] + # Required. Immutable. Specifies the solution types that a serving config can + # be associated with. Currently we support setting only one type of solution. + class ServingConfig + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # What type of diversity - data or rule based. + module DiversityType + # Default value. + DIVERSITY_TYPE_UNSPECIFIED = 0 + + # Rule based diversity. + RULE_BASED_DIVERSITY = 2 + + # Data driven diversity. + DATA_DRIVEN_DIVERSITY = 3 + end + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/serving_config_service.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/serving_config_service.rb new file mode 100644 index 000000000000..943913f2996e --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/serving_config_service.rb @@ -0,0 +1,143 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Retail + module V2 + # Request for CreateServingConfig method. + # @!attribute [rw] parent + # @return [::String] + # Required. Full resource name of parent. Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` + # @!attribute [rw] serving_config + # @return [::Google::Cloud::Retail::V2::ServingConfig] + # Required. The ServingConfig to create. + # @!attribute [rw] serving_config_id + # @return [::String] + # Required. The ID to use for the ServingConfig, which will become the final + # component of the ServingConfig's resource name. + # + # This value should be 4-63 characters, and valid characters + # are /[a-z][0-9]-_/. + class CreateServingConfigRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for UpdateServingConfig method. + # @!attribute [rw] serving_config + # @return [::Google::Cloud::Retail::V2::ServingConfig] + # Required. The ServingConfig to update. + # @!attribute [rw] update_mask + # @return [::Google::Protobuf::FieldMask] + # Indicates which fields in the provided + # {::Google::Cloud::Retail::V2::ServingConfig ServingConfig} to update. The + # following are NOT supported: + # + # * {::Google::Cloud::Retail::V2::ServingConfig#name ServingConfig.name} + # + # If not set, all supported fields are updated. + class UpdateServingConfigRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for DeleteServingConfig method. + # @!attribute [rw] name + # @return [::String] + # Required. The resource name of the ServingConfig to delete. Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` + class DeleteServingConfigRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for GetServingConfig method. + # @!attribute [rw] name + # @return [::String] + # Required. The resource name of the ServingConfig to get. Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` + class GetServingConfigRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for ListServingConfigs method. + # @!attribute [rw] parent + # @return [::String] + # Required. The catalog resource name. Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` + # @!attribute [rw] page_size + # @return [::Integer] + # Optional. Maximum number of results to return. If unspecified, defaults + # to 100. If a value greater than 100 is provided, at most 100 results are + # returned. + # @!attribute [rw] page_token + # @return [::String] + # Optional. A page token, received from a previous `ListServingConfigs` call. + # Provide this to retrieve the subsequent page. + class ListServingConfigsRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Response for ListServingConfigs method. + # @!attribute [rw] serving_configs + # @return [::Array<::Google::Cloud::Retail::V2::ServingConfig>] + # All the ServingConfigs for a given catalog. + # @!attribute [rw] next_page_token + # @return [::String] + # Pagination token, if not returned indicates the last page. + class ListServingConfigsResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for AddControl method. + # @!attribute [rw] serving_config + # @return [::String] + # Required. The source ServingConfig resource name . Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` + # @!attribute [rw] control_id + # @return [::String] + # Required. The id of the control to apply. Assumed to be in the same catalog + # as the serving config - if id is not found a NOT_FOUND error is returned. + class AddControlRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for RemoveControl method. + # @!attribute [rw] serving_config + # @return [::String] + # Required. The source ServingConfig resource name . Format: + # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` + # @!attribute [rw] control_id + # @return [::String] + # Required. The id of the control to apply. Assumed to be in the same catalog + # as the serving config. + class RemoveControlRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/user_event.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/user_event.rb new file mode 100644 index 000000000000..2c119fd76473 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/user_event.rb @@ -0,0 +1,364 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Retail + module V2 + # UserEvent captures all metadata information Retail API needs to know about + # how end users interact with customers' website. + # @!attribute [rw] event_type + # @return [::String] + # Required. User event type. Allowed values are: + # + # * `add-to-cart`: Products being added to cart. + # * `remove-from-cart`: Products being removed from cart. + # * `category-page-view`: Special pages such as sale or promotion pages + # viewed. + # * `detail-page-view`: Products detail page viewed. + # * `home-page-view`: Homepage viewed. + # * `purchase-complete`: User finishing a purchase. + # * `search`: Product search. + # * `shopping-cart-page-view`: User viewing a shopping cart. + # @!attribute [rw] visitor_id + # @return [::String] + # Required. A unique identifier for tracking visitors. + # + # For example, this could be implemented with an HTTP cookie, which should be + # able to uniquely identify a visitor on a single device. This unique + # identifier should not change if the visitor log in/out of the website. + # + # Don't set the field to the same fixed ID for different users. This mixes + # the event history of those users together, which results in degraded model + # quality. + # + # The field must be a UTF-8 encoded string with a length limit of 128 + # characters. Otherwise, an INVALID_ARGUMENT error is returned. + # + # The field should not contain PII or user-data. We recommend to use Google + # Analytics [Client + # ID](https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#clientId) + # for this field. + # @!attribute [rw] session_id + # @return [::String] + # A unique identifier for tracking a visitor session with a length limit of + # 128 bytes. A session is an aggregation of an end user behavior in a time + # span. + # + # A general guideline to populate the session_id: + # 1. If user has no activity for 30 min, a new session_id should be assigned. + # 2. The session_id should be unique across users, suggest use uuid or add + # visitor_id as prefix. + # @!attribute [rw] event_time + # @return [::Google::Protobuf::Timestamp] + # Only required for + # {::Google::Cloud::Retail::V2::UserEventService::Client#import_user_events UserEventService.ImportUserEvents} + # method. Timestamp of when the user event happened. + # @!attribute [rw] experiment_ids + # @return [::Array<::String>] + # A list of identifiers for the independent experiment groups this user event + # belongs to. This is used to distinguish between user events associated with + # different experiment setups (e.g. using Retail API, using different + # recommendation models). + # @!attribute [rw] attribution_token + # @return [::String] + # Highly recommended for user events that are the result of + # {::Google::Cloud::Retail::V2::PredictionService::Client#predict PredictionService.Predict}. + # This field enables accurate attribution of recommendation model + # performance. + # + # The value must be a valid + # {::Google::Cloud::Retail::V2::PredictResponse#attribution_token PredictResponse.attribution_token} + # for user events that are the result of + # {::Google::Cloud::Retail::V2::PredictionService::Client#predict PredictionService.Predict}. + # The value must be a valid + # {::Google::Cloud::Retail::V2::SearchResponse#attribution_token SearchResponse.attribution_token} + # for user events that are the result of + # {::Google::Cloud::Retail::V2::SearchService::Client#search SearchService.Search}. + # + # This token enables us to accurately attribute page view or purchase back to + # the event and the particular predict response containing this + # clicked/purchased product. If user clicks on product K in the + # recommendation results, pass + # {::Google::Cloud::Retail::V2::PredictResponse#attribution_token PredictResponse.attribution_token} + # as a URL parameter to product K's page. When recording events on product + # K's page, log the + # {::Google::Cloud::Retail::V2::PredictResponse#attribution_token PredictResponse.attribution_token} + # to this field. + # @!attribute [rw] product_details + # @return [::Array<::Google::Cloud::Retail::V2::ProductDetail>] + # The main product details related to the event. + # + # This field is optional except for the following event types: + # + # * `add-to-cart` + # * `detail-page-view` + # * `purchase-complete` + # + # In a `search` event, this field represents the products returned to the end + # user on the current page (the end user may have not finished browsing the + # whole page yet). When a new page is returned to the end user, after + # pagination/filtering/ordering even for the same query, a new `search` event + # with different + # {::Google::Cloud::Retail::V2::UserEvent#product_details product_details} is + # desired. The end user may have not finished browsing the whole page yet. + # @!attribute [rw] completion_detail + # @return [::Google::Cloud::Retail::V2::CompletionDetail] + # The main auto-completion details related to the event. + # + # This field should be set for `search` event when autocomplete function is + # enabled and the user clicks a suggestion for search. + # @!attribute [rw] attributes + # @return [::Google::Protobuf::Map{::String => ::Google::Cloud::Retail::V2::CustomAttribute}] + # Extra user event features to include in the recommendation model. + # + # If you provide custom attributes for ingested user events, also include + # them in the user events that you associate with prediction requests. Custom + # attribute formatting must be consistent between imported events and events + # provided with prediction requests. This lets the Retail API use + # those custom attributes when training models and serving predictions, which + # helps improve recommendation quality. + # + # This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT + # error is returned: + # + # * The key must be a UTF-8 encoded string with a length limit of 5,000 + # characters. + # * For text attributes, at most 400 values are allowed. Empty values are not + # allowed. Each value must be a UTF-8 encoded string with a length limit of + # 256 characters. + # * For number attributes, at most 400 values are allowed. + # + # For product recommendations, an example of extra user information is + # traffic_channel, which is how a user arrives at the site. Users can arrive + # at the site by coming to the site directly, coming through Google + # search, or in other ways. + # @!attribute [rw] cart_id + # @return [::String] + # The ID or name of the associated shopping cart. This ID is used + # to associate multiple items added or present in the cart before purchase. + # + # This can only be set for `add-to-cart`, `purchase-complete`, or + # `shopping-cart-page-view` events. + # @!attribute [rw] purchase_transaction + # @return [::Google::Cloud::Retail::V2::PurchaseTransaction] + # A transaction represents the entire purchase transaction. + # + # Required for `purchase-complete` events. Other event types should not set + # this field. Otherwise, an INVALID_ARGUMENT error is returned. + # @!attribute [rw] search_query + # @return [::String] + # The user's search query. + # + # See {::Google::Cloud::Retail::V2::SearchRequest#query SearchRequest.query} for + # definition. + # + # The value must be a UTF-8 encoded string with a length limit of 5,000 + # characters. Otherwise, an INVALID_ARGUMENT error is returned. + # + # At least one of + # {::Google::Cloud::Retail::V2::UserEvent#search_query search_query} or + # {::Google::Cloud::Retail::V2::UserEvent#page_categories page_categories} is + # required for `search` events. Other event types should not set this field. + # Otherwise, an INVALID_ARGUMENT error is returned. + # @!attribute [rw] filter + # @return [::String] + # The filter syntax consists of an expression language for constructing a + # predicate from one or more fields of the products being filtered. + # + # See {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter} for + # definition and syntax. + # + # The value must be a UTF-8 encoded string with a length limit of 1,000 + # characters. Otherwise, an INVALID_ARGUMENT error is returned. + # @!attribute [rw] order_by + # @return [::String] + # The order in which products are returned. + # + # See {::Google::Cloud::Retail::V2::SearchRequest#order_by SearchRequest.order_by} + # for definition and syntax. + # + # The value must be a UTF-8 encoded string with a length limit of 1,000 + # characters. Otherwise, an INVALID_ARGUMENT error is returned. + # + # This can only be set for `search` events. Other event types should not set + # this field. Otherwise, an INVALID_ARGUMENT error is returned. + # @!attribute [rw] offset + # @return [::Integer] + # An integer that specifies the current offset for pagination (the 0-indexed + # starting location, amongst the products deemed by the API as relevant). + # + # See {::Google::Cloud::Retail::V2::SearchRequest#offset SearchRequest.offset} for + # definition. + # + # If this field is negative, an INVALID_ARGUMENT is returned. + # + # This can only be set for `search` events. Other event types should not set + # this field. Otherwise, an INVALID_ARGUMENT error is returned. + # @!attribute [rw] page_categories + # @return [::Array<::String>] + # The categories associated with a category page. + # + # To represent full path of category, use '>' sign to separate different + # hierarchies. If '>' is part of the category name, replace it with + # other character(s). + # + # Category pages include special pages such as sales or promotions. For + # instance, a special sale page may have the category hierarchy: + # "pageCategories" : ["Sales > 2017 Black Friday Deals"]. + # + # Required for `category-page-view` events. At least one of + # {::Google::Cloud::Retail::V2::UserEvent#search_query search_query} or + # {::Google::Cloud::Retail::V2::UserEvent#page_categories page_categories} is + # required for `search` events. Other event types should not set this field. + # Otherwise, an INVALID_ARGUMENT error is returned. + # @!attribute [rw] user_info + # @return [::Google::Cloud::Retail::V2::UserInfo] + # User information. + # @!attribute [rw] uri + # @return [::String] + # Complete URL (window.location.href) of the user's current page. + # + # When using the client side event reporting with JavaScript pixel and Google + # Tag Manager, this value is filled in automatically. Maximum length 5,000 + # characters. + # @!attribute [rw] referrer_uri + # @return [::String] + # The referrer URL of the current page. + # + # When using the client side event reporting with JavaScript pixel and Google + # Tag Manager, this value is filled in automatically. + # @!attribute [rw] page_view_id + # @return [::String] + # A unique ID of a web page view. + # + # This should be kept the same for all user events triggered from the same + # pageview. For example, an item detail page view could trigger multiple + # events as the user is browsing the page. The `pageViewId` property should + # be kept the same for all these events so that they can be grouped together + # properly. + # + # When using the client side event reporting with JavaScript pixel and Google + # Tag Manager, this value is filled in automatically. + # @!attribute [rw] entity + # @return [::String] + # The entity for customers that may run multiple different entities, domains, + # sites or regions, for example, `Google US`, `Google Ads`, `Waymo`, + # `google.com`, `youtube.com`, etc. + # We recommend that you set this field to get better per-entity search, + # completion, and prediction results. + class UserEvent + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # @!attribute [rw] key + # @return [::String] + # @!attribute [rw] value + # @return [::Google::Cloud::Retail::V2::CustomAttribute] + class AttributesEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # Detailed product information associated with a user event. + # @!attribute [rw] product + # @return [::Google::Cloud::Retail::V2::Product] + # Required. {::Google::Cloud::Retail::V2::Product Product} information. + # + # Required field(s): + # + # * {::Google::Cloud::Retail::V2::Product#id Product.id} + # + # Optional override field(s): + # + # * {::Google::Cloud::Retail::V2::Product#price_info Product.price_info} + # + # If any supported optional fields are provided, we will treat them as a full + # override when looking up product information from the catalog. Thus, it is + # important to ensure that the overriding fields are accurate and + # complete. + # + # All other product fields are ignored and instead populated via catalog + # lookup after event ingestion. + # @!attribute [rw] quantity + # @return [::Google::Protobuf::Int32Value] + # Quantity of the product associated with the user event. + # + # For example, this field will be 2 if two products are added to the shopping + # cart for `purchase-complete` event. Required for `add-to-cart` and + # `purchase-complete` event types. + class ProductDetail + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Detailed completion information including completion attribution token and + # clicked completion info. + # @!attribute [rw] completion_attribution_token + # @return [::String] + # Completion attribution token in + # {::Google::Cloud::Retail::V2::CompleteQueryResponse#attribution_token CompleteQueryResponse.attribution_token}. + # @!attribute [rw] selected_suggestion + # @return [::String] + # End user selected + # {::Google::Cloud::Retail::V2::CompleteQueryResponse::CompletionResult#suggestion CompleteQueryResponse.CompletionResult.suggestion}. + # @!attribute [rw] selected_position + # @return [::Integer] + # End user selected + # {::Google::Cloud::Retail::V2::CompleteQueryResponse::CompletionResult#suggestion CompleteQueryResponse.CompletionResult.suggestion} + # position, starting from 0. + class CompletionDetail + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # A transaction represents the entire purchase transaction. + # @!attribute [rw] id + # @return [::String] + # The transaction ID with a length limit of 128 characters. + # @!attribute [rw] revenue + # @return [::Float] + # Required. Total non-zero revenue or grand total associated with the + # transaction. This value include shipping, tax, or other adjustments to + # total revenue that you want to include as part of your revenue + # calculations. + # @!attribute [rw] tax + # @return [::Float] + # All the taxes associated with the transaction. + # @!attribute [rw] cost + # @return [::Float] + # All the costs associated with the products. These can be manufacturing + # costs, shipping expenses not borne by the end user, or any other costs, + # such that: + # + # * Profit = {::Google::Cloud::Retail::V2::PurchaseTransaction#revenue revenue} - + # {::Google::Cloud::Retail::V2::PurchaseTransaction#tax tax} - + # {::Google::Cloud::Retail::V2::PurchaseTransaction#cost cost} + # @!attribute [rw] currency_code + # @return [::String] + # Required. Currency code. Use three-character ISO-4217 code. + class PurchaseTransaction + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/user_event_service.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/user_event_service.rb new file mode 100644 index 000000000000..cb0896f85338 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/user_event_service.rb @@ -0,0 +1,130 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Cloud + module Retail + module V2 + # Request message for WriteUserEvent method. + # @!attribute [rw] parent + # @return [::String] + # Required. The parent catalog resource name, such as + # `projects/1234/locations/global/catalogs/default_catalog`. + # @!attribute [rw] user_event + # @return [::Google::Cloud::Retail::V2::UserEvent] + # Required. User event to write. + # @!attribute [rw] write_async + # @return [::Boolean] + # If set to true, the user event will be written asynchronously after + # validation, and the API will respond without waiting for the write. + # Therefore, silent failures can occur even if the API returns success. In + # case of silent failures, error messages can be found in Stackdriver logs. + class WriteUserEventRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for CollectUserEvent method. + # @!attribute [rw] prebuilt_rule + # @return [::String] + # The prebuilt rule name that can convert a specific type of raw_json. + # For example: "ga4_bq" rule for the GA4 user event schema. + # @!attribute [rw] parent + # @return [::String] + # Required. The parent catalog name, such as + # `projects/1234/locations/global/catalogs/default_catalog`. + # @!attribute [rw] user_event + # @return [::String] + # Required. URL encoded UserEvent proto with a length limit of 2,000,000 + # characters. + # @!attribute [rw] uri + # @return [::String] + # The URL including cgi-parameters but excluding the hash fragment with a + # length limit of 5,000 characters. This is often more useful than the + # referer URL, because many browsers only send the domain for 3rd party + # requests. + # @!attribute [rw] ets + # @return [::Integer] + # The event timestamp in milliseconds. This prevents browser caching of + # otherwise identical get requests. The name is abbreviated to reduce the + # payload bytes. + # @!attribute [rw] raw_json + # @return [::String] + # An arbitrary serialized JSON string that contains necessary information + # that can comprise a user event. When this field is specified, the + # user_event field will be ignored. Note: line-delimited JSON is not + # supported, a single JSON only. + class CollectUserEventRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request message for RejoinUserEvents method. + # @!attribute [rw] parent + # @return [::String] + # Required. The parent catalog resource name, such as + # `projects/1234/locations/global/catalogs/default_catalog`. + # @!attribute [rw] user_event_rejoin_scope + # @return [::Google::Cloud::Retail::V2::RejoinUserEventsRequest::UserEventRejoinScope] + # The type of the user event rejoin to define the scope and range of the user + # events to be rejoined with the latest product catalog. Defaults to + # `USER_EVENT_REJOIN_SCOPE_UNSPECIFIED` if this field is not set, or set to + # an invalid integer value. + class RejoinUserEventsRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # The scope of user events to be rejoined with the latest product catalog. + # If the rejoining aims at reducing number of unjoined events, set + # `UserEventRejoinScope` to `UNJOINED_EVENTS`. + # If the rejoining aims at correcting product catalog information in joined + # events, set `UserEventRejoinScope` to `JOINED_EVENTS`. + # If all events needs to be rejoined, set `UserEventRejoinScope` to + # `USER_EVENT_REJOIN_SCOPE_UNSPECIFIED`. + module UserEventRejoinScope + # Rejoin all events with the latest product catalog, including both joined + # events and unjoined events. + USER_EVENT_REJOIN_SCOPE_UNSPECIFIED = 0 + + # Only rejoin joined events with the latest product catalog. + JOINED_EVENTS = 1 + + # Only rejoin unjoined events with the latest product catalog. + UNJOINED_EVENTS = 2 + end + end + + # Response message for `RejoinUserEvents` method. + # @!attribute [rw] rejoined_user_events_count + # @return [::Integer] + # Number of user events that were joined with latest product catalog. + class RejoinUserEventsResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Metadata for `RejoinUserEvents` method. + class RejoinUserEventsMetadata + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/longrunning/operations.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/longrunning/operations.rb new file mode 100644 index 000000000000..7a757f512165 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/longrunning/operations.rb @@ -0,0 +1,191 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Longrunning + # This resource represents a long-running operation that is the result of a + # network API call. + # @!attribute [rw] name + # @return [::String] + # The server-assigned name, which is only unique within the same service that + # originally returns it. If you use the default HTTP mapping, the + # `name` should be a resource name ending with `operations/{unique_id}`. + # @!attribute [rw] metadata + # @return [::Google::Protobuf::Any] + # Service-specific metadata associated with the operation. It typically + # contains progress information and common metadata such as create time. + # Some services might not provide such metadata. Any method that returns a + # long-running operation should document the metadata type, if any. + # @!attribute [rw] done + # @return [::Boolean] + # If the value is `false`, it means the operation is still in progress. + # If `true`, the operation is completed, and either `error` or `response` is + # available. + # @!attribute [rw] error + # @return [::Google::Rpc::Status] + # The error result of the operation in case of failure or cancellation. + # + # Note: The following fields are mutually exclusive: `error`, `response`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [rw] response + # @return [::Google::Protobuf::Any] + # The normal, successful response of the operation. If the original + # method returns no data on success, such as `Delete`, the response is + # `google.protobuf.Empty`. If the original method is standard + # `Get`/`Create`/`Update`, the response should be the resource. For other + # methods, the response should have the type `XxxResponse`, where `Xxx` + # is the original method name. For example, if the original method name + # is `TakeSnapshot()`, the inferred response type is + # `TakeSnapshotResponse`. + # + # Note: The following fields are mutually exclusive: `response`, `error`. If a field in that set is populated, all other fields in the set will automatically be cleared. + class Operation + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The request message for + # Operations.GetOperation. + # @!attribute [rw] name + # @return [::String] + # The name of the operation resource. + class GetOperationRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The request message for + # Operations.ListOperations. + # @!attribute [rw] name + # @return [::String] + # The name of the operation's parent resource. + # @!attribute [rw] filter + # @return [::String] + # The standard list filter. + # @!attribute [rw] page_size + # @return [::Integer] + # The standard list page size. + # @!attribute [rw] page_token + # @return [::String] + # The standard list page token. + # @!attribute [rw] return_partial_success + # @return [::Boolean] + # When set to `true`, operations that are reachable are returned as normal, + # and those that are unreachable are returned in the + # [ListOperationsResponse.unreachable] field. + # + # This can only be `true` when reading across collections e.g. when `parent` + # is set to `"projects/example/locations/-"`. + # + # This field is not by default supported and will result in an + # `UNIMPLEMENTED` error if set unless explicitly documented otherwise in + # service or product specific documentation. + class ListOperationsRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The response message for + # Operations.ListOperations. + # @!attribute [rw] operations + # @return [::Array<::Google::Longrunning::Operation>] + # A list of operations that matches the specified filter in the request. + # @!attribute [rw] next_page_token + # @return [::String] + # The standard List next-page token. + # @!attribute [rw] unreachable + # @return [::Array<::String>] + # Unordered list. Unreachable resources. Populated when the request sets + # `ListOperationsRequest.return_partial_success` and reads across + # collections e.g. when attempting to list all resources across all supported + # locations. + class ListOperationsResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The request message for + # Operations.CancelOperation. + # @!attribute [rw] name + # @return [::String] + # The name of the operation resource to be cancelled. + class CancelOperationRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The request message for + # Operations.DeleteOperation. + # @!attribute [rw] name + # @return [::String] + # The name of the operation resource to be deleted. + class DeleteOperationRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The request message for + # Operations.WaitOperation. + # @!attribute [rw] name + # @return [::String] + # The name of the operation resource to wait on. + # @!attribute [rw] timeout + # @return [::Google::Protobuf::Duration] + # The maximum duration to wait before timing out. If left blank, the wait + # will be at most the time permitted by the underlying HTTP/RPC protocol. + # If RPC context deadline is also specified, the shorter one will be used. + class WaitOperationRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # A message representing the message types used by a long-running operation. + # + # Example: + # + # rpc Export(ExportRequest) returns (google.longrunning.Operation) { + # option (google.longrunning.operation_info) = { + # response_type: "ExportResponse" + # metadata_type: "ExportMetadata" + # }; + # } + # @!attribute [rw] response_type + # @return [::String] + # Required. The message name of the primary return type for this + # long-running operation. + # This type will be used to deserialize the LRO's response. + # + # If the response is in a different package from the rpc, a fully-qualified + # message name must be used (e.g. `google.protobuf.Struct`). + # + # Note: Altering this value constitutes a breaking change. + # @!attribute [rw] metadata_type + # @return [::String] + # Required. The message name of the metadata type for this long-running + # operation. + # + # If the response is in a different package from the rpc, a fully-qualified + # message name must be used (e.g. `google.protobuf.Struct`). + # + # Note: Altering this value constitutes a breaking change. + class OperationInfo + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/any.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/any.rb new file mode 100644 index 000000000000..58691995f02e --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/any.rb @@ -0,0 +1,145 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Protobuf + # `Any` contains an arbitrary serialized protocol buffer message along with a + # URL that describes the type of the serialized message. + # + # Protobuf library provides support to pack/unpack Any values in the form + # of utility functions or additional generated methods of the Any type. + # + # Example 1: Pack and unpack a message in C++. + # + # Foo foo = ...; + # Any any; + # any.PackFrom(foo); + # ... + # if (any.UnpackTo(&foo)) { + # ... + # } + # + # Example 2: Pack and unpack a message in Java. + # + # Foo foo = ...; + # Any any = Any.pack(foo); + # ... + # if (any.is(Foo.class)) { + # foo = any.unpack(Foo.class); + # } + # // or ... + # if (any.isSameTypeAs(Foo.getDefaultInstance())) { + # foo = any.unpack(Foo.getDefaultInstance()); + # } + # + # Example 3: Pack and unpack a message in Python. + # + # foo = Foo(...) + # any = Any() + # any.Pack(foo) + # ... + # if any.Is(Foo.DESCRIPTOR): + # any.Unpack(foo) + # ... + # + # Example 4: Pack and unpack a message in Go + # + # foo := &pb.Foo{...} + # any, err := anypb.New(foo) + # if err != nil { + # ... + # } + # ... + # foo := &pb.Foo{} + # if err := any.UnmarshalTo(foo); err != nil { + # ... + # } + # + # The pack methods provided by protobuf library will by default use + # 'type.googleapis.com/full.type.name' as the type URL and the unpack + # methods only use the fully qualified type name after the last '/' + # in the type URL, for example "foo.bar.com/x/y.z" will yield type + # name "y.z". + # + # JSON + # ==== + # The JSON representation of an `Any` value uses the regular + # representation of the deserialized, embedded message, with an + # additional field `@type` which contains the type URL. Example: + # + # package google.profile; + # message Person { + # string first_name = 1; + # string last_name = 2; + # } + # + # { + # "@type": "type.googleapis.com/google.profile.Person", + # "firstName": , + # "lastName": + # } + # + # If the embedded message type is well-known and has a custom JSON + # representation, that representation will be embedded adding a field + # `value` which holds the custom JSON in addition to the `@type` + # field. Example (for message [google.protobuf.Duration][]): + # + # { + # "@type": "type.googleapis.com/google.protobuf.Duration", + # "value": "1.212s" + # } + # @!attribute [rw] type_url + # @return [::String] + # A URL/resource name that uniquely identifies the type of the serialized + # protocol buffer message. This string must contain at least + # one "/" character. The last segment of the URL's path must represent + # the fully qualified name of the type (as in + # `path/google.protobuf.Duration`). The name should be in a canonical form + # (e.g., leading "." is not accepted). + # + # In practice, teams usually precompile into the binary all types that they + # expect it to use in the context of Any. However, for URLs which use the + # scheme `http`, `https`, or no scheme, one can optionally set up a type + # server that maps type URLs to message definitions as follows: + # + # * If no scheme is provided, `https` is assumed. + # * An HTTP GET on the URL must yield a [google.protobuf.Type][] + # value in binary format, or produce an error. + # * Applications are allowed to cache lookup results based on the + # URL, or have them precompiled into a binary to avoid any + # lookup. Therefore, binary compatibility needs to be preserved + # on changes to types. (Use versioned type names to manage + # breaking changes.) + # + # Note: this functionality is not currently available in the official + # protobuf release, and it is not used for type URLs beginning with + # type.googleapis.com. As of May 2023, there are no widely used type server + # implementations and no plans to implement one. + # + # Schemes other than `http`, `https` (or the empty scheme) might be + # used with implementation specific semantics. + # @!attribute [rw] value + # @return [::String] + # Must be a valid serialized protocol buffer of the above specified type. + class Any + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/duration.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/duration.rb new file mode 100644 index 000000000000..ea59f1f91daf --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/duration.rb @@ -0,0 +1,98 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Protobuf + # A Duration represents a signed, fixed-length span of time represented + # as a count of seconds and fractions of seconds at nanosecond + # resolution. It is independent of any calendar and concepts like "day" + # or "month". It is related to Timestamp in that the difference between + # two Timestamp values is a Duration and it can be added or subtracted + # from a Timestamp. Range is approximately +-10,000 years. + # + # # Examples + # + # Example 1: Compute Duration from two Timestamps in pseudo code. + # + # Timestamp start = ...; + # Timestamp end = ...; + # Duration duration = ...; + # + # duration.seconds = end.seconds - start.seconds; + # duration.nanos = end.nanos - start.nanos; + # + # if (duration.seconds < 0 && duration.nanos > 0) { + # duration.seconds += 1; + # duration.nanos -= 1000000000; + # } else if (duration.seconds > 0 && duration.nanos < 0) { + # duration.seconds -= 1; + # duration.nanos += 1000000000; + # } + # + # Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. + # + # Timestamp start = ...; + # Duration duration = ...; + # Timestamp end = ...; + # + # end.seconds = start.seconds + duration.seconds; + # end.nanos = start.nanos + duration.nanos; + # + # if (end.nanos < 0) { + # end.seconds -= 1; + # end.nanos += 1000000000; + # } else if (end.nanos >= 1000000000) { + # end.seconds += 1; + # end.nanos -= 1000000000; + # } + # + # Example 3: Compute Duration from datetime.timedelta in Python. + # + # td = datetime.timedelta(days=3, minutes=10) + # duration = Duration() + # duration.FromTimedelta(td) + # + # # JSON Mapping + # + # In JSON format, the Duration type is encoded as a string rather than an + # object, where the string ends in the suffix "s" (indicating seconds) and + # is preceded by the number of seconds, with nanoseconds expressed as + # fractional seconds. For example, 3 seconds with 0 nanoseconds should be + # encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should + # be expressed in JSON format as "3.000000001s", and 3 seconds and 1 + # microsecond should be expressed in JSON format as "3.000001s". + # @!attribute [rw] seconds + # @return [::Integer] + # Signed seconds of the span of time. Must be from -315,576,000,000 + # to +315,576,000,000 inclusive. Note: these bounds are computed from: + # 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years + # @!attribute [rw] nanos + # @return [::Integer] + # Signed fractions of a second at nanosecond resolution of the span + # of time. Durations less than one second are represented with a 0 + # `seconds` field and a positive or negative `nanos` field. For durations + # of one second or more, a non-zero value for the `nanos` field must be + # of the same sign as the `seconds` field. Must be from -999,999,999 + # to +999,999,999 inclusive. + class Duration + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/empty.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/empty.rb new file mode 100644 index 000000000000..83e4481834a6 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/empty.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Protobuf + # A generic empty message that you can re-use to avoid defining duplicated + # empty messages in your APIs. A typical example is to use it as the request + # or the response type of an API method. For instance: + # + # service Foo { + # rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + # } + class Empty + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/field_mask.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/field_mask.rb new file mode 100644 index 000000000000..7f3ffc78601a --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/field_mask.rb @@ -0,0 +1,229 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Protobuf + # `FieldMask` represents a set of symbolic field paths, for example: + # + # paths: "f.a" + # paths: "f.b.d" + # + # Here `f` represents a field in some root message, `a` and `b` + # fields in the message found in `f`, and `d` a field found in the + # message in `f.b`. + # + # Field masks are used to specify a subset of fields that should be + # returned by a get operation or modified by an update operation. + # Field masks also have a custom JSON encoding (see below). + # + # # Field Masks in Projections + # + # When used in the context of a projection, a response message or + # sub-message is filtered by the API to only contain those fields as + # specified in the mask. For example, if the mask in the previous + # example is applied to a response message as follows: + # + # f { + # a : 22 + # b { + # d : 1 + # x : 2 + # } + # y : 13 + # } + # z: 8 + # + # The result will not contain specific values for fields x,y and z + # (their value will be set to the default, and omitted in proto text + # output): + # + # + # f { + # a : 22 + # b { + # d : 1 + # } + # } + # + # A repeated field is not allowed except at the last position of a + # paths string. + # + # If a FieldMask object is not present in a get operation, the + # operation applies to all fields (as if a FieldMask of all fields + # had been specified). + # + # Note that a field mask does not necessarily apply to the + # top-level response message. In case of a REST get operation, the + # field mask applies directly to the response, but in case of a REST + # list operation, the mask instead applies to each individual message + # in the returned resource list. In case of a REST custom method, + # other definitions may be used. Where the mask applies will be + # clearly documented together with its declaration in the API. In + # any case, the effect on the returned resource/resources is required + # behavior for APIs. + # + # # Field Masks in Update Operations + # + # A field mask in update operations specifies which fields of the + # targeted resource are going to be updated. The API is required + # to only change the values of the fields as specified in the mask + # and leave the others untouched. If a resource is passed in to + # describe the updated values, the API ignores the values of all + # fields not covered by the mask. + # + # If a repeated field is specified for an update operation, new values will + # be appended to the existing repeated field in the target resource. Note that + # a repeated field is only allowed in the last position of a `paths` string. + # + # If a sub-message is specified in the last position of the field mask for an + # update operation, then new value will be merged into the existing sub-message + # in the target resource. + # + # For example, given the target message: + # + # f { + # b { + # d: 1 + # x: 2 + # } + # c: [1] + # } + # + # And an update message: + # + # f { + # b { + # d: 10 + # } + # c: [2] + # } + # + # then if the field mask is: + # + # paths: ["f.b", "f.c"] + # + # then the result will be: + # + # f { + # b { + # d: 10 + # x: 2 + # } + # c: [1, 2] + # } + # + # An implementation may provide options to override this default behavior for + # repeated and message fields. + # + # In order to reset a field's value to the default, the field must + # be in the mask and set to the default value in the provided resource. + # Hence, in order to reset all fields of a resource, provide a default + # instance of the resource and set all fields in the mask, or do + # not provide a mask as described below. + # + # If a field mask is not present on update, the operation applies to + # all fields (as if a field mask of all fields has been specified). + # Note that in the presence of schema evolution, this may mean that + # fields the client does not know and has therefore not filled into + # the request will be reset to their default. If this is unwanted + # behavior, a specific service may require a client to always specify + # a field mask, producing an error if not. + # + # As with get operations, the location of the resource which + # describes the updated values in the request message depends on the + # operation kind. In any case, the effect of the field mask is + # required to be honored by the API. + # + # ## Considerations for HTTP REST + # + # The HTTP kind of an update operation which uses a field mask must + # be set to PATCH instead of PUT in order to satisfy HTTP semantics + # (PUT must only be used for full updates). + # + # # JSON Encoding of Field Masks + # + # In JSON, a field mask is encoded as a single string where paths are + # separated by a comma. Fields name in each path are converted + # to/from lower-camel naming conventions. + # + # As an example, consider the following message declarations: + # + # message Profile { + # User user = 1; + # Photo photo = 2; + # } + # message User { + # string display_name = 1; + # string address = 2; + # } + # + # In proto a field mask for `Profile` may look as such: + # + # mask { + # paths: "user.display_name" + # paths: "photo" + # } + # + # In JSON, the same mask is represented as below: + # + # { + # mask: "user.displayName,photo" + # } + # + # # Field Masks and Oneof Fields + # + # Field masks treat fields in oneofs just as regular fields. Consider the + # following message: + # + # message SampleMessage { + # oneof test_oneof { + # string name = 4; + # SubMessage sub_message = 9; + # } + # } + # + # The field mask can be: + # + # mask { + # paths: "name" + # } + # + # Or: + # + # mask { + # paths: "sub_message" + # } + # + # Note that oneof type names ("test_oneof" in this case) cannot be used in + # paths. + # + # ## Field Mask Verification + # + # The implementation of any API method which has a FieldMask type field in the + # request should verify the included field paths, and return an + # `INVALID_ARGUMENT` error if any path is unmappable. + # @!attribute [rw] paths + # @return [::Array<::String>] + # The set of field mask paths. + class FieldMask + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/struct.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/struct.rb new file mode 100644 index 000000000000..39e1aca868d2 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/struct.rb @@ -0,0 +1,108 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Protobuf + # `Struct` represents a structured data value, consisting of fields + # which map to dynamically typed values. In some languages, `Struct` + # might be supported by a native representation. For example, in + # scripting languages like JS a struct is represented as an + # object. The details of that representation are described together + # with the proto support for the language. + # + # The JSON representation for `Struct` is JSON object. + # @!attribute [rw] fields + # @return [::Google::Protobuf::Map{::String => ::Google::Protobuf::Value}] + # Unordered map of dynamically typed values. + class Struct + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # @!attribute [rw] key + # @return [::String] + # @!attribute [rw] value + # @return [::Google::Protobuf::Value] + class FieldsEntry + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end + + # `Value` represents a dynamically typed value which can be either + # null, a number, a string, a boolean, a recursive struct value, or a + # list of values. A producer of value is expected to set one of these + # variants. Absence of any variant indicates an error. + # + # The JSON representation for `Value` is JSON value. + # @!attribute [rw] null_value + # @return [::Google::Protobuf::NullValue] + # Represents a null value. + # + # Note: The following fields are mutually exclusive: `null_value`, `number_value`, `string_value`, `bool_value`, `struct_value`, `list_value`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [rw] number_value + # @return [::Float] + # Represents a double value. + # + # Note: The following fields are mutually exclusive: `number_value`, `null_value`, `string_value`, `bool_value`, `struct_value`, `list_value`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [rw] string_value + # @return [::String] + # Represents a string value. + # + # Note: The following fields are mutually exclusive: `string_value`, `null_value`, `number_value`, `bool_value`, `struct_value`, `list_value`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [rw] bool_value + # @return [::Boolean] + # Represents a boolean value. + # + # Note: The following fields are mutually exclusive: `bool_value`, `null_value`, `number_value`, `string_value`, `struct_value`, `list_value`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [rw] struct_value + # @return [::Google::Protobuf::Struct] + # Represents a structured value. + # + # Note: The following fields are mutually exclusive: `struct_value`, `null_value`, `number_value`, `string_value`, `bool_value`, `list_value`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [rw] list_value + # @return [::Google::Protobuf::ListValue] + # Represents a repeated `Value`. + # + # Note: The following fields are mutually exclusive: `list_value`, `null_value`, `number_value`, `string_value`, `bool_value`, `struct_value`. If a field in that set is populated, all other fields in the set will automatically be cleared. + class Value + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # `ListValue` is a wrapper around a repeated field of values. + # + # The JSON representation for `ListValue` is JSON array. + # @!attribute [rw] values + # @return [::Array<::Google::Protobuf::Value>] + # Repeated field of dynamically typed values. + class ListValue + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # `NullValue` is a singleton enumeration to represent the null value for the + # `Value` type union. + # + # The JSON representation for `NullValue` is JSON `null`. + module NullValue + # Null value. + NULL_VALUE = 0 + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/timestamp.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/timestamp.rb new file mode 100644 index 000000000000..e58202461f88 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/timestamp.rb @@ -0,0 +1,128 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Protobuf + # A Timestamp represents a point in time independent of any time zone or local + # calendar, encoded as a count of seconds and fractions of seconds at + # nanosecond resolution. The count is relative to an epoch at UTC midnight on + # January 1, 1970, in the proleptic Gregorian calendar which extends the + # Gregorian calendar backwards to year one. + # + # All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap + # second table is needed for interpretation, using a [24-hour linear + # smear](https://developers.google.com/time/smear). + # + # The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By + # restricting to that range, we ensure that we can convert to and from [RFC + # 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. + # + # # Examples + # + # Example 1: Compute Timestamp from POSIX `time()`. + # + # Timestamp timestamp; + # timestamp.set_seconds(time(NULL)); + # timestamp.set_nanos(0); + # + # Example 2: Compute Timestamp from POSIX `gettimeofday()`. + # + # struct timeval tv; + # gettimeofday(&tv, NULL); + # + # Timestamp timestamp; + # timestamp.set_seconds(tv.tv_sec); + # timestamp.set_nanos(tv.tv_usec * 1000); + # + # Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. + # + # FILETIME ft; + # GetSystemTimeAsFileTime(&ft); + # UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; + # + # // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z + # // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. + # Timestamp timestamp; + # timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); + # timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); + # + # Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. + # + # long millis = System.currentTimeMillis(); + # + # Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) + # .setNanos((int) ((millis % 1000) * 1000000)).build(); + # + # Example 5: Compute Timestamp from Java `Instant.now()`. + # + # Instant now = Instant.now(); + # + # Timestamp timestamp = + # Timestamp.newBuilder().setSeconds(now.getEpochSecond()) + # .setNanos(now.getNano()).build(); + # + # Example 6: Compute Timestamp from current time in Python. + # + # timestamp = Timestamp() + # timestamp.GetCurrentTime() + # + # # JSON Mapping + # + # In JSON format, the Timestamp type is encoded as a string in the + # [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the + # format is "\\{year}-\\{month}-\\{day}T\\{hour}:\\{min}:\\{sec}[.\\{frac_sec}]Z" + # where \\{year} is always expressed using four digits while \\{month}, \\{day}, + # \\{hour}, \\{min}, and \\{sec} are zero-padded to two digits each. The fractional + # seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), + # are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone + # is required. A proto3 JSON serializer should always use UTC (as indicated by + # "Z") when printing the Timestamp type and a proto3 JSON parser should be + # able to accept both UTC and other timezones (as indicated by an offset). + # + # For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past + # 01:30 UTC on January 15, 2017. + # + # In JavaScript, one can convert a Date object to this format using the + # standard + # [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) + # method. In Python, a standard `datetime.datetime` object can be converted + # to this format using + # [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with + # the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use + # the Joda Time's [`ISODateTimeFormat.dateTime()`]( + # http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime() + # ) to obtain a formatter capable of generating timestamps in this format. + # @!attribute [rw] seconds + # @return [::Integer] + # Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must + # be between -315576000000 and 315576000000 inclusive (which corresponds to + # 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z). + # @!attribute [rw] nanos + # @return [::Integer] + # Non-negative fractions of a second at nanosecond resolution. This field is + # the nanosecond portion of the duration, not an alternative to seconds. + # Negative second values with fractions must still have non-negative nanos + # values that count forward in time. Must be between 0 and 999,999,999 + # inclusive. + class Timestamp + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/wrappers.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/wrappers.rb new file mode 100644 index 000000000000..9a7c0269fa42 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/wrappers.rb @@ -0,0 +1,148 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Protobuf + # Wrapper message for `double`. + # + # The JSON representation for `DoubleValue` is JSON number. + # + # Not recommended for use in new APIs, but still useful for legacy APIs and + # has no plan to be removed. + # @!attribute [rw] value + # @return [::Float] + # The double value. + class DoubleValue + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Wrapper message for `float`. + # + # The JSON representation for `FloatValue` is JSON number. + # + # Not recommended for use in new APIs, but still useful for legacy APIs and + # has no plan to be removed. + # @!attribute [rw] value + # @return [::Float] + # The float value. + class FloatValue + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Wrapper message for `int64`. + # + # The JSON representation for `Int64Value` is JSON string. + # + # Not recommended for use in new APIs, but still useful for legacy APIs and + # has no plan to be removed. + # @!attribute [rw] value + # @return [::Integer] + # The int64 value. + class Int64Value + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Wrapper message for `uint64`. + # + # The JSON representation for `UInt64Value` is JSON string. + # + # Not recommended for use in new APIs, but still useful for legacy APIs and + # has no plan to be removed. + # @!attribute [rw] value + # @return [::Integer] + # The uint64 value. + class UInt64Value + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Wrapper message for `int32`. + # + # The JSON representation for `Int32Value` is JSON number. + # + # Not recommended for use in new APIs, but still useful for legacy APIs and + # has no plan to be removed. + # @!attribute [rw] value + # @return [::Integer] + # The int32 value. + class Int32Value + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Wrapper message for `uint32`. + # + # The JSON representation for `UInt32Value` is JSON number. + # + # Not recommended for use in new APIs, but still useful for legacy APIs and + # has no plan to be removed. + # @!attribute [rw] value + # @return [::Integer] + # The uint32 value. + class UInt32Value + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Wrapper message for `bool`. + # + # The JSON representation for `BoolValue` is JSON `true` and `false`. + # + # Not recommended for use in new APIs, but still useful for legacy APIs and + # has no plan to be removed. + # @!attribute [rw] value + # @return [::Boolean] + # The bool value. + class BoolValue + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Wrapper message for `string`. + # + # The JSON representation for `StringValue` is JSON string. + # + # Not recommended for use in new APIs, but still useful for legacy APIs and + # has no plan to be removed. + # @!attribute [rw] value + # @return [::String] + # The string value. + class StringValue + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Wrapper message for `bytes`. + # + # The JSON representation for `BytesValue` is JSON string. + # + # Not recommended for use in new APIs, but still useful for legacy APIs and + # has no plan to be removed. + # @!attribute [rw] value + # @return [::String] + # The bytes value. + class BytesValue + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/rpc/status.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/rpc/status.rb new file mode 100644 index 000000000000..c1a1c07eb2db --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/rpc/status.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Rpc + # The `Status` type defines a logical error model that is suitable for + # different programming environments, including REST APIs and RPC APIs. It is + # used by [gRPC](https://github.com/grpc). Each `Status` message contains + # three pieces of data: error code, error message, and error details. + # + # You can find out more about this error model and how to work with it in the + # [API Design Guide](https://cloud.google.com/apis/design/errors). + # @!attribute [rw] code + # @return [::Integer] + # The status code, which should be an enum value of + # [google.rpc.Code][google.rpc.Code]. + # @!attribute [rw] message + # @return [::String] + # A developer-facing error message, which should be in English. Any + # user-facing error message should be localized and sent in the + # {::Google::Rpc::Status#details google.rpc.Status.details} field, or localized + # by the client. + # @!attribute [rw] details + # @return [::Array<::Google::Protobuf::Any>] + # A list of messages that carry the error details. There is a common set of + # message types for APIs to use. + class Status + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/type/date.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/type/date.rb new file mode 100644 index 000000000000..a52275cebf89 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/type/date.rb @@ -0,0 +1,56 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Type + # Represents a whole or partial calendar date, such as a birthday. The time of + # day and time zone are either specified elsewhere or are insignificant. The + # date is relative to the Gregorian Calendar. This can represent one of the + # following: + # + # * A full date, with non-zero year, month, and day values. + # * A month and day, with a zero year (for example, an anniversary). + # * A year on its own, with a zero month and a zero day. + # * A year and month, with a zero day (for example, a credit card expiration + # date). + # + # Related types: + # + # * [google.type.TimeOfDay][google.type.TimeOfDay] + # * [google.type.DateTime][google.type.DateTime] + # * {::Google::Protobuf::Timestamp google.protobuf.Timestamp} + # @!attribute [rw] year + # @return [::Integer] + # Year of the date. Must be from 1 to 9999, or 0 to specify a date without + # a year. + # @!attribute [rw] month + # @return [::Integer] + # Month of a year. Must be from 1 to 12, or 0 to specify a year without a + # month and day. + # @!attribute [rw] day + # @return [::Integer] + # Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 + # to specify a year by itself or a year and month where the day isn't + # significant. + class Date + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/Gemfile b/owl-bot-staging/google-cloud-retail-v2/snippets/Gemfile new file mode 100644 index 000000000000..d2cc0c1eb2ed --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/Gemfile @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +source "https://rubygems.org" + +if ENV["GOOGLE_CLOUD_SAMPLES_TEST"] == "master" + gem "google-cloud-retail-v2", path: "../" +else + gem "google-cloud-retail-v2" +end + +group :test do + gem "google-style", "~> 1.26.1" + gem "minitest", "~> 5.16" + gem "minitest-focus", "~> 1.1" + gem "minitest-hooks", "~> 1.5" +end diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/analytics_service/export_analytics_metrics.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/analytics_service/export_analytics_metrics.rb new file mode 100644 index 000000000000..f5249b7f1e32 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/analytics_service/export_analytics_metrics.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_AnalyticsService_ExportAnalyticsMetrics_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the export_analytics_metrics call in the AnalyticsService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::AnalyticsService::Client#export_analytics_metrics. +# +def export_analytics_metrics + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::AnalyticsService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::ExportAnalyticsMetricsRequest.new + + # Call the export_analytics_metrics method. + result = client.export_analytics_metrics request + + # The returned object is of type Gapic::Operation. You can use it to + # check the status of an operation, cancel it, or wait for results. + # Here is how to wait for a response. + result.wait_until_done! timeout: 60 + if result.response? + p result.response + else + puts "No response received." + end +end +# [END retail_v2_generated_AnalyticsService_ExportAnalyticsMetrics_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/add_catalog_attribute.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/add_catalog_attribute.rb new file mode 100644 index 000000000000..dc85a92e6277 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/add_catalog_attribute.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_CatalogService_AddCatalogAttribute_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the add_catalog_attribute call in the CatalogService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::CatalogService::Client#add_catalog_attribute. +# +def add_catalog_attribute + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::CatalogService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::AddCatalogAttributeRequest.new + + # Call the add_catalog_attribute method. + result = client.add_catalog_attribute request + + # The returned object is of type Google::Cloud::Retail::V2::AttributesConfig. + p result +end +# [END retail_v2_generated_CatalogService_AddCatalogAttribute_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/get_attributes_config.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/get_attributes_config.rb new file mode 100644 index 000000000000..cb21a1f8e879 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/get_attributes_config.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_CatalogService_GetAttributesConfig_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the get_attributes_config call in the CatalogService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::CatalogService::Client#get_attributes_config. +# +def get_attributes_config + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::CatalogService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::GetAttributesConfigRequest.new + + # Call the get_attributes_config method. + result = client.get_attributes_config request + + # The returned object is of type Google::Cloud::Retail::V2::AttributesConfig. + p result +end +# [END retail_v2_generated_CatalogService_GetAttributesConfig_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/get_completion_config.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/get_completion_config.rb new file mode 100644 index 000000000000..1668c703deda --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/get_completion_config.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_CatalogService_GetCompletionConfig_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the get_completion_config call in the CatalogService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::CatalogService::Client#get_completion_config. +# +def get_completion_config + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::CatalogService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::GetCompletionConfigRequest.new + + # Call the get_completion_config method. + result = client.get_completion_config request + + # The returned object is of type Google::Cloud::Retail::V2::CompletionConfig. + p result +end +# [END retail_v2_generated_CatalogService_GetCompletionConfig_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/get_default_branch.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/get_default_branch.rb new file mode 100644 index 000000000000..a7c5c47a999d --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/get_default_branch.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_CatalogService_GetDefaultBranch_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the get_default_branch call in the CatalogService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::CatalogService::Client#get_default_branch. +# +def get_default_branch + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::CatalogService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::GetDefaultBranchRequest.new + + # Call the get_default_branch method. + result = client.get_default_branch request + + # The returned object is of type Google::Cloud::Retail::V2::GetDefaultBranchResponse. + p result +end +# [END retail_v2_generated_CatalogService_GetDefaultBranch_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/list_catalogs.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/list_catalogs.rb new file mode 100644 index 000000000000..27f668be91bd --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/list_catalogs.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_CatalogService_ListCatalogs_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the list_catalogs call in the CatalogService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::CatalogService::Client#list_catalogs. +# +def list_catalogs + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::CatalogService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::ListCatalogsRequest.new + + # Call the list_catalogs method. + result = client.list_catalogs request + + # The returned object is of type Gapic::PagedEnumerable. You can iterate + # over elements, and API calls will be issued to fetch pages as needed. + result.each do |item| + # Each element is of type ::Google::Cloud::Retail::V2::Catalog. + p item + end +end +# [END retail_v2_generated_CatalogService_ListCatalogs_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/remove_catalog_attribute.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/remove_catalog_attribute.rb new file mode 100644 index 000000000000..7e0a01dc5446 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/remove_catalog_attribute.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_CatalogService_RemoveCatalogAttribute_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the remove_catalog_attribute call in the CatalogService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::CatalogService::Client#remove_catalog_attribute. +# +def remove_catalog_attribute + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::CatalogService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::RemoveCatalogAttributeRequest.new + + # Call the remove_catalog_attribute method. + result = client.remove_catalog_attribute request + + # The returned object is of type Google::Cloud::Retail::V2::AttributesConfig. + p result +end +# [END retail_v2_generated_CatalogService_RemoveCatalogAttribute_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/replace_catalog_attribute.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/replace_catalog_attribute.rb new file mode 100644 index 000000000000..7b7e35e9755b --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/replace_catalog_attribute.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_CatalogService_ReplaceCatalogAttribute_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the replace_catalog_attribute call in the CatalogService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::CatalogService::Client#replace_catalog_attribute. +# +def replace_catalog_attribute + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::CatalogService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::ReplaceCatalogAttributeRequest.new + + # Call the replace_catalog_attribute method. + result = client.replace_catalog_attribute request + + # The returned object is of type Google::Cloud::Retail::V2::AttributesConfig. + p result +end +# [END retail_v2_generated_CatalogService_ReplaceCatalogAttribute_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/set_default_branch.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/set_default_branch.rb new file mode 100644 index 000000000000..9c0d64022fa4 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/set_default_branch.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_CatalogService_SetDefaultBranch_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the set_default_branch call in the CatalogService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::CatalogService::Client#set_default_branch. +# +def set_default_branch + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::CatalogService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::SetDefaultBranchRequest.new + + # Call the set_default_branch method. + result = client.set_default_branch request + + # The returned object is of type Google::Protobuf::Empty. + p result +end +# [END retail_v2_generated_CatalogService_SetDefaultBranch_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/update_attributes_config.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/update_attributes_config.rb new file mode 100644 index 000000000000..1b5fc7f4253a --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/update_attributes_config.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_CatalogService_UpdateAttributesConfig_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the update_attributes_config call in the CatalogService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::CatalogService::Client#update_attributes_config. +# +def update_attributes_config + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::CatalogService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::UpdateAttributesConfigRequest.new + + # Call the update_attributes_config method. + result = client.update_attributes_config request + + # The returned object is of type Google::Cloud::Retail::V2::AttributesConfig. + p result +end +# [END retail_v2_generated_CatalogService_UpdateAttributesConfig_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/update_catalog.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/update_catalog.rb new file mode 100644 index 000000000000..ea0eaa4f2b83 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/update_catalog.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_CatalogService_UpdateCatalog_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the update_catalog call in the CatalogService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::CatalogService::Client#update_catalog. +# +def update_catalog + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::CatalogService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::UpdateCatalogRequest.new + + # Call the update_catalog method. + result = client.update_catalog request + + # The returned object is of type Google::Cloud::Retail::V2::Catalog. + p result +end +# [END retail_v2_generated_CatalogService_UpdateCatalog_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/update_completion_config.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/update_completion_config.rb new file mode 100644 index 000000000000..5d8036e6732d --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/update_completion_config.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_CatalogService_UpdateCompletionConfig_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the update_completion_config call in the CatalogService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::CatalogService::Client#update_completion_config. +# +def update_completion_config + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::CatalogService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::UpdateCompletionConfigRequest.new + + # Call the update_completion_config method. + result = client.update_completion_config request + + # The returned object is of type Google::Cloud::Retail::V2::CompletionConfig. + p result +end +# [END retail_v2_generated_CatalogService_UpdateCompletionConfig_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/completion_service/complete_query.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/completion_service/complete_query.rb new file mode 100644 index 000000000000..874d7cee8d67 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/completion_service/complete_query.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_CompletionService_CompleteQuery_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the complete_query call in the CompletionService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::CompletionService::Client#complete_query. +# +def complete_query + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::CompletionService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::CompleteQueryRequest.new + + # Call the complete_query method. + result = client.complete_query request + + # The returned object is of type Google::Cloud::Retail::V2::CompleteQueryResponse. + p result +end +# [END retail_v2_generated_CompletionService_CompleteQuery_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/completion_service/import_completion_data.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/completion_service/import_completion_data.rb new file mode 100644 index 000000000000..fe1f28f0844e --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/completion_service/import_completion_data.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_CompletionService_ImportCompletionData_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the import_completion_data call in the CompletionService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::CompletionService::Client#import_completion_data. +# +def import_completion_data + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::CompletionService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::ImportCompletionDataRequest.new + + # Call the import_completion_data method. + result = client.import_completion_data request + + # The returned object is of type Gapic::Operation. You can use it to + # check the status of an operation, cancel it, or wait for results. + # Here is how to wait for a response. + result.wait_until_done! timeout: 60 + if result.response? + p result.response + else + puts "No response received." + end +end +# [END retail_v2_generated_CompletionService_ImportCompletionData_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/control_service/create_control.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/control_service/create_control.rb new file mode 100644 index 000000000000..32b89537acd9 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/control_service/create_control.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_ControlService_CreateControl_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the create_control call in the ControlService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::ControlService::Client#create_control. +# +def create_control + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::ControlService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::CreateControlRequest.new + + # Call the create_control method. + result = client.create_control request + + # The returned object is of type Google::Cloud::Retail::V2::Control. + p result +end +# [END retail_v2_generated_ControlService_CreateControl_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/control_service/delete_control.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/control_service/delete_control.rb new file mode 100644 index 000000000000..42aa73e1063a --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/control_service/delete_control.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_ControlService_DeleteControl_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the delete_control call in the ControlService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::ControlService::Client#delete_control. +# +def delete_control + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::ControlService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::DeleteControlRequest.new + + # Call the delete_control method. + result = client.delete_control request + + # The returned object is of type Google::Protobuf::Empty. + p result +end +# [END retail_v2_generated_ControlService_DeleteControl_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/control_service/get_control.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/control_service/get_control.rb new file mode 100644 index 000000000000..2785feb65202 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/control_service/get_control.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_ControlService_GetControl_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the get_control call in the ControlService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::ControlService::Client#get_control. +# +def get_control + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::ControlService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::GetControlRequest.new + + # Call the get_control method. + result = client.get_control request + + # The returned object is of type Google::Cloud::Retail::V2::Control. + p result +end +# [END retail_v2_generated_ControlService_GetControl_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/control_service/list_controls.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/control_service/list_controls.rb new file mode 100644 index 000000000000..7394fdd3076a --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/control_service/list_controls.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_ControlService_ListControls_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the list_controls call in the ControlService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::ControlService::Client#list_controls. +# +def list_controls + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::ControlService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::ListControlsRequest.new + + # Call the list_controls method. + result = client.list_controls request + + # The returned object is of type Gapic::PagedEnumerable. You can iterate + # over elements, and API calls will be issued to fetch pages as needed. + result.each do |item| + # Each element is of type ::Google::Cloud::Retail::V2::Control. + p item + end +end +# [END retail_v2_generated_ControlService_ListControls_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/control_service/update_control.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/control_service/update_control.rb new file mode 100644 index 000000000000..f3bf5821b03b --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/control_service/update_control.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_ControlService_UpdateControl_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the update_control call in the ControlService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::ControlService::Client#update_control. +# +def update_control + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::ControlService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::UpdateControlRequest.new + + # Call the update_control method. + result = client.update_control request + + # The returned object is of type Google::Cloud::Retail::V2::Control. + p result +end +# [END retail_v2_generated_ControlService_UpdateControl_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/conversational_search_service/conversational_search.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/conversational_search_service/conversational_search.rb new file mode 100644 index 000000000000..19ab711ac479 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/conversational_search_service/conversational_search.rb @@ -0,0 +1,50 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_ConversationalSearchService_ConversationalSearch_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the conversational_search call in the ConversationalSearchService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::ConversationalSearchService::Client#conversational_search. +# +def conversational_search + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::ConversationalSearchService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::ConversationalSearchRequest.new + + # Call the conversational_search method to start streaming. + output = client.conversational_search request + + # The returned object is a streamed enumerable yielding elements of type + # ::Google::Cloud::Retail::V2::ConversationalSearchResponse + output.each do |current_response| + p current_response + end +end +# [END retail_v2_generated_ConversationalSearchService_ConversationalSearch_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/generative_question_service/batch_update_generative_question_configs.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/generative_question_service/batch_update_generative_question_configs.rb new file mode 100644 index 000000000000..ec7f82414dea --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/generative_question_service/batch_update_generative_question_configs.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_GenerativeQuestionService_BatchUpdateGenerativeQuestionConfigs_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the batch_update_generative_question_configs call in the GenerativeQuestionService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::GenerativeQuestionService::Client#batch_update_generative_question_configs. +# +def batch_update_generative_question_configs + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::GenerativeQuestionService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsRequest.new + + # Call the batch_update_generative_question_configs method. + result = client.batch_update_generative_question_configs request + + # The returned object is of type Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsResponse. + p result +end +# [END retail_v2_generated_GenerativeQuestionService_BatchUpdateGenerativeQuestionConfigs_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/generative_question_service/get_generative_questions_feature_config.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/generative_question_service/get_generative_questions_feature_config.rb new file mode 100644 index 000000000000..d9b400ceed6d --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/generative_question_service/get_generative_questions_feature_config.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_GenerativeQuestionService_GetGenerativeQuestionsFeatureConfig_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the get_generative_questions_feature_config call in the GenerativeQuestionService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::GenerativeQuestionService::Client#get_generative_questions_feature_config. +# +def get_generative_questions_feature_config + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::GenerativeQuestionService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::GetGenerativeQuestionsFeatureConfigRequest.new + + # Call the get_generative_questions_feature_config method. + result = client.get_generative_questions_feature_config request + + # The returned object is of type Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig. + p result +end +# [END retail_v2_generated_GenerativeQuestionService_GetGenerativeQuestionsFeatureConfig_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/generative_question_service/list_generative_question_configs.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/generative_question_service/list_generative_question_configs.rb new file mode 100644 index 000000000000..66d6f2d20042 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/generative_question_service/list_generative_question_configs.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_GenerativeQuestionService_ListGenerativeQuestionConfigs_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the list_generative_question_configs call in the GenerativeQuestionService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::GenerativeQuestionService::Client#list_generative_question_configs. +# +def list_generative_question_configs + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::GenerativeQuestionService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsRequest.new + + # Call the list_generative_question_configs method. + result = client.list_generative_question_configs request + + # The returned object is of type Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsResponse. + p result +end +# [END retail_v2_generated_GenerativeQuestionService_ListGenerativeQuestionConfigs_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/generative_question_service/update_generative_question_config.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/generative_question_service/update_generative_question_config.rb new file mode 100644 index 000000000000..73faa0a00347 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/generative_question_service/update_generative_question_config.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_GenerativeQuestionService_UpdateGenerativeQuestionConfig_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the update_generative_question_config call in the GenerativeQuestionService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::GenerativeQuestionService::Client#update_generative_question_config. +# +def update_generative_question_config + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::GenerativeQuestionService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::UpdateGenerativeQuestionConfigRequest.new + + # Call the update_generative_question_config method. + result = client.update_generative_question_config request + + # The returned object is of type Google::Cloud::Retail::V2::GenerativeQuestionConfig. + p result +end +# [END retail_v2_generated_GenerativeQuestionService_UpdateGenerativeQuestionConfig_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/generative_question_service/update_generative_questions_feature_config.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/generative_question_service/update_generative_questions_feature_config.rb new file mode 100644 index 000000000000..edec3d61d8a8 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/generative_question_service/update_generative_questions_feature_config.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_GenerativeQuestionService_UpdateGenerativeQuestionsFeatureConfig_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the update_generative_questions_feature_config call in the GenerativeQuestionService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::GenerativeQuestionService::Client#update_generative_questions_feature_config. +# +def update_generative_questions_feature_config + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::GenerativeQuestionService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::UpdateGenerativeQuestionsFeatureConfigRequest.new + + # Call the update_generative_questions_feature_config method. + result = client.update_generative_questions_feature_config request + + # The returned object is of type Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig. + p result +end +# [END retail_v2_generated_GenerativeQuestionService_UpdateGenerativeQuestionsFeatureConfig_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/model_service/create_model.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/model_service/create_model.rb new file mode 100644 index 000000000000..ffbfd59f4a13 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/model_service/create_model.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_ModelService_CreateModel_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the create_model call in the ModelService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::ModelService::Client#create_model. +# +def create_model + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::ModelService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::CreateModelRequest.new + + # Call the create_model method. + result = client.create_model request + + # The returned object is of type Gapic::Operation. You can use it to + # check the status of an operation, cancel it, or wait for results. + # Here is how to wait for a response. + result.wait_until_done! timeout: 60 + if result.response? + p result.response + else + puts "No response received." + end +end +# [END retail_v2_generated_ModelService_CreateModel_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/model_service/delete_model.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/model_service/delete_model.rb new file mode 100644 index 000000000000..8a92e3fe6c8e --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/model_service/delete_model.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_ModelService_DeleteModel_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the delete_model call in the ModelService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::ModelService::Client#delete_model. +# +def delete_model + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::ModelService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::DeleteModelRequest.new + + # Call the delete_model method. + result = client.delete_model request + + # The returned object is of type Google::Protobuf::Empty. + p result +end +# [END retail_v2_generated_ModelService_DeleteModel_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/model_service/get_model.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/model_service/get_model.rb new file mode 100644 index 000000000000..8ca949873471 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/model_service/get_model.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_ModelService_GetModel_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the get_model call in the ModelService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::ModelService::Client#get_model. +# +def get_model + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::ModelService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::GetModelRequest.new + + # Call the get_model method. + result = client.get_model request + + # The returned object is of type Google::Cloud::Retail::V2::Model. + p result +end +# [END retail_v2_generated_ModelService_GetModel_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/model_service/list_models.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/model_service/list_models.rb new file mode 100644 index 000000000000..a652ccbdc26a --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/model_service/list_models.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_ModelService_ListModels_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the list_models call in the ModelService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::ModelService::Client#list_models. +# +def list_models + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::ModelService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::ListModelsRequest.new + + # Call the list_models method. + result = client.list_models request + + # The returned object is of type Gapic::PagedEnumerable. You can iterate + # over elements, and API calls will be issued to fetch pages as needed. + result.each do |item| + # Each element is of type ::Google::Cloud::Retail::V2::Model. + p item + end +end +# [END retail_v2_generated_ModelService_ListModels_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/model_service/pause_model.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/model_service/pause_model.rb new file mode 100644 index 000000000000..d563bf2a6c88 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/model_service/pause_model.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_ModelService_PauseModel_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the pause_model call in the ModelService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::ModelService::Client#pause_model. +# +def pause_model + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::ModelService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::PauseModelRequest.new + + # Call the pause_model method. + result = client.pause_model request + + # The returned object is of type Google::Cloud::Retail::V2::Model. + p result +end +# [END retail_v2_generated_ModelService_PauseModel_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/model_service/resume_model.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/model_service/resume_model.rb new file mode 100644 index 000000000000..175e84817b36 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/model_service/resume_model.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_ModelService_ResumeModel_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the resume_model call in the ModelService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::ModelService::Client#resume_model. +# +def resume_model + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::ModelService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::ResumeModelRequest.new + + # Call the resume_model method. + result = client.resume_model request + + # The returned object is of type Google::Cloud::Retail::V2::Model. + p result +end +# [END retail_v2_generated_ModelService_ResumeModel_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/model_service/tune_model.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/model_service/tune_model.rb new file mode 100644 index 000000000000..8b60f30ed5ee --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/model_service/tune_model.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_ModelService_TuneModel_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the tune_model call in the ModelService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::ModelService::Client#tune_model. +# +def tune_model + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::ModelService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::TuneModelRequest.new + + # Call the tune_model method. + result = client.tune_model request + + # The returned object is of type Gapic::Operation. You can use it to + # check the status of an operation, cancel it, or wait for results. + # Here is how to wait for a response. + result.wait_until_done! timeout: 60 + if result.response? + p result.response + else + puts "No response received." + end +end +# [END retail_v2_generated_ModelService_TuneModel_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/model_service/update_model.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/model_service/update_model.rb new file mode 100644 index 000000000000..0648bf6ab25e --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/model_service/update_model.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_ModelService_UpdateModel_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the update_model call in the ModelService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::ModelService::Client#update_model. +# +def update_model + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::ModelService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::UpdateModelRequest.new + + # Call the update_model method. + result = client.update_model request + + # The returned object is of type Google::Cloud::Retail::V2::Model. + p result +end +# [END retail_v2_generated_ModelService_UpdateModel_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/prediction_service/predict.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/prediction_service/predict.rb new file mode 100644 index 000000000000..da0cc34c34ab --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/prediction_service/predict.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_PredictionService_Predict_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the predict call in the PredictionService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::PredictionService::Client#predict. +# +def predict + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::PredictionService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::PredictRequest.new + + # Call the predict method. + result = client.predict request + + # The returned object is of type Google::Cloud::Retail::V2::PredictResponse. + p result +end +# [END retail_v2_generated_PredictionService_Predict_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/add_fulfillment_places.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/add_fulfillment_places.rb new file mode 100644 index 000000000000..4ec26b4419f7 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/add_fulfillment_places.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_ProductService_AddFulfillmentPlaces_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the add_fulfillment_places call in the ProductService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::ProductService::Client#add_fulfillment_places. +# +def add_fulfillment_places + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::ProductService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest.new + + # Call the add_fulfillment_places method. + result = client.add_fulfillment_places request + + # The returned object is of type Gapic::Operation. You can use it to + # check the status of an operation, cancel it, or wait for results. + # Here is how to wait for a response. + result.wait_until_done! timeout: 60 + if result.response? + p result.response + else + puts "No response received." + end +end +# [END retail_v2_generated_ProductService_AddFulfillmentPlaces_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/add_local_inventories.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/add_local_inventories.rb new file mode 100644 index 000000000000..2f4627281ccb --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/add_local_inventories.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_ProductService_AddLocalInventories_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the add_local_inventories call in the ProductService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::ProductService::Client#add_local_inventories. +# +def add_local_inventories + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::ProductService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::AddLocalInventoriesRequest.new + + # Call the add_local_inventories method. + result = client.add_local_inventories request + + # The returned object is of type Gapic::Operation. You can use it to + # check the status of an operation, cancel it, or wait for results. + # Here is how to wait for a response. + result.wait_until_done! timeout: 60 + if result.response? + p result.response + else + puts "No response received." + end +end +# [END retail_v2_generated_ProductService_AddLocalInventories_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/create_product.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/create_product.rb new file mode 100644 index 000000000000..4042ed4becf7 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/create_product.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_ProductService_CreateProduct_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the create_product call in the ProductService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::ProductService::Client#create_product. +# +def create_product + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::ProductService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::CreateProductRequest.new + + # Call the create_product method. + result = client.create_product request + + # The returned object is of type Google::Cloud::Retail::V2::Product. + p result +end +# [END retail_v2_generated_ProductService_CreateProduct_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/delete_product.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/delete_product.rb new file mode 100644 index 000000000000..6a95e9192bfa --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/delete_product.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_ProductService_DeleteProduct_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the delete_product call in the ProductService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::ProductService::Client#delete_product. +# +def delete_product + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::ProductService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::DeleteProductRequest.new + + # Call the delete_product method. + result = client.delete_product request + + # The returned object is of type Google::Protobuf::Empty. + p result +end +# [END retail_v2_generated_ProductService_DeleteProduct_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/get_product.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/get_product.rb new file mode 100644 index 000000000000..72fa221658aa --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/get_product.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_ProductService_GetProduct_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the get_product call in the ProductService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::ProductService::Client#get_product. +# +def get_product + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::ProductService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::GetProductRequest.new + + # Call the get_product method. + result = client.get_product request + + # The returned object is of type Google::Cloud::Retail::V2::Product. + p result +end +# [END retail_v2_generated_ProductService_GetProduct_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/import_products.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/import_products.rb new file mode 100644 index 000000000000..1db99c203a0e --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/import_products.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_ProductService_ImportProducts_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the import_products call in the ProductService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::ProductService::Client#import_products. +# +def import_products + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::ProductService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::ImportProductsRequest.new + + # Call the import_products method. + result = client.import_products request + + # The returned object is of type Gapic::Operation. You can use it to + # check the status of an operation, cancel it, or wait for results. + # Here is how to wait for a response. + result.wait_until_done! timeout: 60 + if result.response? + p result.response + else + puts "No response received." + end +end +# [END retail_v2_generated_ProductService_ImportProducts_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/list_products.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/list_products.rb new file mode 100644 index 000000000000..3c55a501794a --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/list_products.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_ProductService_ListProducts_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the list_products call in the ProductService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::ProductService::Client#list_products. +# +def list_products + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::ProductService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::ListProductsRequest.new + + # Call the list_products method. + result = client.list_products request + + # The returned object is of type Gapic::PagedEnumerable. You can iterate + # over elements, and API calls will be issued to fetch pages as needed. + result.each do |item| + # Each element is of type ::Google::Cloud::Retail::V2::Product. + p item + end +end +# [END retail_v2_generated_ProductService_ListProducts_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/purge_products.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/purge_products.rb new file mode 100644 index 000000000000..6ba93cc5c41b --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/purge_products.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_ProductService_PurgeProducts_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the purge_products call in the ProductService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::ProductService::Client#purge_products. +# +def purge_products + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::ProductService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::PurgeProductsRequest.new + + # Call the purge_products method. + result = client.purge_products request + + # The returned object is of type Gapic::Operation. You can use it to + # check the status of an operation, cancel it, or wait for results. + # Here is how to wait for a response. + result.wait_until_done! timeout: 60 + if result.response? + p result.response + else + puts "No response received." + end +end +# [END retail_v2_generated_ProductService_PurgeProducts_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/remove_fulfillment_places.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/remove_fulfillment_places.rb new file mode 100644 index 000000000000..7e48ed058cec --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/remove_fulfillment_places.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_ProductService_RemoveFulfillmentPlaces_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the remove_fulfillment_places call in the ProductService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::ProductService::Client#remove_fulfillment_places. +# +def remove_fulfillment_places + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::ProductService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest.new + + # Call the remove_fulfillment_places method. + result = client.remove_fulfillment_places request + + # The returned object is of type Gapic::Operation. You can use it to + # check the status of an operation, cancel it, or wait for results. + # Here is how to wait for a response. + result.wait_until_done! timeout: 60 + if result.response? + p result.response + else + puts "No response received." + end +end +# [END retail_v2_generated_ProductService_RemoveFulfillmentPlaces_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/remove_local_inventories.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/remove_local_inventories.rb new file mode 100644 index 000000000000..348089c03910 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/remove_local_inventories.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_ProductService_RemoveLocalInventories_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the remove_local_inventories call in the ProductService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::ProductService::Client#remove_local_inventories. +# +def remove_local_inventories + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::ProductService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::RemoveLocalInventoriesRequest.new + + # Call the remove_local_inventories method. + result = client.remove_local_inventories request + + # The returned object is of type Gapic::Operation. You can use it to + # check the status of an operation, cancel it, or wait for results. + # Here is how to wait for a response. + result.wait_until_done! timeout: 60 + if result.response? + p result.response + else + puts "No response received." + end +end +# [END retail_v2_generated_ProductService_RemoveLocalInventories_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/set_inventory.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/set_inventory.rb new file mode 100644 index 000000000000..bae7bf9a57e5 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/set_inventory.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_ProductService_SetInventory_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the set_inventory call in the ProductService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::ProductService::Client#set_inventory. +# +def set_inventory + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::ProductService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::SetInventoryRequest.new + + # Call the set_inventory method. + result = client.set_inventory request + + # The returned object is of type Gapic::Operation. You can use it to + # check the status of an operation, cancel it, or wait for results. + # Here is how to wait for a response. + result.wait_until_done! timeout: 60 + if result.response? + p result.response + else + puts "No response received." + end +end +# [END retail_v2_generated_ProductService_SetInventory_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/update_product.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/update_product.rb new file mode 100644 index 000000000000..36642534fa9e --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/update_product.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_ProductService_UpdateProduct_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the update_product call in the ProductService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::ProductService::Client#update_product. +# +def update_product + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::ProductService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::UpdateProductRequest.new + + # Call the update_product method. + result = client.update_product request + + # The returned object is of type Google::Cloud::Retail::V2::Product. + p result +end +# [END retail_v2_generated_ProductService_UpdateProduct_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/search_service/search.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/search_service/search.rb new file mode 100644 index 000000000000..5dc88c9cf583 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/search_service/search.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_SearchService_Search_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the search call in the SearchService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::SearchService::Client#search. +# +def search + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::SearchService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::SearchRequest.new + + # Call the search method. + result = client.search request + + # The returned object is of type Gapic::PagedEnumerable. You can iterate + # over elements, and API calls will be issued to fetch pages as needed. + result.each do |item| + # Each element is of type ::Google::Cloud::Retail::V2::SearchResponse::SearchResult. + p item + end +end +# [END retail_v2_generated_SearchService_Search_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/add_control.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/add_control.rb new file mode 100644 index 000000000000..220931b22733 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/add_control.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_ServingConfigService_AddControl_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the add_control call in the ServingConfigService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::ServingConfigService::Client#add_control. +# +def add_control + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::ServingConfigService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::AddControlRequest.new + + # Call the add_control method. + result = client.add_control request + + # The returned object is of type Google::Cloud::Retail::V2::ServingConfig. + p result +end +# [END retail_v2_generated_ServingConfigService_AddControl_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/create_serving_config.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/create_serving_config.rb new file mode 100644 index 000000000000..83294bf46733 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/create_serving_config.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_ServingConfigService_CreateServingConfig_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the create_serving_config call in the ServingConfigService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::ServingConfigService::Client#create_serving_config. +# +def create_serving_config + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::ServingConfigService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::CreateServingConfigRequest.new + + # Call the create_serving_config method. + result = client.create_serving_config request + + # The returned object is of type Google::Cloud::Retail::V2::ServingConfig. + p result +end +# [END retail_v2_generated_ServingConfigService_CreateServingConfig_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/delete_serving_config.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/delete_serving_config.rb new file mode 100644 index 000000000000..40f9a2606fca --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/delete_serving_config.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_ServingConfigService_DeleteServingConfig_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the delete_serving_config call in the ServingConfigService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::ServingConfigService::Client#delete_serving_config. +# +def delete_serving_config + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::ServingConfigService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::DeleteServingConfigRequest.new + + # Call the delete_serving_config method. + result = client.delete_serving_config request + + # The returned object is of type Google::Protobuf::Empty. + p result +end +# [END retail_v2_generated_ServingConfigService_DeleteServingConfig_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/get_serving_config.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/get_serving_config.rb new file mode 100644 index 000000000000..c2f3df505c5f --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/get_serving_config.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_ServingConfigService_GetServingConfig_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the get_serving_config call in the ServingConfigService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::ServingConfigService::Client#get_serving_config. +# +def get_serving_config + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::ServingConfigService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::GetServingConfigRequest.new + + # Call the get_serving_config method. + result = client.get_serving_config request + + # The returned object is of type Google::Cloud::Retail::V2::ServingConfig. + p result +end +# [END retail_v2_generated_ServingConfigService_GetServingConfig_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/list_serving_configs.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/list_serving_configs.rb new file mode 100644 index 000000000000..1c0c7dcdf923 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/list_serving_configs.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_ServingConfigService_ListServingConfigs_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the list_serving_configs call in the ServingConfigService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::ServingConfigService::Client#list_serving_configs. +# +def list_serving_configs + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::ServingConfigService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::ListServingConfigsRequest.new + + # Call the list_serving_configs method. + result = client.list_serving_configs request + + # The returned object is of type Gapic::PagedEnumerable. You can iterate + # over elements, and API calls will be issued to fetch pages as needed. + result.each do |item| + # Each element is of type ::Google::Cloud::Retail::V2::ServingConfig. + p item + end +end +# [END retail_v2_generated_ServingConfigService_ListServingConfigs_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/remove_control.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/remove_control.rb new file mode 100644 index 000000000000..7917bea15485 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/remove_control.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_ServingConfigService_RemoveControl_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the remove_control call in the ServingConfigService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::ServingConfigService::Client#remove_control. +# +def remove_control + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::ServingConfigService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::RemoveControlRequest.new + + # Call the remove_control method. + result = client.remove_control request + + # The returned object is of type Google::Cloud::Retail::V2::ServingConfig. + p result +end +# [END retail_v2_generated_ServingConfigService_RemoveControl_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/update_serving_config.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/update_serving_config.rb new file mode 100644 index 000000000000..669a5bd2a303 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/update_serving_config.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_ServingConfigService_UpdateServingConfig_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the update_serving_config call in the ServingConfigService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::ServingConfigService::Client#update_serving_config. +# +def update_serving_config + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::ServingConfigService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::UpdateServingConfigRequest.new + + # Call the update_serving_config method. + result = client.update_serving_config request + + # The returned object is of type Google::Cloud::Retail::V2::ServingConfig. + p result +end +# [END retail_v2_generated_ServingConfigService_UpdateServingConfig_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/snippet_metadata_google.cloud.retail.v2.json b/owl-bot-staging/google-cloud-retail-v2/snippets/snippet_metadata_google.cloud.retail.v2.json new file mode 100644 index 000000000000..3903e19ad375 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/snippet_metadata_google.cloud.retail.v2.json @@ -0,0 +1,2375 @@ +{ + "client_library": { + "name": "google-cloud-retail-v2", + "version": "", + "language": "RUBY", + "apis": [ + { + "id": "google.cloud.retail.v2", + "version": "v2" + } + ] + }, + "snippets": [ + { + "region_tag": "retail_v2_generated_AnalyticsService_ExportAnalyticsMetrics_sync", + "title": "Snippet for the export_analytics_metrics call in the AnalyticsService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::AnalyticsService::Client#export_analytics_metrics.", + "file": "analytics_service/export_analytics_metrics.rb", + "language": "RUBY", + "client_method": { + "short_name": "export_analytics_metrics", + "full_name": "::Google::Cloud::Retail::V2::AnalyticsService::Client#export_analytics_metrics", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::ExportAnalyticsMetricsRequest", + "name": "request" + } + ], + "result_type": "::Google::Longrunning::Operation", + "client": { + "short_name": "AnalyticsService::Client", + "full_name": "::Google::Cloud::Retail::V2::AnalyticsService::Client" + }, + "method": { + "short_name": "ExportAnalyticsMetrics", + "full_name": "google.cloud.retail.v2.AnalyticsService.ExportAnalyticsMetrics", + "service": { + "short_name": "AnalyticsService", + "full_name": "google.cloud.retail.v2.AnalyticsService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 53, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_CatalogService_ListCatalogs_sync", + "title": "Snippet for the list_catalogs call in the CatalogService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::CatalogService::Client#list_catalogs.", + "file": "catalog_service/list_catalogs.rb", + "language": "RUBY", + "client_method": { + "short_name": "list_catalogs", + "full_name": "::Google::Cloud::Retail::V2::CatalogService::Client#list_catalogs", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::ListCatalogsRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Retail::V2::ListCatalogsResponse", + "client": { + "short_name": "CatalogService::Client", + "full_name": "::Google::Cloud::Retail::V2::CatalogService::Client" + }, + "method": { + "short_name": "ListCatalogs", + "full_name": "google.cloud.retail.v2.CatalogService.ListCatalogs", + "service": { + "short_name": "CatalogService", + "full_name": "google.cloud.retail.v2.CatalogService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 50, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_CatalogService_UpdateCatalog_sync", + "title": "Snippet for the update_catalog call in the CatalogService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::CatalogService::Client#update_catalog.", + "file": "catalog_service/update_catalog.rb", + "language": "RUBY", + "client_method": { + "short_name": "update_catalog", + "full_name": "::Google::Cloud::Retail::V2::CatalogService::Client#update_catalog", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::UpdateCatalogRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Retail::V2::Catalog", + "client": { + "short_name": "CatalogService::Client", + "full_name": "::Google::Cloud::Retail::V2::CatalogService::Client" + }, + "method": { + "short_name": "UpdateCatalog", + "full_name": "google.cloud.retail.v2.CatalogService.UpdateCatalog", + "service": { + "short_name": "CatalogService", + "full_name": "google.cloud.retail.v2.CatalogService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_CatalogService_SetDefaultBranch_sync", + "title": "Snippet for the set_default_branch call in the CatalogService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::CatalogService::Client#set_default_branch.", + "file": "catalog_service/set_default_branch.rb", + "language": "RUBY", + "client_method": { + "short_name": "set_default_branch", + "full_name": "::Google::Cloud::Retail::V2::CatalogService::Client#set_default_branch", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::SetDefaultBranchRequest", + "name": "request" + } + ], + "result_type": "::Google::Protobuf::Empty", + "client": { + "short_name": "CatalogService::Client", + "full_name": "::Google::Cloud::Retail::V2::CatalogService::Client" + }, + "method": { + "short_name": "SetDefaultBranch", + "full_name": "google.cloud.retail.v2.CatalogService.SetDefaultBranch", + "service": { + "short_name": "CatalogService", + "full_name": "google.cloud.retail.v2.CatalogService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_CatalogService_GetDefaultBranch_sync", + "title": "Snippet for the get_default_branch call in the CatalogService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::CatalogService::Client#get_default_branch.", + "file": "catalog_service/get_default_branch.rb", + "language": "RUBY", + "client_method": { + "short_name": "get_default_branch", + "full_name": "::Google::Cloud::Retail::V2::CatalogService::Client#get_default_branch", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::GetDefaultBranchRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Retail::V2::GetDefaultBranchResponse", + "client": { + "short_name": "CatalogService::Client", + "full_name": "::Google::Cloud::Retail::V2::CatalogService::Client" + }, + "method": { + "short_name": "GetDefaultBranch", + "full_name": "google.cloud.retail.v2.CatalogService.GetDefaultBranch", + "service": { + "short_name": "CatalogService", + "full_name": "google.cloud.retail.v2.CatalogService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_CatalogService_GetCompletionConfig_sync", + "title": "Snippet for the get_completion_config call in the CatalogService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::CatalogService::Client#get_completion_config.", + "file": "catalog_service/get_completion_config.rb", + "language": "RUBY", + "client_method": { + "short_name": "get_completion_config", + "full_name": "::Google::Cloud::Retail::V2::CatalogService::Client#get_completion_config", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::GetCompletionConfigRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Retail::V2::CompletionConfig", + "client": { + "short_name": "CatalogService::Client", + "full_name": "::Google::Cloud::Retail::V2::CatalogService::Client" + }, + "method": { + "short_name": "GetCompletionConfig", + "full_name": "google.cloud.retail.v2.CatalogService.GetCompletionConfig", + "service": { + "short_name": "CatalogService", + "full_name": "google.cloud.retail.v2.CatalogService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_CatalogService_UpdateCompletionConfig_sync", + "title": "Snippet for the update_completion_config call in the CatalogService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::CatalogService::Client#update_completion_config.", + "file": "catalog_service/update_completion_config.rb", + "language": "RUBY", + "client_method": { + "short_name": "update_completion_config", + "full_name": "::Google::Cloud::Retail::V2::CatalogService::Client#update_completion_config", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::UpdateCompletionConfigRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Retail::V2::CompletionConfig", + "client": { + "short_name": "CatalogService::Client", + "full_name": "::Google::Cloud::Retail::V2::CatalogService::Client" + }, + "method": { + "short_name": "UpdateCompletionConfig", + "full_name": "google.cloud.retail.v2.CatalogService.UpdateCompletionConfig", + "service": { + "short_name": "CatalogService", + "full_name": "google.cloud.retail.v2.CatalogService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_CatalogService_GetAttributesConfig_sync", + "title": "Snippet for the get_attributes_config call in the CatalogService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::CatalogService::Client#get_attributes_config.", + "file": "catalog_service/get_attributes_config.rb", + "language": "RUBY", + "client_method": { + "short_name": "get_attributes_config", + "full_name": "::Google::Cloud::Retail::V2::CatalogService::Client#get_attributes_config", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::GetAttributesConfigRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Retail::V2::AttributesConfig", + "client": { + "short_name": "CatalogService::Client", + "full_name": "::Google::Cloud::Retail::V2::CatalogService::Client" + }, + "method": { + "short_name": "GetAttributesConfig", + "full_name": "google.cloud.retail.v2.CatalogService.GetAttributesConfig", + "service": { + "short_name": "CatalogService", + "full_name": "google.cloud.retail.v2.CatalogService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_CatalogService_UpdateAttributesConfig_sync", + "title": "Snippet for the update_attributes_config call in the CatalogService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::CatalogService::Client#update_attributes_config.", + "file": "catalog_service/update_attributes_config.rb", + "language": "RUBY", + "client_method": { + "short_name": "update_attributes_config", + "full_name": "::Google::Cloud::Retail::V2::CatalogService::Client#update_attributes_config", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::UpdateAttributesConfigRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Retail::V2::AttributesConfig", + "client": { + "short_name": "CatalogService::Client", + "full_name": "::Google::Cloud::Retail::V2::CatalogService::Client" + }, + "method": { + "short_name": "UpdateAttributesConfig", + "full_name": "google.cloud.retail.v2.CatalogService.UpdateAttributesConfig", + "service": { + "short_name": "CatalogService", + "full_name": "google.cloud.retail.v2.CatalogService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_CatalogService_AddCatalogAttribute_sync", + "title": "Snippet for the add_catalog_attribute call in the CatalogService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::CatalogService::Client#add_catalog_attribute.", + "file": "catalog_service/add_catalog_attribute.rb", + "language": "RUBY", + "client_method": { + "short_name": "add_catalog_attribute", + "full_name": "::Google::Cloud::Retail::V2::CatalogService::Client#add_catalog_attribute", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::AddCatalogAttributeRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Retail::V2::AttributesConfig", + "client": { + "short_name": "CatalogService::Client", + "full_name": "::Google::Cloud::Retail::V2::CatalogService::Client" + }, + "method": { + "short_name": "AddCatalogAttribute", + "full_name": "google.cloud.retail.v2.CatalogService.AddCatalogAttribute", + "service": { + "short_name": "CatalogService", + "full_name": "google.cloud.retail.v2.CatalogService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_CatalogService_RemoveCatalogAttribute_sync", + "title": "Snippet for the remove_catalog_attribute call in the CatalogService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::CatalogService::Client#remove_catalog_attribute.", + "file": "catalog_service/remove_catalog_attribute.rb", + "language": "RUBY", + "client_method": { + "short_name": "remove_catalog_attribute", + "full_name": "::Google::Cloud::Retail::V2::CatalogService::Client#remove_catalog_attribute", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::RemoveCatalogAttributeRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Retail::V2::AttributesConfig", + "client": { + "short_name": "CatalogService::Client", + "full_name": "::Google::Cloud::Retail::V2::CatalogService::Client" + }, + "method": { + "short_name": "RemoveCatalogAttribute", + "full_name": "google.cloud.retail.v2.CatalogService.RemoveCatalogAttribute", + "service": { + "short_name": "CatalogService", + "full_name": "google.cloud.retail.v2.CatalogService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_CatalogService_ReplaceCatalogAttribute_sync", + "title": "Snippet for the replace_catalog_attribute call in the CatalogService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::CatalogService::Client#replace_catalog_attribute.", + "file": "catalog_service/replace_catalog_attribute.rb", + "language": "RUBY", + "client_method": { + "short_name": "replace_catalog_attribute", + "full_name": "::Google::Cloud::Retail::V2::CatalogService::Client#replace_catalog_attribute", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::ReplaceCatalogAttributeRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Retail::V2::AttributesConfig", + "client": { + "short_name": "CatalogService::Client", + "full_name": "::Google::Cloud::Retail::V2::CatalogService::Client" + }, + "method": { + "short_name": "ReplaceCatalogAttribute", + "full_name": "google.cloud.retail.v2.CatalogService.ReplaceCatalogAttribute", + "service": { + "short_name": "CatalogService", + "full_name": "google.cloud.retail.v2.CatalogService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_CompletionService_CompleteQuery_sync", + "title": "Snippet for the complete_query call in the CompletionService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::CompletionService::Client#complete_query.", + "file": "completion_service/complete_query.rb", + "language": "RUBY", + "client_method": { + "short_name": "complete_query", + "full_name": "::Google::Cloud::Retail::V2::CompletionService::Client#complete_query", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::CompleteQueryRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Retail::V2::CompleteQueryResponse", + "client": { + "short_name": "CompletionService::Client", + "full_name": "::Google::Cloud::Retail::V2::CompletionService::Client" + }, + "method": { + "short_name": "CompleteQuery", + "full_name": "google.cloud.retail.v2.CompletionService.CompleteQuery", + "service": { + "short_name": "CompletionService", + "full_name": "google.cloud.retail.v2.CompletionService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_CompletionService_ImportCompletionData_sync", + "title": "Snippet for the import_completion_data call in the CompletionService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::CompletionService::Client#import_completion_data.", + "file": "completion_service/import_completion_data.rb", + "language": "RUBY", + "client_method": { + "short_name": "import_completion_data", + "full_name": "::Google::Cloud::Retail::V2::CompletionService::Client#import_completion_data", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::ImportCompletionDataRequest", + "name": "request" + } + ], + "result_type": "::Google::Longrunning::Operation", + "client": { + "short_name": "CompletionService::Client", + "full_name": "::Google::Cloud::Retail::V2::CompletionService::Client" + }, + "method": { + "short_name": "ImportCompletionData", + "full_name": "google.cloud.retail.v2.CompletionService.ImportCompletionData", + "service": { + "short_name": "CompletionService", + "full_name": "google.cloud.retail.v2.CompletionService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 53, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_ControlService_CreateControl_sync", + "title": "Snippet for the create_control call in the ControlService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ControlService::Client#create_control.", + "file": "control_service/create_control.rb", + "language": "RUBY", + "client_method": { + "short_name": "create_control", + "full_name": "::Google::Cloud::Retail::V2::ControlService::Client#create_control", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::CreateControlRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Retail::V2::Control", + "client": { + "short_name": "ControlService::Client", + "full_name": "::Google::Cloud::Retail::V2::ControlService::Client" + }, + "method": { + "short_name": "CreateControl", + "full_name": "google.cloud.retail.v2.ControlService.CreateControl", + "service": { + "short_name": "ControlService", + "full_name": "google.cloud.retail.v2.ControlService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_ControlService_DeleteControl_sync", + "title": "Snippet for the delete_control call in the ControlService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ControlService::Client#delete_control.", + "file": "control_service/delete_control.rb", + "language": "RUBY", + "client_method": { + "short_name": "delete_control", + "full_name": "::Google::Cloud::Retail::V2::ControlService::Client#delete_control", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::DeleteControlRequest", + "name": "request" + } + ], + "result_type": "::Google::Protobuf::Empty", + "client": { + "short_name": "ControlService::Client", + "full_name": "::Google::Cloud::Retail::V2::ControlService::Client" + }, + "method": { + "short_name": "DeleteControl", + "full_name": "google.cloud.retail.v2.ControlService.DeleteControl", + "service": { + "short_name": "ControlService", + "full_name": "google.cloud.retail.v2.ControlService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_ControlService_UpdateControl_sync", + "title": "Snippet for the update_control call in the ControlService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ControlService::Client#update_control.", + "file": "control_service/update_control.rb", + "language": "RUBY", + "client_method": { + "short_name": "update_control", + "full_name": "::Google::Cloud::Retail::V2::ControlService::Client#update_control", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::UpdateControlRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Retail::V2::Control", + "client": { + "short_name": "ControlService::Client", + "full_name": "::Google::Cloud::Retail::V2::ControlService::Client" + }, + "method": { + "short_name": "UpdateControl", + "full_name": "google.cloud.retail.v2.ControlService.UpdateControl", + "service": { + "short_name": "ControlService", + "full_name": "google.cloud.retail.v2.ControlService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_ControlService_GetControl_sync", + "title": "Snippet for the get_control call in the ControlService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ControlService::Client#get_control.", + "file": "control_service/get_control.rb", + "language": "RUBY", + "client_method": { + "short_name": "get_control", + "full_name": "::Google::Cloud::Retail::V2::ControlService::Client#get_control", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::GetControlRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Retail::V2::Control", + "client": { + "short_name": "ControlService::Client", + "full_name": "::Google::Cloud::Retail::V2::ControlService::Client" + }, + "method": { + "short_name": "GetControl", + "full_name": "google.cloud.retail.v2.ControlService.GetControl", + "service": { + "short_name": "ControlService", + "full_name": "google.cloud.retail.v2.ControlService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_ControlService_ListControls_sync", + "title": "Snippet for the list_controls call in the ControlService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ControlService::Client#list_controls.", + "file": "control_service/list_controls.rb", + "language": "RUBY", + "client_method": { + "short_name": "list_controls", + "full_name": "::Google::Cloud::Retail::V2::ControlService::Client#list_controls", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::ListControlsRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Retail::V2::ListControlsResponse", + "client": { + "short_name": "ControlService::Client", + "full_name": "::Google::Cloud::Retail::V2::ControlService::Client" + }, + "method": { + "short_name": "ListControls", + "full_name": "google.cloud.retail.v2.ControlService.ListControls", + "service": { + "short_name": "ControlService", + "full_name": "google.cloud.retail.v2.ControlService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 50, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_SearchService_Search_sync", + "title": "Snippet for the search call in the SearchService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::SearchService::Client#search.", + "file": "search_service/search.rb", + "language": "RUBY", + "client_method": { + "short_name": "search", + "full_name": "::Google::Cloud::Retail::V2::SearchService::Client#search", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::SearchRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Retail::V2::SearchResponse", + "client": { + "short_name": "SearchService::Client", + "full_name": "::Google::Cloud::Retail::V2::SearchService::Client" + }, + "method": { + "short_name": "Search", + "full_name": "google.cloud.retail.v2.SearchService.Search", + "service": { + "short_name": "SearchService", + "full_name": "google.cloud.retail.v2.SearchService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 50, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_ConversationalSearchService_ConversationalSearch_sync", + "title": "Snippet for the conversational_search call in the ConversationalSearchService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ConversationalSearchService::Client#conversational_search.", + "file": "conversational_search_service/conversational_search.rb", + "language": "RUBY", + "client_method": { + "short_name": "conversational_search", + "full_name": "::Google::Cloud::Retail::V2::ConversationalSearchService::Client#conversational_search", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::ConversationalSearchRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Retail::V2::ConversationalSearchResponse", + "client": { + "short_name": "ConversationalSearchService::Client", + "full_name": "::Google::Cloud::Retail::V2::ConversationalSearchService::Client" + }, + "method": { + "short_name": "ConversationalSearch", + "full_name": "google.cloud.retail.v2.ConversationalSearchService.ConversationalSearch", + "service": { + "short_name": "ConversationalSearchService", + "full_name": "google.cloud.retail.v2.ConversationalSearchService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 49, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_GenerativeQuestionService_UpdateGenerativeQuestionsFeatureConfig_sync", + "title": "Snippet for the update_generative_questions_feature_config call in the GenerativeQuestionService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::GenerativeQuestionService::Client#update_generative_questions_feature_config.", + "file": "generative_question_service/update_generative_questions_feature_config.rb", + "language": "RUBY", + "client_method": { + "short_name": "update_generative_questions_feature_config", + "full_name": "::Google::Cloud::Retail::V2::GenerativeQuestionService::Client#update_generative_questions_feature_config", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::UpdateGenerativeQuestionsFeatureConfigRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig", + "client": { + "short_name": "GenerativeQuestionService::Client", + "full_name": "::Google::Cloud::Retail::V2::GenerativeQuestionService::Client" + }, + "method": { + "short_name": "UpdateGenerativeQuestionsFeatureConfig", + "full_name": "google.cloud.retail.v2.GenerativeQuestionService.UpdateGenerativeQuestionsFeatureConfig", + "service": { + "short_name": "GenerativeQuestionService", + "full_name": "google.cloud.retail.v2.GenerativeQuestionService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_GenerativeQuestionService_GetGenerativeQuestionsFeatureConfig_sync", + "title": "Snippet for the get_generative_questions_feature_config call in the GenerativeQuestionService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::GenerativeQuestionService::Client#get_generative_questions_feature_config.", + "file": "generative_question_service/get_generative_questions_feature_config.rb", + "language": "RUBY", + "client_method": { + "short_name": "get_generative_questions_feature_config", + "full_name": "::Google::Cloud::Retail::V2::GenerativeQuestionService::Client#get_generative_questions_feature_config", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::GetGenerativeQuestionsFeatureConfigRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig", + "client": { + "short_name": "GenerativeQuestionService::Client", + "full_name": "::Google::Cloud::Retail::V2::GenerativeQuestionService::Client" + }, + "method": { + "short_name": "GetGenerativeQuestionsFeatureConfig", + "full_name": "google.cloud.retail.v2.GenerativeQuestionService.GetGenerativeQuestionsFeatureConfig", + "service": { + "short_name": "GenerativeQuestionService", + "full_name": "google.cloud.retail.v2.GenerativeQuestionService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_GenerativeQuestionService_ListGenerativeQuestionConfigs_sync", + "title": "Snippet for the list_generative_question_configs call in the GenerativeQuestionService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::GenerativeQuestionService::Client#list_generative_question_configs.", + "file": "generative_question_service/list_generative_question_configs.rb", + "language": "RUBY", + "client_method": { + "short_name": "list_generative_question_configs", + "full_name": "::Google::Cloud::Retail::V2::GenerativeQuestionService::Client#list_generative_question_configs", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsResponse", + "client": { + "short_name": "GenerativeQuestionService::Client", + "full_name": "::Google::Cloud::Retail::V2::GenerativeQuestionService::Client" + }, + "method": { + "short_name": "ListGenerativeQuestionConfigs", + "full_name": "google.cloud.retail.v2.GenerativeQuestionService.ListGenerativeQuestionConfigs", + "service": { + "short_name": "GenerativeQuestionService", + "full_name": "google.cloud.retail.v2.GenerativeQuestionService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_GenerativeQuestionService_UpdateGenerativeQuestionConfig_sync", + "title": "Snippet for the update_generative_question_config call in the GenerativeQuestionService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::GenerativeQuestionService::Client#update_generative_question_config.", + "file": "generative_question_service/update_generative_question_config.rb", + "language": "RUBY", + "client_method": { + "short_name": "update_generative_question_config", + "full_name": "::Google::Cloud::Retail::V2::GenerativeQuestionService::Client#update_generative_question_config", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::UpdateGenerativeQuestionConfigRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Retail::V2::GenerativeQuestionConfig", + "client": { + "short_name": "GenerativeQuestionService::Client", + "full_name": "::Google::Cloud::Retail::V2::GenerativeQuestionService::Client" + }, + "method": { + "short_name": "UpdateGenerativeQuestionConfig", + "full_name": "google.cloud.retail.v2.GenerativeQuestionService.UpdateGenerativeQuestionConfig", + "service": { + "short_name": "GenerativeQuestionService", + "full_name": "google.cloud.retail.v2.GenerativeQuestionService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_GenerativeQuestionService_BatchUpdateGenerativeQuestionConfigs_sync", + "title": "Snippet for the batch_update_generative_question_configs call in the GenerativeQuestionService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::GenerativeQuestionService::Client#batch_update_generative_question_configs.", + "file": "generative_question_service/batch_update_generative_question_configs.rb", + "language": "RUBY", + "client_method": { + "short_name": "batch_update_generative_question_configs", + "full_name": "::Google::Cloud::Retail::V2::GenerativeQuestionService::Client#batch_update_generative_question_configs", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsResponse", + "client": { + "short_name": "GenerativeQuestionService::Client", + "full_name": "::Google::Cloud::Retail::V2::GenerativeQuestionService::Client" + }, + "method": { + "short_name": "BatchUpdateGenerativeQuestionConfigs", + "full_name": "google.cloud.retail.v2.GenerativeQuestionService.BatchUpdateGenerativeQuestionConfigs", + "service": { + "short_name": "GenerativeQuestionService", + "full_name": "google.cloud.retail.v2.GenerativeQuestionService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_ModelService_CreateModel_sync", + "title": "Snippet for the create_model call in the ModelService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ModelService::Client#create_model.", + "file": "model_service/create_model.rb", + "language": "RUBY", + "client_method": { + "short_name": "create_model", + "full_name": "::Google::Cloud::Retail::V2::ModelService::Client#create_model", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::CreateModelRequest", + "name": "request" + } + ], + "result_type": "::Google::Longrunning::Operation", + "client": { + "short_name": "ModelService::Client", + "full_name": "::Google::Cloud::Retail::V2::ModelService::Client" + }, + "method": { + "short_name": "CreateModel", + "full_name": "google.cloud.retail.v2.ModelService.CreateModel", + "service": { + "short_name": "ModelService", + "full_name": "google.cloud.retail.v2.ModelService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 53, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_ModelService_GetModel_sync", + "title": "Snippet for the get_model call in the ModelService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ModelService::Client#get_model.", + "file": "model_service/get_model.rb", + "language": "RUBY", + "client_method": { + "short_name": "get_model", + "full_name": "::Google::Cloud::Retail::V2::ModelService::Client#get_model", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::GetModelRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Retail::V2::Model", + "client": { + "short_name": "ModelService::Client", + "full_name": "::Google::Cloud::Retail::V2::ModelService::Client" + }, + "method": { + "short_name": "GetModel", + "full_name": "google.cloud.retail.v2.ModelService.GetModel", + "service": { + "short_name": "ModelService", + "full_name": "google.cloud.retail.v2.ModelService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_ModelService_PauseModel_sync", + "title": "Snippet for the pause_model call in the ModelService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ModelService::Client#pause_model.", + "file": "model_service/pause_model.rb", + "language": "RUBY", + "client_method": { + "short_name": "pause_model", + "full_name": "::Google::Cloud::Retail::V2::ModelService::Client#pause_model", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::PauseModelRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Retail::V2::Model", + "client": { + "short_name": "ModelService::Client", + "full_name": "::Google::Cloud::Retail::V2::ModelService::Client" + }, + "method": { + "short_name": "PauseModel", + "full_name": "google.cloud.retail.v2.ModelService.PauseModel", + "service": { + "short_name": "ModelService", + "full_name": "google.cloud.retail.v2.ModelService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_ModelService_ResumeModel_sync", + "title": "Snippet for the resume_model call in the ModelService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ModelService::Client#resume_model.", + "file": "model_service/resume_model.rb", + "language": "RUBY", + "client_method": { + "short_name": "resume_model", + "full_name": "::Google::Cloud::Retail::V2::ModelService::Client#resume_model", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::ResumeModelRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Retail::V2::Model", + "client": { + "short_name": "ModelService::Client", + "full_name": "::Google::Cloud::Retail::V2::ModelService::Client" + }, + "method": { + "short_name": "ResumeModel", + "full_name": "google.cloud.retail.v2.ModelService.ResumeModel", + "service": { + "short_name": "ModelService", + "full_name": "google.cloud.retail.v2.ModelService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_ModelService_DeleteModel_sync", + "title": "Snippet for the delete_model call in the ModelService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ModelService::Client#delete_model.", + "file": "model_service/delete_model.rb", + "language": "RUBY", + "client_method": { + "short_name": "delete_model", + "full_name": "::Google::Cloud::Retail::V2::ModelService::Client#delete_model", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::DeleteModelRequest", + "name": "request" + } + ], + "result_type": "::Google::Protobuf::Empty", + "client": { + "short_name": "ModelService::Client", + "full_name": "::Google::Cloud::Retail::V2::ModelService::Client" + }, + "method": { + "short_name": "DeleteModel", + "full_name": "google.cloud.retail.v2.ModelService.DeleteModel", + "service": { + "short_name": "ModelService", + "full_name": "google.cloud.retail.v2.ModelService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_ModelService_ListModels_sync", + "title": "Snippet for the list_models call in the ModelService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ModelService::Client#list_models.", + "file": "model_service/list_models.rb", + "language": "RUBY", + "client_method": { + "short_name": "list_models", + "full_name": "::Google::Cloud::Retail::V2::ModelService::Client#list_models", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::ListModelsRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Retail::V2::ListModelsResponse", + "client": { + "short_name": "ModelService::Client", + "full_name": "::Google::Cloud::Retail::V2::ModelService::Client" + }, + "method": { + "short_name": "ListModels", + "full_name": "google.cloud.retail.v2.ModelService.ListModels", + "service": { + "short_name": "ModelService", + "full_name": "google.cloud.retail.v2.ModelService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 50, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_ModelService_UpdateModel_sync", + "title": "Snippet for the update_model call in the ModelService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ModelService::Client#update_model.", + "file": "model_service/update_model.rb", + "language": "RUBY", + "client_method": { + "short_name": "update_model", + "full_name": "::Google::Cloud::Retail::V2::ModelService::Client#update_model", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::UpdateModelRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Retail::V2::Model", + "client": { + "short_name": "ModelService::Client", + "full_name": "::Google::Cloud::Retail::V2::ModelService::Client" + }, + "method": { + "short_name": "UpdateModel", + "full_name": "google.cloud.retail.v2.ModelService.UpdateModel", + "service": { + "short_name": "ModelService", + "full_name": "google.cloud.retail.v2.ModelService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_ModelService_TuneModel_sync", + "title": "Snippet for the tune_model call in the ModelService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ModelService::Client#tune_model.", + "file": "model_service/tune_model.rb", + "language": "RUBY", + "client_method": { + "short_name": "tune_model", + "full_name": "::Google::Cloud::Retail::V2::ModelService::Client#tune_model", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::TuneModelRequest", + "name": "request" + } + ], + "result_type": "::Google::Longrunning::Operation", + "client": { + "short_name": "ModelService::Client", + "full_name": "::Google::Cloud::Retail::V2::ModelService::Client" + }, + "method": { + "short_name": "TuneModel", + "full_name": "google.cloud.retail.v2.ModelService.TuneModel", + "service": { + "short_name": "ModelService", + "full_name": "google.cloud.retail.v2.ModelService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 53, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_PredictionService_Predict_sync", + "title": "Snippet for the predict call in the PredictionService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::PredictionService::Client#predict.", + "file": "prediction_service/predict.rb", + "language": "RUBY", + "client_method": { + "short_name": "predict", + "full_name": "::Google::Cloud::Retail::V2::PredictionService::Client#predict", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::PredictRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Retail::V2::PredictResponse", + "client": { + "short_name": "PredictionService::Client", + "full_name": "::Google::Cloud::Retail::V2::PredictionService::Client" + }, + "method": { + "short_name": "Predict", + "full_name": "google.cloud.retail.v2.PredictionService.Predict", + "service": { + "short_name": "PredictionService", + "full_name": "google.cloud.retail.v2.PredictionService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_ProductService_CreateProduct_sync", + "title": "Snippet for the create_product call in the ProductService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ProductService::Client#create_product.", + "file": "product_service/create_product.rb", + "language": "RUBY", + "client_method": { + "short_name": "create_product", + "full_name": "::Google::Cloud::Retail::V2::ProductService::Client#create_product", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::CreateProductRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Retail::V2::Product", + "client": { + "short_name": "ProductService::Client", + "full_name": "::Google::Cloud::Retail::V2::ProductService::Client" + }, + "method": { + "short_name": "CreateProduct", + "full_name": "google.cloud.retail.v2.ProductService.CreateProduct", + "service": { + "short_name": "ProductService", + "full_name": "google.cloud.retail.v2.ProductService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_ProductService_GetProduct_sync", + "title": "Snippet for the get_product call in the ProductService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ProductService::Client#get_product.", + "file": "product_service/get_product.rb", + "language": "RUBY", + "client_method": { + "short_name": "get_product", + "full_name": "::Google::Cloud::Retail::V2::ProductService::Client#get_product", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::GetProductRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Retail::V2::Product", + "client": { + "short_name": "ProductService::Client", + "full_name": "::Google::Cloud::Retail::V2::ProductService::Client" + }, + "method": { + "short_name": "GetProduct", + "full_name": "google.cloud.retail.v2.ProductService.GetProduct", + "service": { + "short_name": "ProductService", + "full_name": "google.cloud.retail.v2.ProductService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_ProductService_ListProducts_sync", + "title": "Snippet for the list_products call in the ProductService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ProductService::Client#list_products.", + "file": "product_service/list_products.rb", + "language": "RUBY", + "client_method": { + "short_name": "list_products", + "full_name": "::Google::Cloud::Retail::V2::ProductService::Client#list_products", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::ListProductsRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Retail::V2::ListProductsResponse", + "client": { + "short_name": "ProductService::Client", + "full_name": "::Google::Cloud::Retail::V2::ProductService::Client" + }, + "method": { + "short_name": "ListProducts", + "full_name": "google.cloud.retail.v2.ProductService.ListProducts", + "service": { + "short_name": "ProductService", + "full_name": "google.cloud.retail.v2.ProductService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 50, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_ProductService_UpdateProduct_sync", + "title": "Snippet for the update_product call in the ProductService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ProductService::Client#update_product.", + "file": "product_service/update_product.rb", + "language": "RUBY", + "client_method": { + "short_name": "update_product", + "full_name": "::Google::Cloud::Retail::V2::ProductService::Client#update_product", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::UpdateProductRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Retail::V2::Product", + "client": { + "short_name": "ProductService::Client", + "full_name": "::Google::Cloud::Retail::V2::ProductService::Client" + }, + "method": { + "short_name": "UpdateProduct", + "full_name": "google.cloud.retail.v2.ProductService.UpdateProduct", + "service": { + "short_name": "ProductService", + "full_name": "google.cloud.retail.v2.ProductService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_ProductService_DeleteProduct_sync", + "title": "Snippet for the delete_product call in the ProductService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ProductService::Client#delete_product.", + "file": "product_service/delete_product.rb", + "language": "RUBY", + "client_method": { + "short_name": "delete_product", + "full_name": "::Google::Cloud::Retail::V2::ProductService::Client#delete_product", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::DeleteProductRequest", + "name": "request" + } + ], + "result_type": "::Google::Protobuf::Empty", + "client": { + "short_name": "ProductService::Client", + "full_name": "::Google::Cloud::Retail::V2::ProductService::Client" + }, + "method": { + "short_name": "DeleteProduct", + "full_name": "google.cloud.retail.v2.ProductService.DeleteProduct", + "service": { + "short_name": "ProductService", + "full_name": "google.cloud.retail.v2.ProductService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_ProductService_PurgeProducts_sync", + "title": "Snippet for the purge_products call in the ProductService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ProductService::Client#purge_products.", + "file": "product_service/purge_products.rb", + "language": "RUBY", + "client_method": { + "short_name": "purge_products", + "full_name": "::Google::Cloud::Retail::V2::ProductService::Client#purge_products", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::PurgeProductsRequest", + "name": "request" + } + ], + "result_type": "::Google::Longrunning::Operation", + "client": { + "short_name": "ProductService::Client", + "full_name": "::Google::Cloud::Retail::V2::ProductService::Client" + }, + "method": { + "short_name": "PurgeProducts", + "full_name": "google.cloud.retail.v2.ProductService.PurgeProducts", + "service": { + "short_name": "ProductService", + "full_name": "google.cloud.retail.v2.ProductService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 53, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_ProductService_ImportProducts_sync", + "title": "Snippet for the import_products call in the ProductService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ProductService::Client#import_products.", + "file": "product_service/import_products.rb", + "language": "RUBY", + "client_method": { + "short_name": "import_products", + "full_name": "::Google::Cloud::Retail::V2::ProductService::Client#import_products", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::ImportProductsRequest", + "name": "request" + } + ], + "result_type": "::Google::Longrunning::Operation", + "client": { + "short_name": "ProductService::Client", + "full_name": "::Google::Cloud::Retail::V2::ProductService::Client" + }, + "method": { + "short_name": "ImportProducts", + "full_name": "google.cloud.retail.v2.ProductService.ImportProducts", + "service": { + "short_name": "ProductService", + "full_name": "google.cloud.retail.v2.ProductService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 53, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_ProductService_SetInventory_sync", + "title": "Snippet for the set_inventory call in the ProductService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ProductService::Client#set_inventory.", + "file": "product_service/set_inventory.rb", + "language": "RUBY", + "client_method": { + "short_name": "set_inventory", + "full_name": "::Google::Cloud::Retail::V2::ProductService::Client#set_inventory", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::SetInventoryRequest", + "name": "request" + } + ], + "result_type": "::Google::Longrunning::Operation", + "client": { + "short_name": "ProductService::Client", + "full_name": "::Google::Cloud::Retail::V2::ProductService::Client" + }, + "method": { + "short_name": "SetInventory", + "full_name": "google.cloud.retail.v2.ProductService.SetInventory", + "service": { + "short_name": "ProductService", + "full_name": "google.cloud.retail.v2.ProductService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 53, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_ProductService_AddFulfillmentPlaces_sync", + "title": "Snippet for the add_fulfillment_places call in the ProductService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ProductService::Client#add_fulfillment_places.", + "file": "product_service/add_fulfillment_places.rb", + "language": "RUBY", + "client_method": { + "short_name": "add_fulfillment_places", + "full_name": "::Google::Cloud::Retail::V2::ProductService::Client#add_fulfillment_places", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest", + "name": "request" + } + ], + "result_type": "::Google::Longrunning::Operation", + "client": { + "short_name": "ProductService::Client", + "full_name": "::Google::Cloud::Retail::V2::ProductService::Client" + }, + "method": { + "short_name": "AddFulfillmentPlaces", + "full_name": "google.cloud.retail.v2.ProductService.AddFulfillmentPlaces", + "service": { + "short_name": "ProductService", + "full_name": "google.cloud.retail.v2.ProductService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 53, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_ProductService_RemoveFulfillmentPlaces_sync", + "title": "Snippet for the remove_fulfillment_places call in the ProductService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ProductService::Client#remove_fulfillment_places.", + "file": "product_service/remove_fulfillment_places.rb", + "language": "RUBY", + "client_method": { + "short_name": "remove_fulfillment_places", + "full_name": "::Google::Cloud::Retail::V2::ProductService::Client#remove_fulfillment_places", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest", + "name": "request" + } + ], + "result_type": "::Google::Longrunning::Operation", + "client": { + "short_name": "ProductService::Client", + "full_name": "::Google::Cloud::Retail::V2::ProductService::Client" + }, + "method": { + "short_name": "RemoveFulfillmentPlaces", + "full_name": "google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces", + "service": { + "short_name": "ProductService", + "full_name": "google.cloud.retail.v2.ProductService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 53, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_ProductService_AddLocalInventories_sync", + "title": "Snippet for the add_local_inventories call in the ProductService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ProductService::Client#add_local_inventories.", + "file": "product_service/add_local_inventories.rb", + "language": "RUBY", + "client_method": { + "short_name": "add_local_inventories", + "full_name": "::Google::Cloud::Retail::V2::ProductService::Client#add_local_inventories", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::AddLocalInventoriesRequest", + "name": "request" + } + ], + "result_type": "::Google::Longrunning::Operation", + "client": { + "short_name": "ProductService::Client", + "full_name": "::Google::Cloud::Retail::V2::ProductService::Client" + }, + "method": { + "short_name": "AddLocalInventories", + "full_name": "google.cloud.retail.v2.ProductService.AddLocalInventories", + "service": { + "short_name": "ProductService", + "full_name": "google.cloud.retail.v2.ProductService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 53, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_ProductService_RemoveLocalInventories_sync", + "title": "Snippet for the remove_local_inventories call in the ProductService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ProductService::Client#remove_local_inventories.", + "file": "product_service/remove_local_inventories.rb", + "language": "RUBY", + "client_method": { + "short_name": "remove_local_inventories", + "full_name": "::Google::Cloud::Retail::V2::ProductService::Client#remove_local_inventories", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::RemoveLocalInventoriesRequest", + "name": "request" + } + ], + "result_type": "::Google::Longrunning::Operation", + "client": { + "short_name": "ProductService::Client", + "full_name": "::Google::Cloud::Retail::V2::ProductService::Client" + }, + "method": { + "short_name": "RemoveLocalInventories", + "full_name": "google.cloud.retail.v2.ProductService.RemoveLocalInventories", + "service": { + "short_name": "ProductService", + "full_name": "google.cloud.retail.v2.ProductService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 53, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_ServingConfigService_CreateServingConfig_sync", + "title": "Snippet for the create_serving_config call in the ServingConfigService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ServingConfigService::Client#create_serving_config.", + "file": "serving_config_service/create_serving_config.rb", + "language": "RUBY", + "client_method": { + "short_name": "create_serving_config", + "full_name": "::Google::Cloud::Retail::V2::ServingConfigService::Client#create_serving_config", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::CreateServingConfigRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Retail::V2::ServingConfig", + "client": { + "short_name": "ServingConfigService::Client", + "full_name": "::Google::Cloud::Retail::V2::ServingConfigService::Client" + }, + "method": { + "short_name": "CreateServingConfig", + "full_name": "google.cloud.retail.v2.ServingConfigService.CreateServingConfig", + "service": { + "short_name": "ServingConfigService", + "full_name": "google.cloud.retail.v2.ServingConfigService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_ServingConfigService_DeleteServingConfig_sync", + "title": "Snippet for the delete_serving_config call in the ServingConfigService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ServingConfigService::Client#delete_serving_config.", + "file": "serving_config_service/delete_serving_config.rb", + "language": "RUBY", + "client_method": { + "short_name": "delete_serving_config", + "full_name": "::Google::Cloud::Retail::V2::ServingConfigService::Client#delete_serving_config", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::DeleteServingConfigRequest", + "name": "request" + } + ], + "result_type": "::Google::Protobuf::Empty", + "client": { + "short_name": "ServingConfigService::Client", + "full_name": "::Google::Cloud::Retail::V2::ServingConfigService::Client" + }, + "method": { + "short_name": "DeleteServingConfig", + "full_name": "google.cloud.retail.v2.ServingConfigService.DeleteServingConfig", + "service": { + "short_name": "ServingConfigService", + "full_name": "google.cloud.retail.v2.ServingConfigService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_ServingConfigService_UpdateServingConfig_sync", + "title": "Snippet for the update_serving_config call in the ServingConfigService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ServingConfigService::Client#update_serving_config.", + "file": "serving_config_service/update_serving_config.rb", + "language": "RUBY", + "client_method": { + "short_name": "update_serving_config", + "full_name": "::Google::Cloud::Retail::V2::ServingConfigService::Client#update_serving_config", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::UpdateServingConfigRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Retail::V2::ServingConfig", + "client": { + "short_name": "ServingConfigService::Client", + "full_name": "::Google::Cloud::Retail::V2::ServingConfigService::Client" + }, + "method": { + "short_name": "UpdateServingConfig", + "full_name": "google.cloud.retail.v2.ServingConfigService.UpdateServingConfig", + "service": { + "short_name": "ServingConfigService", + "full_name": "google.cloud.retail.v2.ServingConfigService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_ServingConfigService_GetServingConfig_sync", + "title": "Snippet for the get_serving_config call in the ServingConfigService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ServingConfigService::Client#get_serving_config.", + "file": "serving_config_service/get_serving_config.rb", + "language": "RUBY", + "client_method": { + "short_name": "get_serving_config", + "full_name": "::Google::Cloud::Retail::V2::ServingConfigService::Client#get_serving_config", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::GetServingConfigRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Retail::V2::ServingConfig", + "client": { + "short_name": "ServingConfigService::Client", + "full_name": "::Google::Cloud::Retail::V2::ServingConfigService::Client" + }, + "method": { + "short_name": "GetServingConfig", + "full_name": "google.cloud.retail.v2.ServingConfigService.GetServingConfig", + "service": { + "short_name": "ServingConfigService", + "full_name": "google.cloud.retail.v2.ServingConfigService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_ServingConfigService_ListServingConfigs_sync", + "title": "Snippet for the list_serving_configs call in the ServingConfigService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ServingConfigService::Client#list_serving_configs.", + "file": "serving_config_service/list_serving_configs.rb", + "language": "RUBY", + "client_method": { + "short_name": "list_serving_configs", + "full_name": "::Google::Cloud::Retail::V2::ServingConfigService::Client#list_serving_configs", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::ListServingConfigsRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Retail::V2::ListServingConfigsResponse", + "client": { + "short_name": "ServingConfigService::Client", + "full_name": "::Google::Cloud::Retail::V2::ServingConfigService::Client" + }, + "method": { + "short_name": "ListServingConfigs", + "full_name": "google.cloud.retail.v2.ServingConfigService.ListServingConfigs", + "service": { + "short_name": "ServingConfigService", + "full_name": "google.cloud.retail.v2.ServingConfigService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 50, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_ServingConfigService_AddControl_sync", + "title": "Snippet for the add_control call in the ServingConfigService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ServingConfigService::Client#add_control.", + "file": "serving_config_service/add_control.rb", + "language": "RUBY", + "client_method": { + "short_name": "add_control", + "full_name": "::Google::Cloud::Retail::V2::ServingConfigService::Client#add_control", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::AddControlRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Retail::V2::ServingConfig", + "client": { + "short_name": "ServingConfigService::Client", + "full_name": "::Google::Cloud::Retail::V2::ServingConfigService::Client" + }, + "method": { + "short_name": "AddControl", + "full_name": "google.cloud.retail.v2.ServingConfigService.AddControl", + "service": { + "short_name": "ServingConfigService", + "full_name": "google.cloud.retail.v2.ServingConfigService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_ServingConfigService_RemoveControl_sync", + "title": "Snippet for the remove_control call in the ServingConfigService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ServingConfigService::Client#remove_control.", + "file": "serving_config_service/remove_control.rb", + "language": "RUBY", + "client_method": { + "short_name": "remove_control", + "full_name": "::Google::Cloud::Retail::V2::ServingConfigService::Client#remove_control", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::RemoveControlRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Retail::V2::ServingConfig", + "client": { + "short_name": "ServingConfigService::Client", + "full_name": "::Google::Cloud::Retail::V2::ServingConfigService::Client" + }, + "method": { + "short_name": "RemoveControl", + "full_name": "google.cloud.retail.v2.ServingConfigService.RemoveControl", + "service": { + "short_name": "ServingConfigService", + "full_name": "google.cloud.retail.v2.ServingConfigService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_UserEventService_WriteUserEvent_sync", + "title": "Snippet for the write_user_event call in the UserEventService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::UserEventService::Client#write_user_event.", + "file": "user_event_service/write_user_event.rb", + "language": "RUBY", + "client_method": { + "short_name": "write_user_event", + "full_name": "::Google::Cloud::Retail::V2::UserEventService::Client#write_user_event", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::WriteUserEventRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Retail::V2::UserEvent", + "client": { + "short_name": "UserEventService::Client", + "full_name": "::Google::Cloud::Retail::V2::UserEventService::Client" + }, + "method": { + "short_name": "WriteUserEvent", + "full_name": "google.cloud.retail.v2.UserEventService.WriteUserEvent", + "service": { + "short_name": "UserEventService", + "full_name": "google.cloud.retail.v2.UserEventService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_UserEventService_CollectUserEvent_sync", + "title": "Snippet for the collect_user_event call in the UserEventService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::UserEventService::Client#collect_user_event.", + "file": "user_event_service/collect_user_event.rb", + "language": "RUBY", + "client_method": { + "short_name": "collect_user_event", + "full_name": "::Google::Cloud::Retail::V2::UserEventService::Client#collect_user_event", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::CollectUserEventRequest", + "name": "request" + } + ], + "result_type": "::Google::Api::HttpBody", + "client": { + "short_name": "UserEventService::Client", + "full_name": "::Google::Cloud::Retail::V2::UserEventService::Client" + }, + "method": { + "short_name": "CollectUserEvent", + "full_name": "google.cloud.retail.v2.UserEventService.CollectUserEvent", + "service": { + "short_name": "UserEventService", + "full_name": "google.cloud.retail.v2.UserEventService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_UserEventService_PurgeUserEvents_sync", + "title": "Snippet for the purge_user_events call in the UserEventService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::UserEventService::Client#purge_user_events.", + "file": "user_event_service/purge_user_events.rb", + "language": "RUBY", + "client_method": { + "short_name": "purge_user_events", + "full_name": "::Google::Cloud::Retail::V2::UserEventService::Client#purge_user_events", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::PurgeUserEventsRequest", + "name": "request" + } + ], + "result_type": "::Google::Longrunning::Operation", + "client": { + "short_name": "UserEventService::Client", + "full_name": "::Google::Cloud::Retail::V2::UserEventService::Client" + }, + "method": { + "short_name": "PurgeUserEvents", + "full_name": "google.cloud.retail.v2.UserEventService.PurgeUserEvents", + "service": { + "short_name": "UserEventService", + "full_name": "google.cloud.retail.v2.UserEventService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 53, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_UserEventService_ImportUserEvents_sync", + "title": "Snippet for the import_user_events call in the UserEventService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::UserEventService::Client#import_user_events.", + "file": "user_event_service/import_user_events.rb", + "language": "RUBY", + "client_method": { + "short_name": "import_user_events", + "full_name": "::Google::Cloud::Retail::V2::UserEventService::Client#import_user_events", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::ImportUserEventsRequest", + "name": "request" + } + ], + "result_type": "::Google::Longrunning::Operation", + "client": { + "short_name": "UserEventService::Client", + "full_name": "::Google::Cloud::Retail::V2::UserEventService::Client" + }, + "method": { + "short_name": "ImportUserEvents", + "full_name": "google.cloud.retail.v2.UserEventService.ImportUserEvents", + "service": { + "short_name": "UserEventService", + "full_name": "google.cloud.retail.v2.UserEventService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 53, + "type": "FULL" + } + ] + }, + { + "region_tag": "retail_v2_generated_UserEventService_RejoinUserEvents_sync", + "title": "Snippet for the rejoin_user_events call in the UserEventService service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::UserEventService::Client#rejoin_user_events.", + "file": "user_event_service/rejoin_user_events.rb", + "language": "RUBY", + "client_method": { + "short_name": "rejoin_user_events", + "full_name": "::Google::Cloud::Retail::V2::UserEventService::Client#rejoin_user_events", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Retail::V2::RejoinUserEventsRequest", + "name": "request" + } + ], + "result_type": "::Google::Longrunning::Operation", + "client": { + "short_name": "UserEventService::Client", + "full_name": "::Google::Cloud::Retail::V2::UserEventService::Client" + }, + "method": { + "short_name": "RejoinUserEvents", + "full_name": "google.cloud.retail.v2.UserEventService.RejoinUserEvents", + "service": { + "short_name": "UserEventService", + "full_name": "google.cloud.retail.v2.UserEventService" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 53, + "type": "FULL" + } + ] + } + ] +} \ No newline at end of file diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/user_event_service/collect_user_event.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/user_event_service/collect_user_event.rb new file mode 100644 index 000000000000..ee81b5ede9b4 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/user_event_service/collect_user_event.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_UserEventService_CollectUserEvent_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the collect_user_event call in the UserEventService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::UserEventService::Client#collect_user_event. +# +def collect_user_event + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::UserEventService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::CollectUserEventRequest.new + + # Call the collect_user_event method. + result = client.collect_user_event request + + # The returned object is of type Google::Api::HttpBody. + p result +end +# [END retail_v2_generated_UserEventService_CollectUserEvent_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/user_event_service/import_user_events.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/user_event_service/import_user_events.rb new file mode 100644 index 000000000000..4c20c5a126d4 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/user_event_service/import_user_events.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_UserEventService_ImportUserEvents_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the import_user_events call in the UserEventService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::UserEventService::Client#import_user_events. +# +def import_user_events + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::UserEventService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::ImportUserEventsRequest.new + + # Call the import_user_events method. + result = client.import_user_events request + + # The returned object is of type Gapic::Operation. You can use it to + # check the status of an operation, cancel it, or wait for results. + # Here is how to wait for a response. + result.wait_until_done! timeout: 60 + if result.response? + p result.response + else + puts "No response received." + end +end +# [END retail_v2_generated_UserEventService_ImportUserEvents_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/user_event_service/purge_user_events.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/user_event_service/purge_user_events.rb new file mode 100644 index 000000000000..7d7df5d779bd --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/user_event_service/purge_user_events.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_UserEventService_PurgeUserEvents_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the purge_user_events call in the UserEventService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::UserEventService::Client#purge_user_events. +# +def purge_user_events + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::UserEventService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::PurgeUserEventsRequest.new + + # Call the purge_user_events method. + result = client.purge_user_events request + + # The returned object is of type Gapic::Operation. You can use it to + # check the status of an operation, cancel it, or wait for results. + # Here is how to wait for a response. + result.wait_until_done! timeout: 60 + if result.response? + p result.response + else + puts "No response received." + end +end +# [END retail_v2_generated_UserEventService_PurgeUserEvents_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/user_event_service/rejoin_user_events.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/user_event_service/rejoin_user_events.rb new file mode 100644 index 000000000000..38e48c8b00d3 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/user_event_service/rejoin_user_events.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_UserEventService_RejoinUserEvents_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the rejoin_user_events call in the UserEventService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::UserEventService::Client#rejoin_user_events. +# +def rejoin_user_events + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::UserEventService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::RejoinUserEventsRequest.new + + # Call the rejoin_user_events method. + result = client.rejoin_user_events request + + # The returned object is of type Gapic::Operation. You can use it to + # check the status of an operation, cancel it, or wait for results. + # Here is how to wait for a response. + result.wait_until_done! timeout: 60 + if result.response? + p result.response + else + puts "No response received." + end +end +# [END retail_v2_generated_UserEventService_RejoinUserEvents_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/user_event_service/write_user_event.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/user_event_service/write_user_event.rb new file mode 100644 index 000000000000..e1946f8c6a8d --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/snippets/user_event_service/write_user_event.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START retail_v2_generated_UserEventService_WriteUserEvent_sync] +require "google/cloud/retail/v2" + +## +# Snippet for the write_user_event call in the UserEventService service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Retail::V2::UserEventService::Client#write_user_event. +# +def write_user_event + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Retail::V2::UserEventService::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Retail::V2::WriteUserEventRequest.new + + # Call the write_user_event method. + result = client.write_user_event request + + # The returned object is of type Google::Cloud::Retail::V2::UserEvent. + p result +end +# [END retail_v2_generated_UserEventService_WriteUserEvent_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/analytics_service_operations_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/analytics_service_operations_test.rb new file mode 100644 index 000000000000..66822830d222 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/analytics_service_operations_test.rb @@ -0,0 +1,400 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/cloud/retail/v2/analytics_service_pb" +require "google/cloud/retail/v2/analytics_service_services_pb" +require "google/cloud/retail/v2/analytics_service" + +class ::Google::Cloud::Retail::V2::AnalyticsService::OperationsTest < Minitest::Test + class ClientStub + attr_accessor :call_rpc_count, :requests + + def initialize response, operation, &block + @response = response + @operation = operation + @block = block + @call_rpc_count = 0 + @requests = [] + end + + def call_rpc *args, **kwargs + @call_rpc_count += 1 + + @requests << @block&.call(*args, **kwargs) + + catch :response do + yield @response, @operation if block_given? + @response + end + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_list_operations + # Create GRPC objects. + grpc_response = ::Google::Longrunning::ListOperationsResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + filter = "hello world" + page_size = 42 + page_token = "hello world" + return_partial_success = true + + list_operations_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :list_operations, name + assert_kind_of ::Google::Longrunning::ListOperationsRequest, request + assert_equal "hello world", request["name"] + assert_equal "hello world", request["filter"] + assert_equal 42, request["page_size"] + assert_equal "hello world", request["page_token"] + assert_equal true, request["return_partial_success"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, list_operations_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::AnalyticsService::Operations.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.list_operations({ name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success }) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.list_operations name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.list_operations ::Google::Longrunning::ListOperationsRequest.new(name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.list_operations({ name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success }, grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.list_operations(::Google::Longrunning::ListOperationsRequest.new(name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success), grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, list_operations_client_stub.call_rpc_count + end + end + + def test_get_operation + # Create GRPC objects. + grpc_response = ::Google::Longrunning::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :get_operation, name + assert_kind_of ::Google::Longrunning::GetOperationRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, get_operation_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::AnalyticsService::Operations.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.get_operation({ name: name }) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use named arguments + c.get_operation name: name do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.get_operation ::Google::Longrunning::GetOperationRequest.new(name: name) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.get_operation({ name: name }, grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.get_operation(::Google::Longrunning::GetOperationRequest.new(name: name), grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, get_operation_client_stub.call_rpc_count + end + end + + def test_delete_operation + # Create GRPC objects. + grpc_response = ::Google::Protobuf::Empty.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + delete_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :delete_operation, name + assert_kind_of ::Google::Longrunning::DeleteOperationRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, delete_operation_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::AnalyticsService::Operations.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.delete_operation({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.delete_operation name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.delete_operation ::Google::Longrunning::DeleteOperationRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.delete_operation({ name: name }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.delete_operation(::Google::Longrunning::DeleteOperationRequest.new(name: name), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, delete_operation_client_stub.call_rpc_count + end + end + + def test_cancel_operation + # Create GRPC objects. + grpc_response = ::Google::Protobuf::Empty.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + cancel_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :cancel_operation, name + assert_kind_of ::Google::Longrunning::CancelOperationRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, cancel_operation_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::AnalyticsService::Operations.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.cancel_operation({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.cancel_operation name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.cancel_operation ::Google::Longrunning::CancelOperationRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.cancel_operation({ name: name }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.cancel_operation(::Google::Longrunning::CancelOperationRequest.new(name: name), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, cancel_operation_client_stub.call_rpc_count + end + end + + def test_wait_operation + # Create GRPC objects. + grpc_response = ::Google::Longrunning::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + timeout = {} + + wait_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :wait_operation, name + assert_kind_of ::Google::Longrunning::WaitOperationRequest, request + assert_equal "hello world", request["name"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::Duration), request["timeout"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, wait_operation_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::AnalyticsService::Operations.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.wait_operation({ name: name, timeout: timeout }) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use named arguments + c.wait_operation name: name, timeout: timeout do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.wait_operation ::Google::Longrunning::WaitOperationRequest.new(name: name, timeout: timeout) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.wait_operation({ name: name, timeout: timeout }, grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.wait_operation(::Google::Longrunning::WaitOperationRequest.new(name: name, timeout: timeout), grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, wait_operation_client_stub.call_rpc_count + end + end + + def test_configure + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + + client = block_config = config = nil + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Retail::V2::AnalyticsService::Operations.new do |config| + config.credentials = grpc_channel + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::Retail::V2::AnalyticsService::Operations::Configuration, config + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/analytics_service_rest_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/analytics_service_rest_test.rb new file mode 100644 index 000000000000..28b40dfe1bfd --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/analytics_service_rest_test.rb @@ -0,0 +1,155 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" +require "gapic/rest" +require "google/cloud/retail/v2/analytics_service_pb" +require "google/cloud/retail/v2/analytics_service/rest" + + +class ::Google::Cloud::Retail::V2::AnalyticsService::Rest::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_count, :requests + + def initialize response, &block + @response = response + @block = block + @call_count = 0 + @requests = [] + end + + def make_get_request uri:, params: {}, options: {}, method_name: nil + make_http_request :get, uri: uri, body: nil, params: params, options: options, method_name: method_name + end + + def make_delete_request uri:, params: {}, options: {}, method_name: nil + make_http_request :delete, uri: uri, body: nil, params: params, options: options, method_name: method_name + end + + def make_post_request uri:, body: nil, params: {}, options: {}, method_name: nil + make_http_request :post, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_patch_request uri:, body:, params: {}, options: {}, method_name: nil + make_http_request :patch, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_put_request uri:, body:, params: {}, options: {}, method_name: nil + make_http_request :put, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_http_request *args, **kwargs + @call_count += 1 + + @requests << @block&.call(*args, **kwargs) + + @response + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_export_analytics_metrics + # Create test objects. + client_result = ::Google::Longrunning::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + catalog = "hello world" + output_config = {} + filter = "hello world" + + export_analytics_metrics_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::AnalyticsService::Rest::ServiceStub.stub :transcode_export_analytics_metrics_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, export_analytics_metrics_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::AnalyticsService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.export_analytics_metrics({ catalog: catalog, output_config: output_config, filter: filter }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.export_analytics_metrics catalog: catalog, output_config: output_config, filter: filter do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.export_analytics_metrics ::Google::Cloud::Retail::V2::ExportAnalyticsMetricsRequest.new(catalog: catalog, output_config: output_config, filter: filter) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.export_analytics_metrics({ catalog: catalog, output_config: output_config, filter: filter }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.export_analytics_metrics(::Google::Cloud::Retail::V2::ExportAnalyticsMetricsRequest.new(catalog: catalog, output_config: output_config, filter: filter), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, export_analytics_metrics_client_stub.call_count + end + end + end + + def test_configure + credentials_token = :dummy_value + + client = block_config = config = nil + dummy_stub = ClientStub.new nil + Gapic::Rest::ClientStub.stub :new, dummy_stub do + client = ::Google::Cloud::Retail::V2::AnalyticsService::Rest::Client.new do |config| + config.credentials = credentials_token + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::Retail::V2::AnalyticsService::Rest::Client::Configuration, config + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/analytics_service_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/analytics_service_test.rb new file mode 100644 index 000000000000..271b5dd21581 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/analytics_service_test.rb @@ -0,0 +1,185 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/cloud/retail/v2/analytics_service_pb" +require "google/cloud/retail/v2/analytics_service" + +class ::Google::Cloud::Retail::V2::AnalyticsService::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_rpc_count, :requests + + def initialize response, operation, &block + @response = response + @operation = operation + @block = block + @call_rpc_count = 0 + @requests = [] + end + + def call_rpc *args, **kwargs + @call_rpc_count += 1 + + @requests << @block&.call(*args, **kwargs) + + catch :response do + yield @response, @operation if block_given? + @response + end + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_export_analytics_metrics + # Create GRPC objects. + grpc_response = ::Google::Longrunning::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + catalog = "hello world" + output_config = {} + filter = "hello world" + + export_analytics_metrics_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :export_analytics_metrics, name + assert_kind_of ::Google::Cloud::Retail::V2::ExportAnalyticsMetricsRequest, request + assert_equal "hello world", request["catalog"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::OutputConfig), request["output_config"] + assert_equal "hello world", request["filter"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, export_analytics_metrics_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::AnalyticsService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.export_analytics_metrics({ catalog: catalog, output_config: output_config, filter: filter }) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use named arguments + c.export_analytics_metrics catalog: catalog, output_config: output_config, filter: filter do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.export_analytics_metrics ::Google::Cloud::Retail::V2::ExportAnalyticsMetricsRequest.new(catalog: catalog, output_config: output_config, filter: filter) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.export_analytics_metrics({ catalog: catalog, output_config: output_config, filter: filter }, grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.export_analytics_metrics(::Google::Cloud::Retail::V2::ExportAnalyticsMetricsRequest.new(catalog: catalog, output_config: output_config, filter: filter), grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, export_analytics_metrics_client_stub.call_rpc_count + end + end + + def test_configure + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + + client = block_config = config = nil + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Retail::V2::AnalyticsService::Client.new do |config| + config.credentials = grpc_channel + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::Retail::V2::AnalyticsService::Client::Configuration, config + end + + def test_credentials + key = OpenSSL::PKey::RSA.new 2048 + cred_json = { + "private_key" => key.to_pem, + "client_email" => "app@developer.gserviceaccount.com", + "type" => "service_account" + } + key_file = StringIO.new cred_json.to_json + creds = Google::Auth::ServiceAccountCredentials.make_creds({ json_key_io: key_file }) + + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Retail::V2::AnalyticsService::Client.new do |config| + config.credentials = creds + end + assert_kind_of ::Google::Cloud::Retail::V2::AnalyticsService::Client, client + assert_equal creds, client.configure.credentials + end + end + + def test_operations_client + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + + client = nil + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Retail::V2::AnalyticsService::Client.new do |config| + config.credentials = grpc_channel + end + end + + assert_kind_of ::Google::Cloud::Retail::V2::AnalyticsService::Operations, client.operations_client + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/catalog_service_paths_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/catalog_service_paths_test.rb new file mode 100644 index 000000000000..e107597737b1 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/catalog_service_paths_test.rb @@ -0,0 +1,103 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/cloud/retail/v2/catalog_service" + +class ::Google::Cloud::Retail::V2::CatalogService::ClientPathsTest < Minitest::Test + class DummyStub + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_attributes_config_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::Retail::V2::CatalogService::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.attributes_config_path project: "value0", location: "value1", catalog: "value2" + assert_equal "projects/value0/locations/value1/catalogs/value2/attributesConfig", path + end + end + + def test_branch_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::Retail::V2::CatalogService::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.branch_path project: "value0", location: "value1", catalog: "value2", branch: "value3" + assert_equal "projects/value0/locations/value1/catalogs/value2/branches/value3", path + end + end + + def test_catalog_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::Retail::V2::CatalogService::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.catalog_path project: "value0", location: "value1", catalog: "value2" + assert_equal "projects/value0/locations/value1/catalogs/value2", path + end + end + + def test_completion_config_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::Retail::V2::CatalogService::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.completion_config_path project: "value0", location: "value1", catalog: "value2" + assert_equal "projects/value0/locations/value1/catalogs/value2/completionConfig", path + end + end + + def test_location_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::Retail::V2::CatalogService::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.location_path project: "value0", location: "value1" + assert_equal "projects/value0/locations/value1", path + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/catalog_service_rest_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/catalog_service_rest_test.rb new file mode 100644 index 000000000000..b763a2854144 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/catalog_service_rest_test.rb @@ -0,0 +1,705 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" +require "gapic/rest" +require "google/cloud/retail/v2/catalog_service_pb" +require "google/cloud/retail/v2/catalog_service/rest" + + +class ::Google::Cloud::Retail::V2::CatalogService::Rest::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_count, :requests + + def initialize response, &block + @response = response + @block = block + @call_count = 0 + @requests = [] + end + + def make_get_request uri:, params: {}, options: {}, method_name: nil + make_http_request :get, uri: uri, body: nil, params: params, options: options, method_name: method_name + end + + def make_delete_request uri:, params: {}, options: {}, method_name: nil + make_http_request :delete, uri: uri, body: nil, params: params, options: options, method_name: method_name + end + + def make_post_request uri:, body: nil, params: {}, options: {}, method_name: nil + make_http_request :post, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_patch_request uri:, body:, params: {}, options: {}, method_name: nil + make_http_request :patch, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_put_request uri:, body:, params: {}, options: {}, method_name: nil + make_http_request :put, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_http_request *args, **kwargs + @call_count += 1 + + @requests << @block&.call(*args, **kwargs) + + @response + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_list_catalogs + # Create test objects. + client_result = ::Google::Cloud::Retail::V2::ListCatalogsResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + page_size = 42 + page_token = "hello world" + + list_catalogs_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::CatalogService::Rest::ServiceStub.stub :transcode_list_catalogs_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, list_catalogs_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::CatalogService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.list_catalogs({ parent: parent, page_size: page_size, page_token: page_token }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.list_catalogs parent: parent, page_size: page_size, page_token: page_token do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.list_catalogs ::Google::Cloud::Retail::V2::ListCatalogsRequest.new(parent: parent, page_size: page_size, page_token: page_token) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.list_catalogs({ parent: parent, page_size: page_size, page_token: page_token }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.list_catalogs(::Google::Cloud::Retail::V2::ListCatalogsRequest.new(parent: parent, page_size: page_size, page_token: page_token), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, list_catalogs_client_stub.call_count + end + end + end + + def test_update_catalog + # Create test objects. + client_result = ::Google::Cloud::Retail::V2::Catalog.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + catalog = {} + update_mask = {} + + update_catalog_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::CatalogService::Rest::ServiceStub.stub :transcode_update_catalog_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, update_catalog_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::CatalogService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.update_catalog({ catalog: catalog, update_mask: update_mask }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.update_catalog catalog: catalog, update_mask: update_mask do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.update_catalog ::Google::Cloud::Retail::V2::UpdateCatalogRequest.new(catalog: catalog, update_mask: update_mask) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.update_catalog({ catalog: catalog, update_mask: update_mask }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.update_catalog(::Google::Cloud::Retail::V2::UpdateCatalogRequest.new(catalog: catalog, update_mask: update_mask), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, update_catalog_client_stub.call_count + end + end + end + + def test_set_default_branch + # Create test objects. + client_result = ::Google::Protobuf::Empty.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + catalog = "hello world" + branch_id = "hello world" + note = "hello world" + force = true + + set_default_branch_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::CatalogService::Rest::ServiceStub.stub :transcode_set_default_branch_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, set_default_branch_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::CatalogService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.set_default_branch({ catalog: catalog, branch_id: branch_id, note: note, force: force }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.set_default_branch catalog: catalog, branch_id: branch_id, note: note, force: force do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.set_default_branch ::Google::Cloud::Retail::V2::SetDefaultBranchRequest.new(catalog: catalog, branch_id: branch_id, note: note, force: force) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.set_default_branch({ catalog: catalog, branch_id: branch_id, note: note, force: force }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.set_default_branch(::Google::Cloud::Retail::V2::SetDefaultBranchRequest.new(catalog: catalog, branch_id: branch_id, note: note, force: force), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, set_default_branch_client_stub.call_count + end + end + end + + def test_get_default_branch + # Create test objects. + client_result = ::Google::Cloud::Retail::V2::GetDefaultBranchResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + catalog = "hello world" + + get_default_branch_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::CatalogService::Rest::ServiceStub.stub :transcode_get_default_branch_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, get_default_branch_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::CatalogService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.get_default_branch({ catalog: catalog }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.get_default_branch catalog: catalog do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.get_default_branch ::Google::Cloud::Retail::V2::GetDefaultBranchRequest.new(catalog: catalog) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.get_default_branch({ catalog: catalog }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.get_default_branch(::Google::Cloud::Retail::V2::GetDefaultBranchRequest.new(catalog: catalog), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, get_default_branch_client_stub.call_count + end + end + end + + def test_get_completion_config + # Create test objects. + client_result = ::Google::Cloud::Retail::V2::CompletionConfig.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_completion_config_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::CatalogService::Rest::ServiceStub.stub :transcode_get_completion_config_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, get_completion_config_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::CatalogService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.get_completion_config({ name: name }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.get_completion_config name: name do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.get_completion_config ::Google::Cloud::Retail::V2::GetCompletionConfigRequest.new(name: name) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.get_completion_config({ name: name }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.get_completion_config(::Google::Cloud::Retail::V2::GetCompletionConfigRequest.new(name: name), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, get_completion_config_client_stub.call_count + end + end + end + + def test_update_completion_config + # Create test objects. + client_result = ::Google::Cloud::Retail::V2::CompletionConfig.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + completion_config = {} + update_mask = {} + + update_completion_config_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::CatalogService::Rest::ServiceStub.stub :transcode_update_completion_config_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, update_completion_config_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::CatalogService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.update_completion_config({ completion_config: completion_config, update_mask: update_mask }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.update_completion_config completion_config: completion_config, update_mask: update_mask do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.update_completion_config ::Google::Cloud::Retail::V2::UpdateCompletionConfigRequest.new(completion_config: completion_config, update_mask: update_mask) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.update_completion_config({ completion_config: completion_config, update_mask: update_mask }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.update_completion_config(::Google::Cloud::Retail::V2::UpdateCompletionConfigRequest.new(completion_config: completion_config, update_mask: update_mask), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, update_completion_config_client_stub.call_count + end + end + end + + def test_get_attributes_config + # Create test objects. + client_result = ::Google::Cloud::Retail::V2::AttributesConfig.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_attributes_config_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::CatalogService::Rest::ServiceStub.stub :transcode_get_attributes_config_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, get_attributes_config_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::CatalogService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.get_attributes_config({ name: name }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.get_attributes_config name: name do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.get_attributes_config ::Google::Cloud::Retail::V2::GetAttributesConfigRequest.new(name: name) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.get_attributes_config({ name: name }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.get_attributes_config(::Google::Cloud::Retail::V2::GetAttributesConfigRequest.new(name: name), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, get_attributes_config_client_stub.call_count + end + end + end + + def test_update_attributes_config + # Create test objects. + client_result = ::Google::Cloud::Retail::V2::AttributesConfig.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + attributes_config = {} + update_mask = {} + + update_attributes_config_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::CatalogService::Rest::ServiceStub.stub :transcode_update_attributes_config_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, update_attributes_config_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::CatalogService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.update_attributes_config({ attributes_config: attributes_config, update_mask: update_mask }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.update_attributes_config attributes_config: attributes_config, update_mask: update_mask do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.update_attributes_config ::Google::Cloud::Retail::V2::UpdateAttributesConfigRequest.new(attributes_config: attributes_config, update_mask: update_mask) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.update_attributes_config({ attributes_config: attributes_config, update_mask: update_mask }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.update_attributes_config(::Google::Cloud::Retail::V2::UpdateAttributesConfigRequest.new(attributes_config: attributes_config, update_mask: update_mask), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, update_attributes_config_client_stub.call_count + end + end + end + + def test_add_catalog_attribute + # Create test objects. + client_result = ::Google::Cloud::Retail::V2::AttributesConfig.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + attributes_config = "hello world" + catalog_attribute = {} + + add_catalog_attribute_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::CatalogService::Rest::ServiceStub.stub :transcode_add_catalog_attribute_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, add_catalog_attribute_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::CatalogService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.add_catalog_attribute({ attributes_config: attributes_config, catalog_attribute: catalog_attribute }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.add_catalog_attribute attributes_config: attributes_config, catalog_attribute: catalog_attribute do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.add_catalog_attribute ::Google::Cloud::Retail::V2::AddCatalogAttributeRequest.new(attributes_config: attributes_config, catalog_attribute: catalog_attribute) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.add_catalog_attribute({ attributes_config: attributes_config, catalog_attribute: catalog_attribute }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.add_catalog_attribute(::Google::Cloud::Retail::V2::AddCatalogAttributeRequest.new(attributes_config: attributes_config, catalog_attribute: catalog_attribute), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, add_catalog_attribute_client_stub.call_count + end + end + end + + def test_remove_catalog_attribute + # Create test objects. + client_result = ::Google::Cloud::Retail::V2::AttributesConfig.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + attributes_config = "hello world" + key = "hello world" + + remove_catalog_attribute_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::CatalogService::Rest::ServiceStub.stub :transcode_remove_catalog_attribute_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, remove_catalog_attribute_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::CatalogService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.remove_catalog_attribute({ attributes_config: attributes_config, key: key }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.remove_catalog_attribute attributes_config: attributes_config, key: key do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.remove_catalog_attribute ::Google::Cloud::Retail::V2::RemoveCatalogAttributeRequest.new(attributes_config: attributes_config, key: key) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.remove_catalog_attribute({ attributes_config: attributes_config, key: key }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.remove_catalog_attribute(::Google::Cloud::Retail::V2::RemoveCatalogAttributeRequest.new(attributes_config: attributes_config, key: key), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, remove_catalog_attribute_client_stub.call_count + end + end + end + + def test_replace_catalog_attribute + # Create test objects. + client_result = ::Google::Cloud::Retail::V2::AttributesConfig.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + attributes_config = "hello world" + catalog_attribute = {} + update_mask = {} + + replace_catalog_attribute_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::CatalogService::Rest::ServiceStub.stub :transcode_replace_catalog_attribute_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, replace_catalog_attribute_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::CatalogService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.replace_catalog_attribute({ attributes_config: attributes_config, catalog_attribute: catalog_attribute, update_mask: update_mask }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.replace_catalog_attribute attributes_config: attributes_config, catalog_attribute: catalog_attribute, update_mask: update_mask do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.replace_catalog_attribute ::Google::Cloud::Retail::V2::ReplaceCatalogAttributeRequest.new(attributes_config: attributes_config, catalog_attribute: catalog_attribute, update_mask: update_mask) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.replace_catalog_attribute({ attributes_config: attributes_config, catalog_attribute: catalog_attribute, update_mask: update_mask }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.replace_catalog_attribute(::Google::Cloud::Retail::V2::ReplaceCatalogAttributeRequest.new(attributes_config: attributes_config, catalog_attribute: catalog_attribute, update_mask: update_mask), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, replace_catalog_attribute_client_stub.call_count + end + end + end + + def test_configure + credentials_token = :dummy_value + + client = block_config = config = nil + dummy_stub = ClientStub.new nil + Gapic::Rest::ClientStub.stub :new, dummy_stub do + client = ::Google::Cloud::Retail::V2::CatalogService::Rest::Client.new do |config| + config.credentials = credentials_token + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::Retail::V2::CatalogService::Rest::Client::Configuration, config + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/catalog_service_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/catalog_service_test.rb new file mode 100644 index 000000000000..78d3255c5df3 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/catalog_service_test.rb @@ -0,0 +1,771 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/cloud/retail/v2/catalog_service_pb" +require "google/cloud/retail/v2/catalog_service" + +class ::Google::Cloud::Retail::V2::CatalogService::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_rpc_count, :requests + + def initialize response, operation, &block + @response = response + @operation = operation + @block = block + @call_rpc_count = 0 + @requests = [] + end + + def call_rpc *args, **kwargs + @call_rpc_count += 1 + + @requests << @block&.call(*args, **kwargs) + + catch :response do + yield @response, @operation if block_given? + @response + end + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_list_catalogs + # Create GRPC objects. + grpc_response = ::Google::Cloud::Retail::V2::ListCatalogsResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + page_size = 42 + page_token = "hello world" + + list_catalogs_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :list_catalogs, name + assert_kind_of ::Google::Cloud::Retail::V2::ListCatalogsRequest, request + assert_equal "hello world", request["parent"] + assert_equal 42, request["page_size"] + assert_equal "hello world", request["page_token"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, list_catalogs_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::CatalogService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.list_catalogs({ parent: parent, page_size: page_size, page_token: page_token }) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.list_catalogs parent: parent, page_size: page_size, page_token: page_token do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.list_catalogs ::Google::Cloud::Retail::V2::ListCatalogsRequest.new(parent: parent, page_size: page_size, page_token: page_token) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.list_catalogs({ parent: parent, page_size: page_size, page_token: page_token }, grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.list_catalogs(::Google::Cloud::Retail::V2::ListCatalogsRequest.new(parent: parent, page_size: page_size, page_token: page_token), grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, list_catalogs_client_stub.call_rpc_count + end + end + + def test_update_catalog + # Create GRPC objects. + grpc_response = ::Google::Cloud::Retail::V2::Catalog.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + catalog = {} + update_mask = {} + + update_catalog_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :update_catalog, name + assert_kind_of ::Google::Cloud::Retail::V2::UpdateCatalogRequest, request + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::Catalog), request["catalog"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::FieldMask), request["update_mask"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, update_catalog_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::CatalogService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.update_catalog({ catalog: catalog, update_mask: update_mask }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.update_catalog catalog: catalog, update_mask: update_mask do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.update_catalog ::Google::Cloud::Retail::V2::UpdateCatalogRequest.new(catalog: catalog, update_mask: update_mask) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.update_catalog({ catalog: catalog, update_mask: update_mask }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.update_catalog(::Google::Cloud::Retail::V2::UpdateCatalogRequest.new(catalog: catalog, update_mask: update_mask), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, update_catalog_client_stub.call_rpc_count + end + end + + def test_set_default_branch + # Create GRPC objects. + grpc_response = ::Google::Protobuf::Empty.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + catalog = "hello world" + branch_id = "hello world" + note = "hello world" + force = true + + set_default_branch_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :set_default_branch, name + assert_kind_of ::Google::Cloud::Retail::V2::SetDefaultBranchRequest, request + assert_equal "hello world", request["catalog"] + assert_equal "hello world", request["branch_id"] + assert_equal "hello world", request["note"] + assert_equal true, request["force"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, set_default_branch_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::CatalogService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.set_default_branch({ catalog: catalog, branch_id: branch_id, note: note, force: force }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.set_default_branch catalog: catalog, branch_id: branch_id, note: note, force: force do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.set_default_branch ::Google::Cloud::Retail::V2::SetDefaultBranchRequest.new(catalog: catalog, branch_id: branch_id, note: note, force: force) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.set_default_branch({ catalog: catalog, branch_id: branch_id, note: note, force: force }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.set_default_branch(::Google::Cloud::Retail::V2::SetDefaultBranchRequest.new(catalog: catalog, branch_id: branch_id, note: note, force: force), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, set_default_branch_client_stub.call_rpc_count + end + end + + def test_get_default_branch + # Create GRPC objects. + grpc_response = ::Google::Cloud::Retail::V2::GetDefaultBranchResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + catalog = "hello world" + + get_default_branch_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :get_default_branch, name + assert_kind_of ::Google::Cloud::Retail::V2::GetDefaultBranchRequest, request + assert_equal "hello world", request["catalog"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, get_default_branch_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::CatalogService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.get_default_branch({ catalog: catalog }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.get_default_branch catalog: catalog do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.get_default_branch ::Google::Cloud::Retail::V2::GetDefaultBranchRequest.new(catalog: catalog) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.get_default_branch({ catalog: catalog }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.get_default_branch(::Google::Cloud::Retail::V2::GetDefaultBranchRequest.new(catalog: catalog), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, get_default_branch_client_stub.call_rpc_count + end + end + + def test_get_completion_config + # Create GRPC objects. + grpc_response = ::Google::Cloud::Retail::V2::CompletionConfig.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_completion_config_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :get_completion_config, name + assert_kind_of ::Google::Cloud::Retail::V2::GetCompletionConfigRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, get_completion_config_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::CatalogService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.get_completion_config({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.get_completion_config name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.get_completion_config ::Google::Cloud::Retail::V2::GetCompletionConfigRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.get_completion_config({ name: name }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.get_completion_config(::Google::Cloud::Retail::V2::GetCompletionConfigRequest.new(name: name), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, get_completion_config_client_stub.call_rpc_count + end + end + + def test_update_completion_config + # Create GRPC objects. + grpc_response = ::Google::Cloud::Retail::V2::CompletionConfig.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + completion_config = {} + update_mask = {} + + update_completion_config_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :update_completion_config, name + assert_kind_of ::Google::Cloud::Retail::V2::UpdateCompletionConfigRequest, request + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::CompletionConfig), request["completion_config"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::FieldMask), request["update_mask"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, update_completion_config_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::CatalogService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.update_completion_config({ completion_config: completion_config, update_mask: update_mask }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.update_completion_config completion_config: completion_config, update_mask: update_mask do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.update_completion_config ::Google::Cloud::Retail::V2::UpdateCompletionConfigRequest.new(completion_config: completion_config, update_mask: update_mask) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.update_completion_config({ completion_config: completion_config, update_mask: update_mask }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.update_completion_config(::Google::Cloud::Retail::V2::UpdateCompletionConfigRequest.new(completion_config: completion_config, update_mask: update_mask), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, update_completion_config_client_stub.call_rpc_count + end + end + + def test_get_attributes_config + # Create GRPC objects. + grpc_response = ::Google::Cloud::Retail::V2::AttributesConfig.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_attributes_config_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :get_attributes_config, name + assert_kind_of ::Google::Cloud::Retail::V2::GetAttributesConfigRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, get_attributes_config_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::CatalogService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.get_attributes_config({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.get_attributes_config name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.get_attributes_config ::Google::Cloud::Retail::V2::GetAttributesConfigRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.get_attributes_config({ name: name }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.get_attributes_config(::Google::Cloud::Retail::V2::GetAttributesConfigRequest.new(name: name), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, get_attributes_config_client_stub.call_rpc_count + end + end + + def test_update_attributes_config + # Create GRPC objects. + grpc_response = ::Google::Cloud::Retail::V2::AttributesConfig.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + attributes_config = {} + update_mask = {} + + update_attributes_config_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :update_attributes_config, name + assert_kind_of ::Google::Cloud::Retail::V2::UpdateAttributesConfigRequest, request + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::AttributesConfig), request["attributes_config"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::FieldMask), request["update_mask"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, update_attributes_config_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::CatalogService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.update_attributes_config({ attributes_config: attributes_config, update_mask: update_mask }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.update_attributes_config attributes_config: attributes_config, update_mask: update_mask do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.update_attributes_config ::Google::Cloud::Retail::V2::UpdateAttributesConfigRequest.new(attributes_config: attributes_config, update_mask: update_mask) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.update_attributes_config({ attributes_config: attributes_config, update_mask: update_mask }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.update_attributes_config(::Google::Cloud::Retail::V2::UpdateAttributesConfigRequest.new(attributes_config: attributes_config, update_mask: update_mask), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, update_attributes_config_client_stub.call_rpc_count + end + end + + def test_add_catalog_attribute + # Create GRPC objects. + grpc_response = ::Google::Cloud::Retail::V2::AttributesConfig.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + attributes_config = "hello world" + catalog_attribute = {} + + add_catalog_attribute_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :add_catalog_attribute, name + assert_kind_of ::Google::Cloud::Retail::V2::AddCatalogAttributeRequest, request + assert_equal "hello world", request["attributes_config"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::CatalogAttribute), request["catalog_attribute"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, add_catalog_attribute_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::CatalogService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.add_catalog_attribute({ attributes_config: attributes_config, catalog_attribute: catalog_attribute }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.add_catalog_attribute attributes_config: attributes_config, catalog_attribute: catalog_attribute do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.add_catalog_attribute ::Google::Cloud::Retail::V2::AddCatalogAttributeRequest.new(attributes_config: attributes_config, catalog_attribute: catalog_attribute) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.add_catalog_attribute({ attributes_config: attributes_config, catalog_attribute: catalog_attribute }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.add_catalog_attribute(::Google::Cloud::Retail::V2::AddCatalogAttributeRequest.new(attributes_config: attributes_config, catalog_attribute: catalog_attribute), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, add_catalog_attribute_client_stub.call_rpc_count + end + end + + def test_remove_catalog_attribute + # Create GRPC objects. + grpc_response = ::Google::Cloud::Retail::V2::AttributesConfig.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + attributes_config = "hello world" + key = "hello world" + + remove_catalog_attribute_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :remove_catalog_attribute, name + assert_kind_of ::Google::Cloud::Retail::V2::RemoveCatalogAttributeRequest, request + assert_equal "hello world", request["attributes_config"] + assert_equal "hello world", request["key"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, remove_catalog_attribute_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::CatalogService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.remove_catalog_attribute({ attributes_config: attributes_config, key: key }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.remove_catalog_attribute attributes_config: attributes_config, key: key do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.remove_catalog_attribute ::Google::Cloud::Retail::V2::RemoveCatalogAttributeRequest.new(attributes_config: attributes_config, key: key) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.remove_catalog_attribute({ attributes_config: attributes_config, key: key }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.remove_catalog_attribute(::Google::Cloud::Retail::V2::RemoveCatalogAttributeRequest.new(attributes_config: attributes_config, key: key), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, remove_catalog_attribute_client_stub.call_rpc_count + end + end + + def test_replace_catalog_attribute + # Create GRPC objects. + grpc_response = ::Google::Cloud::Retail::V2::AttributesConfig.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + attributes_config = "hello world" + catalog_attribute = {} + update_mask = {} + + replace_catalog_attribute_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :replace_catalog_attribute, name + assert_kind_of ::Google::Cloud::Retail::V2::ReplaceCatalogAttributeRequest, request + assert_equal "hello world", request["attributes_config"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::CatalogAttribute), request["catalog_attribute"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::FieldMask), request["update_mask"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, replace_catalog_attribute_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::CatalogService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.replace_catalog_attribute({ attributes_config: attributes_config, catalog_attribute: catalog_attribute, update_mask: update_mask }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.replace_catalog_attribute attributes_config: attributes_config, catalog_attribute: catalog_attribute, update_mask: update_mask do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.replace_catalog_attribute ::Google::Cloud::Retail::V2::ReplaceCatalogAttributeRequest.new(attributes_config: attributes_config, catalog_attribute: catalog_attribute, update_mask: update_mask) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.replace_catalog_attribute({ attributes_config: attributes_config, catalog_attribute: catalog_attribute, update_mask: update_mask }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.replace_catalog_attribute(::Google::Cloud::Retail::V2::ReplaceCatalogAttributeRequest.new(attributes_config: attributes_config, catalog_attribute: catalog_attribute, update_mask: update_mask), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, replace_catalog_attribute_client_stub.call_rpc_count + end + end + + def test_configure + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + + client = block_config = config = nil + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Retail::V2::CatalogService::Client.new do |config| + config.credentials = grpc_channel + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::Retail::V2::CatalogService::Client::Configuration, config + end + + def test_credentials + key = OpenSSL::PKey::RSA.new 2048 + cred_json = { + "private_key" => key.to_pem, + "client_email" => "app@developer.gserviceaccount.com", + "type" => "service_account" + } + key_file = StringIO.new cred_json.to_json + creds = Google::Auth::ServiceAccountCredentials.make_creds({ json_key_io: key_file }) + + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Retail::V2::CatalogService::Client.new do |config| + config.credentials = creds + end + assert_kind_of ::Google::Cloud::Retail::V2::CatalogService::Client, client + assert_equal creds, client.configure.credentials + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/completion_service_operations_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/completion_service_operations_test.rb new file mode 100644 index 000000000000..1fc78ca333ed --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/completion_service_operations_test.rb @@ -0,0 +1,400 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/cloud/retail/v2/completion_service_pb" +require "google/cloud/retail/v2/completion_service_services_pb" +require "google/cloud/retail/v2/completion_service" + +class ::Google::Cloud::Retail::V2::CompletionService::OperationsTest < Minitest::Test + class ClientStub + attr_accessor :call_rpc_count, :requests + + def initialize response, operation, &block + @response = response + @operation = operation + @block = block + @call_rpc_count = 0 + @requests = [] + end + + def call_rpc *args, **kwargs + @call_rpc_count += 1 + + @requests << @block&.call(*args, **kwargs) + + catch :response do + yield @response, @operation if block_given? + @response + end + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_list_operations + # Create GRPC objects. + grpc_response = ::Google::Longrunning::ListOperationsResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + filter = "hello world" + page_size = 42 + page_token = "hello world" + return_partial_success = true + + list_operations_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :list_operations, name + assert_kind_of ::Google::Longrunning::ListOperationsRequest, request + assert_equal "hello world", request["name"] + assert_equal "hello world", request["filter"] + assert_equal 42, request["page_size"] + assert_equal "hello world", request["page_token"] + assert_equal true, request["return_partial_success"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, list_operations_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::CompletionService::Operations.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.list_operations({ name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success }) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.list_operations name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.list_operations ::Google::Longrunning::ListOperationsRequest.new(name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.list_operations({ name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success }, grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.list_operations(::Google::Longrunning::ListOperationsRequest.new(name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success), grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, list_operations_client_stub.call_rpc_count + end + end + + def test_get_operation + # Create GRPC objects. + grpc_response = ::Google::Longrunning::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :get_operation, name + assert_kind_of ::Google::Longrunning::GetOperationRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, get_operation_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::CompletionService::Operations.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.get_operation({ name: name }) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use named arguments + c.get_operation name: name do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.get_operation ::Google::Longrunning::GetOperationRequest.new(name: name) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.get_operation({ name: name }, grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.get_operation(::Google::Longrunning::GetOperationRequest.new(name: name), grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, get_operation_client_stub.call_rpc_count + end + end + + def test_delete_operation + # Create GRPC objects. + grpc_response = ::Google::Protobuf::Empty.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + delete_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :delete_operation, name + assert_kind_of ::Google::Longrunning::DeleteOperationRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, delete_operation_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::CompletionService::Operations.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.delete_operation({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.delete_operation name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.delete_operation ::Google::Longrunning::DeleteOperationRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.delete_operation({ name: name }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.delete_operation(::Google::Longrunning::DeleteOperationRequest.new(name: name), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, delete_operation_client_stub.call_rpc_count + end + end + + def test_cancel_operation + # Create GRPC objects. + grpc_response = ::Google::Protobuf::Empty.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + cancel_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :cancel_operation, name + assert_kind_of ::Google::Longrunning::CancelOperationRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, cancel_operation_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::CompletionService::Operations.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.cancel_operation({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.cancel_operation name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.cancel_operation ::Google::Longrunning::CancelOperationRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.cancel_operation({ name: name }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.cancel_operation(::Google::Longrunning::CancelOperationRequest.new(name: name), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, cancel_operation_client_stub.call_rpc_count + end + end + + def test_wait_operation + # Create GRPC objects. + grpc_response = ::Google::Longrunning::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + timeout = {} + + wait_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :wait_operation, name + assert_kind_of ::Google::Longrunning::WaitOperationRequest, request + assert_equal "hello world", request["name"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::Duration), request["timeout"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, wait_operation_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::CompletionService::Operations.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.wait_operation({ name: name, timeout: timeout }) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use named arguments + c.wait_operation name: name, timeout: timeout do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.wait_operation ::Google::Longrunning::WaitOperationRequest.new(name: name, timeout: timeout) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.wait_operation({ name: name, timeout: timeout }, grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.wait_operation(::Google::Longrunning::WaitOperationRequest.new(name: name, timeout: timeout), grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, wait_operation_client_stub.call_rpc_count + end + end + + def test_configure + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + + client = block_config = config = nil + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Retail::V2::CompletionService::Operations.new do |config| + config.credentials = grpc_channel + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::Retail::V2::CompletionService::Operations::Configuration, config + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/completion_service_paths_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/completion_service_paths_test.rb new file mode 100644 index 000000000000..1fdf7e2de46a --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/completion_service_paths_test.rb @@ -0,0 +1,55 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/cloud/retail/v2/completion_service" + +class ::Google::Cloud::Retail::V2::CompletionService::ClientPathsTest < Minitest::Test + class DummyStub + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_catalog_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::Retail::V2::CompletionService::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.catalog_path project: "value0", location: "value1", catalog: "value2" + assert_equal "projects/value0/locations/value1/catalogs/value2", path + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/completion_service_rest_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/completion_service_rest_test.rb new file mode 100644 index 000000000000..2e1ef337e812 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/completion_service_rest_test.rb @@ -0,0 +1,217 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" +require "gapic/rest" +require "google/cloud/retail/v2/completion_service_pb" +require "google/cloud/retail/v2/completion_service/rest" + + +class ::Google::Cloud::Retail::V2::CompletionService::Rest::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_count, :requests + + def initialize response, &block + @response = response + @block = block + @call_count = 0 + @requests = [] + end + + def make_get_request uri:, params: {}, options: {}, method_name: nil + make_http_request :get, uri: uri, body: nil, params: params, options: options, method_name: method_name + end + + def make_delete_request uri:, params: {}, options: {}, method_name: nil + make_http_request :delete, uri: uri, body: nil, params: params, options: options, method_name: method_name + end + + def make_post_request uri:, body: nil, params: {}, options: {}, method_name: nil + make_http_request :post, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_patch_request uri:, body:, params: {}, options: {}, method_name: nil + make_http_request :patch, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_put_request uri:, body:, params: {}, options: {}, method_name: nil + make_http_request :put, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_http_request *args, **kwargs + @call_count += 1 + + @requests << @block&.call(*args, **kwargs) + + @response + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_complete_query + # Create test objects. + client_result = ::Google::Cloud::Retail::V2::CompleteQueryResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + catalog = "hello world" + query = "hello world" + visitor_id = "hello world" + language_codes = ["hello world"] + device_type = "hello world" + dataset = "hello world" + max_suggestions = 42 + enable_attribute_suggestions = true + entity = "hello world" + + complete_query_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::CompletionService::Rest::ServiceStub.stub :transcode_complete_query_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, complete_query_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::CompletionService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.complete_query({ catalog: catalog, query: query, visitor_id: visitor_id, language_codes: language_codes, device_type: device_type, dataset: dataset, max_suggestions: max_suggestions, enable_attribute_suggestions: enable_attribute_suggestions, entity: entity }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.complete_query catalog: catalog, query: query, visitor_id: visitor_id, language_codes: language_codes, device_type: device_type, dataset: dataset, max_suggestions: max_suggestions, enable_attribute_suggestions: enable_attribute_suggestions, entity: entity do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.complete_query ::Google::Cloud::Retail::V2::CompleteQueryRequest.new(catalog: catalog, query: query, visitor_id: visitor_id, language_codes: language_codes, device_type: device_type, dataset: dataset, max_suggestions: max_suggestions, enable_attribute_suggestions: enable_attribute_suggestions, entity: entity) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.complete_query({ catalog: catalog, query: query, visitor_id: visitor_id, language_codes: language_codes, device_type: device_type, dataset: dataset, max_suggestions: max_suggestions, enable_attribute_suggestions: enable_attribute_suggestions, entity: entity }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.complete_query(::Google::Cloud::Retail::V2::CompleteQueryRequest.new(catalog: catalog, query: query, visitor_id: visitor_id, language_codes: language_codes, device_type: device_type, dataset: dataset, max_suggestions: max_suggestions, enable_attribute_suggestions: enable_attribute_suggestions, entity: entity), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, complete_query_client_stub.call_count + end + end + end + + def test_import_completion_data + # Create test objects. + client_result = ::Google::Longrunning::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + input_config = {} + notification_pubsub_topic = "hello world" + + import_completion_data_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::CompletionService::Rest::ServiceStub.stub :transcode_import_completion_data_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, import_completion_data_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::CompletionService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.import_completion_data({ parent: parent, input_config: input_config, notification_pubsub_topic: notification_pubsub_topic }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.import_completion_data parent: parent, input_config: input_config, notification_pubsub_topic: notification_pubsub_topic do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.import_completion_data ::Google::Cloud::Retail::V2::ImportCompletionDataRequest.new(parent: parent, input_config: input_config, notification_pubsub_topic: notification_pubsub_topic) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.import_completion_data({ parent: parent, input_config: input_config, notification_pubsub_topic: notification_pubsub_topic }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.import_completion_data(::Google::Cloud::Retail::V2::ImportCompletionDataRequest.new(parent: parent, input_config: input_config, notification_pubsub_topic: notification_pubsub_topic), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, import_completion_data_client_stub.call_count + end + end + end + + def test_configure + credentials_token = :dummy_value + + client = block_config = config = nil + dummy_stub = ClientStub.new nil + Gapic::Rest::ClientStub.stub :new, dummy_stub do + client = ::Google::Cloud::Retail::V2::CompletionService::Rest::Client.new do |config| + config.credentials = credentials_token + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::Retail::V2::CompletionService::Rest::Client::Configuration, config + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/completion_service_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/completion_service_test.rb new file mode 100644 index 000000000000..cfa7fce3193e --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/completion_service_test.rb @@ -0,0 +1,259 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/cloud/retail/v2/completion_service_pb" +require "google/cloud/retail/v2/completion_service" + +class ::Google::Cloud::Retail::V2::CompletionService::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_rpc_count, :requests + + def initialize response, operation, &block + @response = response + @operation = operation + @block = block + @call_rpc_count = 0 + @requests = [] + end + + def call_rpc *args, **kwargs + @call_rpc_count += 1 + + @requests << @block&.call(*args, **kwargs) + + catch :response do + yield @response, @operation if block_given? + @response + end + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_complete_query + # Create GRPC objects. + grpc_response = ::Google::Cloud::Retail::V2::CompleteQueryResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + catalog = "hello world" + query = "hello world" + visitor_id = "hello world" + language_codes = ["hello world"] + device_type = "hello world" + dataset = "hello world" + max_suggestions = 42 + enable_attribute_suggestions = true + entity = "hello world" + + complete_query_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :complete_query, name + assert_kind_of ::Google::Cloud::Retail::V2::CompleteQueryRequest, request + assert_equal "hello world", request["catalog"] + assert_equal "hello world", request["query"] + assert_equal "hello world", request["visitor_id"] + assert_equal ["hello world"], request["language_codes"] + assert_equal "hello world", request["device_type"] + assert_equal "hello world", request["dataset"] + assert_equal 42, request["max_suggestions"] + assert_equal true, request["enable_attribute_suggestions"] + assert_equal "hello world", request["entity"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, complete_query_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::CompletionService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.complete_query({ catalog: catalog, query: query, visitor_id: visitor_id, language_codes: language_codes, device_type: device_type, dataset: dataset, max_suggestions: max_suggestions, enable_attribute_suggestions: enable_attribute_suggestions, entity: entity }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.complete_query catalog: catalog, query: query, visitor_id: visitor_id, language_codes: language_codes, device_type: device_type, dataset: dataset, max_suggestions: max_suggestions, enable_attribute_suggestions: enable_attribute_suggestions, entity: entity do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.complete_query ::Google::Cloud::Retail::V2::CompleteQueryRequest.new(catalog: catalog, query: query, visitor_id: visitor_id, language_codes: language_codes, device_type: device_type, dataset: dataset, max_suggestions: max_suggestions, enable_attribute_suggestions: enable_attribute_suggestions, entity: entity) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.complete_query({ catalog: catalog, query: query, visitor_id: visitor_id, language_codes: language_codes, device_type: device_type, dataset: dataset, max_suggestions: max_suggestions, enable_attribute_suggestions: enable_attribute_suggestions, entity: entity }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.complete_query(::Google::Cloud::Retail::V2::CompleteQueryRequest.new(catalog: catalog, query: query, visitor_id: visitor_id, language_codes: language_codes, device_type: device_type, dataset: dataset, max_suggestions: max_suggestions, enable_attribute_suggestions: enable_attribute_suggestions, entity: entity), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, complete_query_client_stub.call_rpc_count + end + end + + def test_import_completion_data + # Create GRPC objects. + grpc_response = ::Google::Longrunning::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + input_config = {} + notification_pubsub_topic = "hello world" + + import_completion_data_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :import_completion_data, name + assert_kind_of ::Google::Cloud::Retail::V2::ImportCompletionDataRequest, request + assert_equal "hello world", request["parent"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::CompletionDataInputConfig), request["input_config"] + assert_equal "hello world", request["notification_pubsub_topic"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, import_completion_data_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::CompletionService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.import_completion_data({ parent: parent, input_config: input_config, notification_pubsub_topic: notification_pubsub_topic }) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use named arguments + c.import_completion_data parent: parent, input_config: input_config, notification_pubsub_topic: notification_pubsub_topic do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.import_completion_data ::Google::Cloud::Retail::V2::ImportCompletionDataRequest.new(parent: parent, input_config: input_config, notification_pubsub_topic: notification_pubsub_topic) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.import_completion_data({ parent: parent, input_config: input_config, notification_pubsub_topic: notification_pubsub_topic }, grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.import_completion_data(::Google::Cloud::Retail::V2::ImportCompletionDataRequest.new(parent: parent, input_config: input_config, notification_pubsub_topic: notification_pubsub_topic), grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, import_completion_data_client_stub.call_rpc_count + end + end + + def test_configure + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + + client = block_config = config = nil + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Retail::V2::CompletionService::Client.new do |config| + config.credentials = grpc_channel + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::Retail::V2::CompletionService::Client::Configuration, config + end + + def test_credentials + key = OpenSSL::PKey::RSA.new 2048 + cred_json = { + "private_key" => key.to_pem, + "client_email" => "app@developer.gserviceaccount.com", + "type" => "service_account" + } + key_file = StringIO.new cred_json.to_json + creds = Google::Auth::ServiceAccountCredentials.make_creds({ json_key_io: key_file }) + + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Retail::V2::CompletionService::Client.new do |config| + config.credentials = creds + end + assert_kind_of ::Google::Cloud::Retail::V2::CompletionService::Client, client + assert_equal creds, client.configure.credentials + end + end + + def test_operations_client + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + + client = nil + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Retail::V2::CompletionService::Client.new do |config| + config.credentials = grpc_channel + end + end + + assert_kind_of ::Google::Cloud::Retail::V2::CompletionService::Operations, client.operations_client + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/control_service_paths_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/control_service_paths_test.rb new file mode 100644 index 000000000000..3a2ba3c8bc0f --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/control_service_paths_test.rb @@ -0,0 +1,67 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/cloud/retail/v2/control_service" + +class ::Google::Cloud::Retail::V2::ControlService::ClientPathsTest < Minitest::Test + class DummyStub + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_catalog_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::Retail::V2::ControlService::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.catalog_path project: "value0", location: "value1", catalog: "value2" + assert_equal "projects/value0/locations/value1/catalogs/value2", path + end + end + + def test_control_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::Retail::V2::ControlService::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.control_path project: "value0", location: "value1", catalog: "value2", control: "value3" + assert_equal "projects/value0/locations/value1/catalogs/value2/controls/value3", path + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/control_service_rest_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/control_service_rest_test.rb new file mode 100644 index 000000000000..a01a2054149f --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/control_service_rest_test.rb @@ -0,0 +1,375 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" +require "gapic/rest" +require "google/cloud/retail/v2/control_service_pb" +require "google/cloud/retail/v2/control_service/rest" + + +class ::Google::Cloud::Retail::V2::ControlService::Rest::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_count, :requests + + def initialize response, &block + @response = response + @block = block + @call_count = 0 + @requests = [] + end + + def make_get_request uri:, params: {}, options: {}, method_name: nil + make_http_request :get, uri: uri, body: nil, params: params, options: options, method_name: method_name + end + + def make_delete_request uri:, params: {}, options: {}, method_name: nil + make_http_request :delete, uri: uri, body: nil, params: params, options: options, method_name: method_name + end + + def make_post_request uri:, body: nil, params: {}, options: {}, method_name: nil + make_http_request :post, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_patch_request uri:, body:, params: {}, options: {}, method_name: nil + make_http_request :patch, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_put_request uri:, body:, params: {}, options: {}, method_name: nil + make_http_request :put, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_http_request *args, **kwargs + @call_count += 1 + + @requests << @block&.call(*args, **kwargs) + + @response + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_create_control + # Create test objects. + client_result = ::Google::Cloud::Retail::V2::Control.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + control = {} + control_id = "hello world" + + create_control_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::ControlService::Rest::ServiceStub.stub :transcode_create_control_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, create_control_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ControlService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.create_control({ parent: parent, control: control, control_id: control_id }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.create_control parent: parent, control: control, control_id: control_id do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.create_control ::Google::Cloud::Retail::V2::CreateControlRequest.new(parent: parent, control: control, control_id: control_id) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.create_control({ parent: parent, control: control, control_id: control_id }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.create_control(::Google::Cloud::Retail::V2::CreateControlRequest.new(parent: parent, control: control, control_id: control_id), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, create_control_client_stub.call_count + end + end + end + + def test_delete_control + # Create test objects. + client_result = ::Google::Protobuf::Empty.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + delete_control_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::ControlService::Rest::ServiceStub.stub :transcode_delete_control_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, delete_control_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ControlService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.delete_control({ name: name }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.delete_control name: name do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.delete_control ::Google::Cloud::Retail::V2::DeleteControlRequest.new(name: name) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.delete_control({ name: name }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.delete_control(::Google::Cloud::Retail::V2::DeleteControlRequest.new(name: name), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, delete_control_client_stub.call_count + end + end + end + + def test_update_control + # Create test objects. + client_result = ::Google::Cloud::Retail::V2::Control.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + control = {} + update_mask = {} + + update_control_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::ControlService::Rest::ServiceStub.stub :transcode_update_control_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, update_control_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ControlService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.update_control({ control: control, update_mask: update_mask }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.update_control control: control, update_mask: update_mask do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.update_control ::Google::Cloud::Retail::V2::UpdateControlRequest.new(control: control, update_mask: update_mask) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.update_control({ control: control, update_mask: update_mask }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.update_control(::Google::Cloud::Retail::V2::UpdateControlRequest.new(control: control, update_mask: update_mask), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, update_control_client_stub.call_count + end + end + end + + def test_get_control + # Create test objects. + client_result = ::Google::Cloud::Retail::V2::Control.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_control_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::ControlService::Rest::ServiceStub.stub :transcode_get_control_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, get_control_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ControlService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.get_control({ name: name }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.get_control name: name do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.get_control ::Google::Cloud::Retail::V2::GetControlRequest.new(name: name) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.get_control({ name: name }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.get_control(::Google::Cloud::Retail::V2::GetControlRequest.new(name: name), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, get_control_client_stub.call_count + end + end + end + + def test_list_controls + # Create test objects. + client_result = ::Google::Cloud::Retail::V2::ListControlsResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + page_size = 42 + page_token = "hello world" + filter = "hello world" + + list_controls_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::ControlService::Rest::ServiceStub.stub :transcode_list_controls_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, list_controls_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ControlService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.list_controls({ parent: parent, page_size: page_size, page_token: page_token, filter: filter }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.list_controls parent: parent, page_size: page_size, page_token: page_token, filter: filter do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.list_controls ::Google::Cloud::Retail::V2::ListControlsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.list_controls({ parent: parent, page_size: page_size, page_token: page_token, filter: filter }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.list_controls(::Google::Cloud::Retail::V2::ListControlsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, list_controls_client_stub.call_count + end + end + end + + def test_configure + credentials_token = :dummy_value + + client = block_config = config = nil + dummy_stub = ClientStub.new nil + Gapic::Rest::ClientStub.stub :new, dummy_stub do + client = ::Google::Cloud::Retail::V2::ControlService::Rest::Client.new do |config| + config.credentials = credentials_token + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::Retail::V2::ControlService::Rest::Client::Configuration, config + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/control_service_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/control_service_test.rb new file mode 100644 index 000000000000..91528d0ca0f7 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/control_service_test.rb @@ -0,0 +1,411 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/cloud/retail/v2/control_service_pb" +require "google/cloud/retail/v2/control_service" + +class ::Google::Cloud::Retail::V2::ControlService::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_rpc_count, :requests + + def initialize response, operation, &block + @response = response + @operation = operation + @block = block + @call_rpc_count = 0 + @requests = [] + end + + def call_rpc *args, **kwargs + @call_rpc_count += 1 + + @requests << @block&.call(*args, **kwargs) + + catch :response do + yield @response, @operation if block_given? + @response + end + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_create_control + # Create GRPC objects. + grpc_response = ::Google::Cloud::Retail::V2::Control.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + control = {} + control_id = "hello world" + + create_control_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :create_control, name + assert_kind_of ::Google::Cloud::Retail::V2::CreateControlRequest, request + assert_equal "hello world", request["parent"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::Control), request["control"] + assert_equal "hello world", request["control_id"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, create_control_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ControlService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.create_control({ parent: parent, control: control, control_id: control_id }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.create_control parent: parent, control: control, control_id: control_id do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.create_control ::Google::Cloud::Retail::V2::CreateControlRequest.new(parent: parent, control: control, control_id: control_id) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.create_control({ parent: parent, control: control, control_id: control_id }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.create_control(::Google::Cloud::Retail::V2::CreateControlRequest.new(parent: parent, control: control, control_id: control_id), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, create_control_client_stub.call_rpc_count + end + end + + def test_delete_control + # Create GRPC objects. + grpc_response = ::Google::Protobuf::Empty.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + delete_control_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :delete_control, name + assert_kind_of ::Google::Cloud::Retail::V2::DeleteControlRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, delete_control_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ControlService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.delete_control({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.delete_control name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.delete_control ::Google::Cloud::Retail::V2::DeleteControlRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.delete_control({ name: name }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.delete_control(::Google::Cloud::Retail::V2::DeleteControlRequest.new(name: name), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, delete_control_client_stub.call_rpc_count + end + end + + def test_update_control + # Create GRPC objects. + grpc_response = ::Google::Cloud::Retail::V2::Control.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + control = {} + update_mask = {} + + update_control_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :update_control, name + assert_kind_of ::Google::Cloud::Retail::V2::UpdateControlRequest, request + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::Control), request["control"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::FieldMask), request["update_mask"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, update_control_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ControlService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.update_control({ control: control, update_mask: update_mask }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.update_control control: control, update_mask: update_mask do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.update_control ::Google::Cloud::Retail::V2::UpdateControlRequest.new(control: control, update_mask: update_mask) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.update_control({ control: control, update_mask: update_mask }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.update_control(::Google::Cloud::Retail::V2::UpdateControlRequest.new(control: control, update_mask: update_mask), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, update_control_client_stub.call_rpc_count + end + end + + def test_get_control + # Create GRPC objects. + grpc_response = ::Google::Cloud::Retail::V2::Control.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_control_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :get_control, name + assert_kind_of ::Google::Cloud::Retail::V2::GetControlRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, get_control_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ControlService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.get_control({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.get_control name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.get_control ::Google::Cloud::Retail::V2::GetControlRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.get_control({ name: name }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.get_control(::Google::Cloud::Retail::V2::GetControlRequest.new(name: name), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, get_control_client_stub.call_rpc_count + end + end + + def test_list_controls + # Create GRPC objects. + grpc_response = ::Google::Cloud::Retail::V2::ListControlsResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + page_size = 42 + page_token = "hello world" + filter = "hello world" + + list_controls_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :list_controls, name + assert_kind_of ::Google::Cloud::Retail::V2::ListControlsRequest, request + assert_equal "hello world", request["parent"] + assert_equal 42, request["page_size"] + assert_equal "hello world", request["page_token"] + assert_equal "hello world", request["filter"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, list_controls_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ControlService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.list_controls({ parent: parent, page_size: page_size, page_token: page_token, filter: filter }) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.list_controls parent: parent, page_size: page_size, page_token: page_token, filter: filter do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.list_controls ::Google::Cloud::Retail::V2::ListControlsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.list_controls({ parent: parent, page_size: page_size, page_token: page_token, filter: filter }, grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.list_controls(::Google::Cloud::Retail::V2::ListControlsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter), grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, list_controls_client_stub.call_rpc_count + end + end + + def test_configure + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + + client = block_config = config = nil + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Retail::V2::ControlService::Client.new do |config| + config.credentials = grpc_channel + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::Retail::V2::ControlService::Client::Configuration, config + end + + def test_credentials + key = OpenSSL::PKey::RSA.new 2048 + cred_json = { + "private_key" => key.to_pem, + "client_email" => "app@developer.gserviceaccount.com", + "type" => "service_account" + } + key_file = StringIO.new cred_json.to_json + creds = Google::Auth::ServiceAccountCredentials.make_creds({ json_key_io: key_file }) + + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Retail::V2::ControlService::Client.new do |config| + config.credentials = creds + end + assert_kind_of ::Google::Cloud::Retail::V2::ControlService::Client, client + assert_equal creds, client.configure.credentials + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/conversational_search_service_paths_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/conversational_search_service_paths_test.rb new file mode 100644 index 000000000000..fdef51260f2e --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/conversational_search_service_paths_test.rb @@ -0,0 +1,55 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/cloud/retail/v2/conversational_search_service" + +class ::Google::Cloud::Retail::V2::ConversationalSearchService::ClientPathsTest < Minitest::Test + class DummyStub + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_branch_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::Retail::V2::ConversationalSearchService::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.branch_path project: "value0", location: "value1", catalog: "value2", branch: "value3" + assert_equal "projects/value0/locations/value1/catalogs/value2/branches/value3", path + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/conversational_search_service_rest_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/conversational_search_service_rest_test.rb new file mode 100644 index 000000000000..6c3b9d2307b8 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/conversational_search_service_rest_test.rb @@ -0,0 +1,163 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" +require "gapic/rest" +require "google/cloud/retail/v2/conversational_search_service_pb" +require "google/cloud/retail/v2/conversational_search_service/rest" + + +class ::Google::Cloud::Retail::V2::ConversationalSearchService::Rest::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_count, :requests + + def initialize response, &block + @response = response + @block = block + @call_count = 0 + @requests = [] + end + + def make_get_request uri:, params: {}, options: {}, method_name: nil + make_http_request :get, uri: uri, body: nil, params: params, options: options, method_name: method_name + end + + def make_delete_request uri:, params: {}, options: {}, method_name: nil + make_http_request :delete, uri: uri, body: nil, params: params, options: options, method_name: method_name + end + + def make_post_request uri:, body: nil, params: {}, options: {}, method_name: nil + make_http_request :post, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_patch_request uri:, body:, params: {}, options: {}, method_name: nil + make_http_request :patch, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_put_request uri:, body:, params: {}, options: {}, method_name: nil + make_http_request :put, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_http_request *args, **kwargs + @call_count += 1 + + @requests << @block&.call(*args, **kwargs) + + @response + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_conversational_search + # Create test objects. + client_result = ::Google::Cloud::Retail::V2::ConversationalSearchResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + placement = "hello world" + branch = "hello world" + query = "hello world" + page_categories = ["hello world"] + conversation_id = "hello world" + search_params = {} + visitor_id = "hello world" + user_info = {} + conversational_filtering_spec = {} + user_labels = {} + safety_settings = [{}] + + conversational_search_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, is_server_streaming:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::ConversationalSearchService::Rest::ServiceStub.stub :transcode_conversational_search_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, conversational_search_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ConversationalSearchService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.conversational_search({ placement: placement, branch: branch, query: query, page_categories: page_categories, conversation_id: conversation_id, search_params: search_params, visitor_id: visitor_id, user_info: user_info, conversational_filtering_spec: conversational_filtering_spec, user_labels: user_labels, safety_settings: safety_settings }) do |_result, response| + assert_equal http_response, response.underlying_op + end.first + + # Use named arguments + c.conversational_search placement: placement, branch: branch, query: query, page_categories: page_categories, conversation_id: conversation_id, search_params: search_params, visitor_id: visitor_id, user_info: user_info, conversational_filtering_spec: conversational_filtering_spec, user_labels: user_labels, safety_settings: safety_settings do |_result, response| + assert_equal http_response, response.underlying_op + end.first + + # Use protobuf object + c.conversational_search ::Google::Cloud::Retail::V2::ConversationalSearchRequest.new(placement: placement, branch: branch, query: query, page_categories: page_categories, conversation_id: conversation_id, search_params: search_params, visitor_id: visitor_id, user_info: user_info, conversational_filtering_spec: conversational_filtering_spec, user_labels: user_labels, safety_settings: safety_settings) do |_result, response| + assert_equal http_response, response.underlying_op + end.first + + # Use hash object with options + c.conversational_search({ placement: placement, branch: branch, query: query, page_categories: page_categories, conversation_id: conversation_id, search_params: search_params, visitor_id: visitor_id, user_info: user_info, conversational_filtering_spec: conversational_filtering_spec, user_labels: user_labels, safety_settings: safety_settings }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end.first + + # Use protobuf object with options + c.conversational_search(::Google::Cloud::Retail::V2::ConversationalSearchRequest.new(placement: placement, branch: branch, query: query, page_categories: page_categories, conversation_id: conversation_id, search_params: search_params, visitor_id: visitor_id, user_info: user_info, conversational_filtering_spec: conversational_filtering_spec, user_labels: user_labels, safety_settings: safety_settings), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end.first + + # Verify method calls + assert_equal 5, conversational_search_client_stub.call_count + end + end + end + + def test_configure + credentials_token = :dummy_value + + client = block_config = config = nil + dummy_stub = ClientStub.new nil + Gapic::Rest::ClientStub.stub :new, dummy_stub do + client = ::Google::Cloud::Retail::V2::ConversationalSearchService::Rest::Client.new do |config| + config.credentials = credentials_token + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::Retail::V2::ConversationalSearchService::Rest::Client::Configuration, config + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/conversational_search_service_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/conversational_search_service_test.rb new file mode 100644 index 000000000000..01a7bfd250d9 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/conversational_search_service_test.rb @@ -0,0 +1,197 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/cloud/retail/v2/conversational_search_service_pb" +require "google/cloud/retail/v2/conversational_search_service" + +class ::Google::Cloud::Retail::V2::ConversationalSearchService::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_rpc_count, :requests + + def initialize response, operation, &block + @response = response + @operation = operation + @block = block + @call_rpc_count = 0 + @requests = [] + end + + def call_rpc *args, **kwargs + @call_rpc_count += 1 + + @requests << @block&.call(*args, **kwargs) + + catch :response do + yield @response, @operation if block_given? + @response + end + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_conversational_search + # Create GRPC objects. + grpc_response = ::Google::Cloud::Retail::V2::ConversationalSearchResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a server streaming method. + placement = "hello world" + branch = "hello world" + query = "hello world" + page_categories = ["hello world"] + conversation_id = "hello world" + search_params = {} + visitor_id = "hello world" + user_info = {} + conversational_filtering_spec = {} + user_labels = {} + safety_settings = [{}] + + conversational_search_client_stub = ClientStub.new [grpc_response].to_enum, grpc_operation do |name, request, options:| + assert_equal :conversational_search, name + assert_kind_of ::Google::Cloud::Retail::V2::ConversationalSearchRequest, request + assert_equal "hello world", request["placement"] + assert_equal "hello world", request["branch"] + assert_equal "hello world", request["query"] + assert_equal ["hello world"], request["page_categories"] + assert_equal "hello world", request["conversation_id"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::ConversationalSearchRequest::SearchParams), request["search_params"] + assert_equal "hello world", request["visitor_id"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::UserInfo), request["user_info"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::ConversationalSearchRequest::ConversationalFilteringSpec), request["conversational_filtering_spec"] + assert_equal({}, request["user_labels"].to_h) + assert_kind_of ::Google::Cloud::Retail::V2::SafetySetting, request["safety_settings"].first + refute_nil options + end + + Gapic::ServiceStub.stub :new, conversational_search_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ConversationalSearchService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.conversational_search({ placement: placement, branch: branch, query: query, page_categories: page_categories, conversation_id: conversation_id, search_params: search_params, visitor_id: visitor_id, user_info: user_info, conversational_filtering_spec: conversational_filtering_spec, user_labels: user_labels, safety_settings: safety_settings }) do |response, operation| + assert_kind_of Enumerable, response + response.to_a.each do |r| + assert_kind_of ::Google::Cloud::Retail::V2::ConversationalSearchResponse, r + end + assert_equal grpc_operation, operation + end + + # Use named arguments + c.conversational_search placement: placement, branch: branch, query: query, page_categories: page_categories, conversation_id: conversation_id, search_params: search_params, visitor_id: visitor_id, user_info: user_info, conversational_filtering_spec: conversational_filtering_spec, user_labels: user_labels, safety_settings: safety_settings do |response, operation| + assert_kind_of Enumerable, response + response.to_a.each do |r| + assert_kind_of ::Google::Cloud::Retail::V2::ConversationalSearchResponse, r + end + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.conversational_search ::Google::Cloud::Retail::V2::ConversationalSearchRequest.new(placement: placement, branch: branch, query: query, page_categories: page_categories, conversation_id: conversation_id, search_params: search_params, visitor_id: visitor_id, user_info: user_info, conversational_filtering_spec: conversational_filtering_spec, user_labels: user_labels, safety_settings: safety_settings) do |response, operation| + assert_kind_of Enumerable, response + response.to_a.each do |r| + assert_kind_of ::Google::Cloud::Retail::V2::ConversationalSearchResponse, r + end + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.conversational_search({ placement: placement, branch: branch, query: query, page_categories: page_categories, conversation_id: conversation_id, search_params: search_params, visitor_id: visitor_id, user_info: user_info, conversational_filtering_spec: conversational_filtering_spec, user_labels: user_labels, safety_settings: safety_settings }, grpc_options) do |response, operation| + assert_kind_of Enumerable, response + response.to_a.each do |r| + assert_kind_of ::Google::Cloud::Retail::V2::ConversationalSearchResponse, r + end + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.conversational_search(::Google::Cloud::Retail::V2::ConversationalSearchRequest.new(placement: placement, branch: branch, query: query, page_categories: page_categories, conversation_id: conversation_id, search_params: search_params, visitor_id: visitor_id, user_info: user_info, conversational_filtering_spec: conversational_filtering_spec, user_labels: user_labels, safety_settings: safety_settings), grpc_options) do |response, operation| + assert_kind_of Enumerable, response + response.to_a.each do |r| + assert_kind_of ::Google::Cloud::Retail::V2::ConversationalSearchResponse, r + end + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, conversational_search_client_stub.call_rpc_count + end + end + + def test_configure + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + + client = block_config = config = nil + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Retail::V2::ConversationalSearchService::Client.new do |config| + config.credentials = grpc_channel + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::Retail::V2::ConversationalSearchService::Client::Configuration, config + end + + def test_credentials + key = OpenSSL::PKey::RSA.new 2048 + cred_json = { + "private_key" => key.to_pem, + "client_email" => "app@developer.gserviceaccount.com", + "type" => "service_account" + } + key_file = StringIO.new cred_json.to_json + creds = Google::Auth::ServiceAccountCredentials.make_creds({ json_key_io: key_file }) + + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Retail::V2::ConversationalSearchService::Client.new do |config| + config.credentials = creds + end + assert_kind_of ::Google::Cloud::Retail::V2::ConversationalSearchService::Client, client + assert_equal creds, client.configure.credentials + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/generative_question_service_paths_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/generative_question_service_paths_test.rb new file mode 100644 index 000000000000..453c3660b939 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/generative_question_service_paths_test.rb @@ -0,0 +1,55 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/cloud/retail/v2/generative_question_service" + +class ::Google::Cloud::Retail::V2::GenerativeQuestionService::ClientPathsTest < Minitest::Test + class DummyStub + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_catalog_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::Retail::V2::GenerativeQuestionService::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.catalog_path project: "value0", location: "value1", catalog: "value2" + assert_equal "projects/value0/locations/value1/catalogs/value2", path + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/generative_question_service_rest_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/generative_question_service_rest_test.rb new file mode 100644 index 000000000000..6fd27afd1cd0 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/generative_question_service_rest_test.rb @@ -0,0 +1,372 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" +require "gapic/rest" +require "google/cloud/retail/v2/generative_question_service_pb" +require "google/cloud/retail/v2/generative_question_service/rest" + + +class ::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_count, :requests + + def initialize response, &block + @response = response + @block = block + @call_count = 0 + @requests = [] + end + + def make_get_request uri:, params: {}, options: {}, method_name: nil + make_http_request :get, uri: uri, body: nil, params: params, options: options, method_name: method_name + end + + def make_delete_request uri:, params: {}, options: {}, method_name: nil + make_http_request :delete, uri: uri, body: nil, params: params, options: options, method_name: method_name + end + + def make_post_request uri:, body: nil, params: {}, options: {}, method_name: nil + make_http_request :post, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_patch_request uri:, body:, params: {}, options: {}, method_name: nil + make_http_request :patch, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_put_request uri:, body:, params: {}, options: {}, method_name: nil + make_http_request :put, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_http_request *args, **kwargs + @call_count += 1 + + @requests << @block&.call(*args, **kwargs) + + @response + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_update_generative_questions_feature_config + # Create test objects. + client_result = ::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + generative_questions_feature_config = {} + update_mask = {} + + update_generative_questions_feature_config_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::ServiceStub.stub :transcode_update_generative_questions_feature_config_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, update_generative_questions_feature_config_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.update_generative_questions_feature_config({ generative_questions_feature_config: generative_questions_feature_config, update_mask: update_mask }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.update_generative_questions_feature_config generative_questions_feature_config: generative_questions_feature_config, update_mask: update_mask do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.update_generative_questions_feature_config ::Google::Cloud::Retail::V2::UpdateGenerativeQuestionsFeatureConfigRequest.new(generative_questions_feature_config: generative_questions_feature_config, update_mask: update_mask) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.update_generative_questions_feature_config({ generative_questions_feature_config: generative_questions_feature_config, update_mask: update_mask }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.update_generative_questions_feature_config(::Google::Cloud::Retail::V2::UpdateGenerativeQuestionsFeatureConfigRequest.new(generative_questions_feature_config: generative_questions_feature_config, update_mask: update_mask), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, update_generative_questions_feature_config_client_stub.call_count + end + end + end + + def test_get_generative_questions_feature_config + # Create test objects. + client_result = ::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + catalog = "hello world" + + get_generative_questions_feature_config_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::ServiceStub.stub :transcode_get_generative_questions_feature_config_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, get_generative_questions_feature_config_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.get_generative_questions_feature_config({ catalog: catalog }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.get_generative_questions_feature_config catalog: catalog do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.get_generative_questions_feature_config ::Google::Cloud::Retail::V2::GetGenerativeQuestionsFeatureConfigRequest.new(catalog: catalog) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.get_generative_questions_feature_config({ catalog: catalog }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.get_generative_questions_feature_config(::Google::Cloud::Retail::V2::GetGenerativeQuestionsFeatureConfigRequest.new(catalog: catalog), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, get_generative_questions_feature_config_client_stub.call_count + end + end + end + + def test_list_generative_question_configs + # Create test objects. + client_result = ::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + + list_generative_question_configs_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::ServiceStub.stub :transcode_list_generative_question_configs_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, list_generative_question_configs_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.list_generative_question_configs({ parent: parent }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.list_generative_question_configs parent: parent do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.list_generative_question_configs ::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsRequest.new(parent: parent) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.list_generative_question_configs({ parent: parent }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.list_generative_question_configs(::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsRequest.new(parent: parent), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, list_generative_question_configs_client_stub.call_count + end + end + end + + def test_update_generative_question_config + # Create test objects. + client_result = ::Google::Cloud::Retail::V2::GenerativeQuestionConfig.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + generative_question_config = {} + update_mask = {} + + update_generative_question_config_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::ServiceStub.stub :transcode_update_generative_question_config_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, update_generative_question_config_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.update_generative_question_config({ generative_question_config: generative_question_config, update_mask: update_mask }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.update_generative_question_config generative_question_config: generative_question_config, update_mask: update_mask do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.update_generative_question_config ::Google::Cloud::Retail::V2::UpdateGenerativeQuestionConfigRequest.new(generative_question_config: generative_question_config, update_mask: update_mask) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.update_generative_question_config({ generative_question_config: generative_question_config, update_mask: update_mask }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.update_generative_question_config(::Google::Cloud::Retail::V2::UpdateGenerativeQuestionConfigRequest.new(generative_question_config: generative_question_config, update_mask: update_mask), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, update_generative_question_config_client_stub.call_count + end + end + end + + def test_batch_update_generative_question_configs + # Create test objects. + client_result = ::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + requests = [{}] + + batch_update_generative_question_configs_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::ServiceStub.stub :transcode_batch_update_generative_question_configs_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, batch_update_generative_question_configs_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.batch_update_generative_question_configs({ parent: parent, requests: requests }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.batch_update_generative_question_configs parent: parent, requests: requests do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.batch_update_generative_question_configs ::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsRequest.new(parent: parent, requests: requests) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.batch_update_generative_question_configs({ parent: parent, requests: requests }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.batch_update_generative_question_configs(::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsRequest.new(parent: parent, requests: requests), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, batch_update_generative_question_configs_client_stub.call_count + end + end + end + + def test_configure + credentials_token = :dummy_value + + client = block_config = config = nil + dummy_stub = ClientStub.new nil + Gapic::Rest::ClientStub.stub :new, dummy_stub do + client = ::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client.new do |config| + config.credentials = credentials_token + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client::Configuration, config + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/generative_question_service_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/generative_question_service_test.rb new file mode 100644 index 000000000000..402c20df7db6 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/generative_question_service_test.rb @@ -0,0 +1,400 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/cloud/retail/v2/generative_question_service_pb" +require "google/cloud/retail/v2/generative_question_service" + +class ::Google::Cloud::Retail::V2::GenerativeQuestionService::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_rpc_count, :requests + + def initialize response, operation, &block + @response = response + @operation = operation + @block = block + @call_rpc_count = 0 + @requests = [] + end + + def call_rpc *args, **kwargs + @call_rpc_count += 1 + + @requests << @block&.call(*args, **kwargs) + + catch :response do + yield @response, @operation if block_given? + @response + end + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_update_generative_questions_feature_config + # Create GRPC objects. + grpc_response = ::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + generative_questions_feature_config = {} + update_mask = {} + + update_generative_questions_feature_config_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :update_generative_questions_feature_config, name + assert_kind_of ::Google::Cloud::Retail::V2::UpdateGenerativeQuestionsFeatureConfigRequest, request + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig), request["generative_questions_feature_config"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::FieldMask), request["update_mask"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, update_generative_questions_feature_config_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::GenerativeQuestionService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.update_generative_questions_feature_config({ generative_questions_feature_config: generative_questions_feature_config, update_mask: update_mask }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.update_generative_questions_feature_config generative_questions_feature_config: generative_questions_feature_config, update_mask: update_mask do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.update_generative_questions_feature_config ::Google::Cloud::Retail::V2::UpdateGenerativeQuestionsFeatureConfigRequest.new(generative_questions_feature_config: generative_questions_feature_config, update_mask: update_mask) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.update_generative_questions_feature_config({ generative_questions_feature_config: generative_questions_feature_config, update_mask: update_mask }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.update_generative_questions_feature_config(::Google::Cloud::Retail::V2::UpdateGenerativeQuestionsFeatureConfigRequest.new(generative_questions_feature_config: generative_questions_feature_config, update_mask: update_mask), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, update_generative_questions_feature_config_client_stub.call_rpc_count + end + end + + def test_get_generative_questions_feature_config + # Create GRPC objects. + grpc_response = ::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + catalog = "hello world" + + get_generative_questions_feature_config_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :get_generative_questions_feature_config, name + assert_kind_of ::Google::Cloud::Retail::V2::GetGenerativeQuestionsFeatureConfigRequest, request + assert_equal "hello world", request["catalog"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, get_generative_questions_feature_config_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::GenerativeQuestionService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.get_generative_questions_feature_config({ catalog: catalog }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.get_generative_questions_feature_config catalog: catalog do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.get_generative_questions_feature_config ::Google::Cloud::Retail::V2::GetGenerativeQuestionsFeatureConfigRequest.new(catalog: catalog) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.get_generative_questions_feature_config({ catalog: catalog }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.get_generative_questions_feature_config(::Google::Cloud::Retail::V2::GetGenerativeQuestionsFeatureConfigRequest.new(catalog: catalog), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, get_generative_questions_feature_config_client_stub.call_rpc_count + end + end + + def test_list_generative_question_configs + # Create GRPC objects. + grpc_response = ::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + + list_generative_question_configs_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :list_generative_question_configs, name + assert_kind_of ::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsRequest, request + assert_equal "hello world", request["parent"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, list_generative_question_configs_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::GenerativeQuestionService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.list_generative_question_configs({ parent: parent }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.list_generative_question_configs parent: parent do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.list_generative_question_configs ::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsRequest.new(parent: parent) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.list_generative_question_configs({ parent: parent }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.list_generative_question_configs(::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsRequest.new(parent: parent), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, list_generative_question_configs_client_stub.call_rpc_count + end + end + + def test_update_generative_question_config + # Create GRPC objects. + grpc_response = ::Google::Cloud::Retail::V2::GenerativeQuestionConfig.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + generative_question_config = {} + update_mask = {} + + update_generative_question_config_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :update_generative_question_config, name + assert_kind_of ::Google::Cloud::Retail::V2::UpdateGenerativeQuestionConfigRequest, request + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::GenerativeQuestionConfig), request["generative_question_config"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::FieldMask), request["update_mask"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, update_generative_question_config_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::GenerativeQuestionService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.update_generative_question_config({ generative_question_config: generative_question_config, update_mask: update_mask }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.update_generative_question_config generative_question_config: generative_question_config, update_mask: update_mask do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.update_generative_question_config ::Google::Cloud::Retail::V2::UpdateGenerativeQuestionConfigRequest.new(generative_question_config: generative_question_config, update_mask: update_mask) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.update_generative_question_config({ generative_question_config: generative_question_config, update_mask: update_mask }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.update_generative_question_config(::Google::Cloud::Retail::V2::UpdateGenerativeQuestionConfigRequest.new(generative_question_config: generative_question_config, update_mask: update_mask), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, update_generative_question_config_client_stub.call_rpc_count + end + end + + def test_batch_update_generative_question_configs + # Create GRPC objects. + grpc_response = ::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + requests = [{}] + + batch_update_generative_question_configs_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :batch_update_generative_question_configs, name + assert_kind_of ::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsRequest, request + assert_equal "hello world", request["parent"] + assert_kind_of ::Google::Cloud::Retail::V2::UpdateGenerativeQuestionConfigRequest, request["requests"].first + refute_nil options + end + + Gapic::ServiceStub.stub :new, batch_update_generative_question_configs_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::GenerativeQuestionService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.batch_update_generative_question_configs({ parent: parent, requests: requests }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.batch_update_generative_question_configs parent: parent, requests: requests do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.batch_update_generative_question_configs ::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsRequest.new(parent: parent, requests: requests) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.batch_update_generative_question_configs({ parent: parent, requests: requests }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.batch_update_generative_question_configs(::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsRequest.new(parent: parent, requests: requests), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, batch_update_generative_question_configs_client_stub.call_rpc_count + end + end + + def test_configure + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + + client = block_config = config = nil + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Retail::V2::GenerativeQuestionService::Client.new do |config| + config.credentials = grpc_channel + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::Retail::V2::GenerativeQuestionService::Client::Configuration, config + end + + def test_credentials + key = OpenSSL::PKey::RSA.new 2048 + cred_json = { + "private_key" => key.to_pem, + "client_email" => "app@developer.gserviceaccount.com", + "type" => "service_account" + } + key_file = StringIO.new cred_json.to_json + creds = Google::Auth::ServiceAccountCredentials.make_creds({ json_key_io: key_file }) + + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Retail::V2::GenerativeQuestionService::Client.new do |config| + config.credentials = creds + end + assert_kind_of ::Google::Cloud::Retail::V2::GenerativeQuestionService::Client, client + assert_equal creds, client.configure.credentials + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/model_service_operations_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/model_service_operations_test.rb new file mode 100644 index 000000000000..a570cdc85e06 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/model_service_operations_test.rb @@ -0,0 +1,400 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/cloud/retail/v2/model_service_pb" +require "google/cloud/retail/v2/model_service_services_pb" +require "google/cloud/retail/v2/model_service" + +class ::Google::Cloud::Retail::V2::ModelService::OperationsTest < Minitest::Test + class ClientStub + attr_accessor :call_rpc_count, :requests + + def initialize response, operation, &block + @response = response + @operation = operation + @block = block + @call_rpc_count = 0 + @requests = [] + end + + def call_rpc *args, **kwargs + @call_rpc_count += 1 + + @requests << @block&.call(*args, **kwargs) + + catch :response do + yield @response, @operation if block_given? + @response + end + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_list_operations + # Create GRPC objects. + grpc_response = ::Google::Longrunning::ListOperationsResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + filter = "hello world" + page_size = 42 + page_token = "hello world" + return_partial_success = true + + list_operations_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :list_operations, name + assert_kind_of ::Google::Longrunning::ListOperationsRequest, request + assert_equal "hello world", request["name"] + assert_equal "hello world", request["filter"] + assert_equal 42, request["page_size"] + assert_equal "hello world", request["page_token"] + assert_equal true, request["return_partial_success"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, list_operations_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ModelService::Operations.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.list_operations({ name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success }) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.list_operations name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.list_operations ::Google::Longrunning::ListOperationsRequest.new(name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.list_operations({ name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success }, grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.list_operations(::Google::Longrunning::ListOperationsRequest.new(name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success), grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, list_operations_client_stub.call_rpc_count + end + end + + def test_get_operation + # Create GRPC objects. + grpc_response = ::Google::Longrunning::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :get_operation, name + assert_kind_of ::Google::Longrunning::GetOperationRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, get_operation_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ModelService::Operations.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.get_operation({ name: name }) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use named arguments + c.get_operation name: name do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.get_operation ::Google::Longrunning::GetOperationRequest.new(name: name) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.get_operation({ name: name }, grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.get_operation(::Google::Longrunning::GetOperationRequest.new(name: name), grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, get_operation_client_stub.call_rpc_count + end + end + + def test_delete_operation + # Create GRPC objects. + grpc_response = ::Google::Protobuf::Empty.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + delete_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :delete_operation, name + assert_kind_of ::Google::Longrunning::DeleteOperationRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, delete_operation_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ModelService::Operations.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.delete_operation({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.delete_operation name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.delete_operation ::Google::Longrunning::DeleteOperationRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.delete_operation({ name: name }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.delete_operation(::Google::Longrunning::DeleteOperationRequest.new(name: name), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, delete_operation_client_stub.call_rpc_count + end + end + + def test_cancel_operation + # Create GRPC objects. + grpc_response = ::Google::Protobuf::Empty.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + cancel_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :cancel_operation, name + assert_kind_of ::Google::Longrunning::CancelOperationRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, cancel_operation_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ModelService::Operations.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.cancel_operation({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.cancel_operation name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.cancel_operation ::Google::Longrunning::CancelOperationRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.cancel_operation({ name: name }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.cancel_operation(::Google::Longrunning::CancelOperationRequest.new(name: name), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, cancel_operation_client_stub.call_rpc_count + end + end + + def test_wait_operation + # Create GRPC objects. + grpc_response = ::Google::Longrunning::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + timeout = {} + + wait_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :wait_operation, name + assert_kind_of ::Google::Longrunning::WaitOperationRequest, request + assert_equal "hello world", request["name"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::Duration), request["timeout"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, wait_operation_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ModelService::Operations.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.wait_operation({ name: name, timeout: timeout }) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use named arguments + c.wait_operation name: name, timeout: timeout do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.wait_operation ::Google::Longrunning::WaitOperationRequest.new(name: name, timeout: timeout) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.wait_operation({ name: name, timeout: timeout }, grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.wait_operation(::Google::Longrunning::WaitOperationRequest.new(name: name, timeout: timeout), grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, wait_operation_client_stub.call_rpc_count + end + end + + def test_configure + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + + client = block_config = config = nil + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Retail::V2::ModelService::Operations.new do |config| + config.credentials = grpc_channel + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::Retail::V2::ModelService::Operations::Configuration, config + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/model_service_paths_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/model_service_paths_test.rb new file mode 100644 index 000000000000..f077beeed1ed --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/model_service_paths_test.rb @@ -0,0 +1,67 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/cloud/retail/v2/model_service" + +class ::Google::Cloud::Retail::V2::ModelService::ClientPathsTest < Minitest::Test + class DummyStub + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_catalog_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::Retail::V2::ModelService::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.catalog_path project: "value0", location: "value1", catalog: "value2" + assert_equal "projects/value0/locations/value1/catalogs/value2", path + end + end + + def test_model_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::Retail::V2::ModelService::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.model_path project: "value0", location: "value1", catalog: "value2", model: "value3" + assert_equal "projects/value0/locations/value1/catalogs/value2/models/value3", path + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/model_service_rest_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/model_service_rest_test.rb new file mode 100644 index 000000000000..05afd9235f1a --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/model_service_rest_test.rb @@ -0,0 +1,536 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" +require "gapic/rest" +require "google/cloud/retail/v2/model_service_pb" +require "google/cloud/retail/v2/model_service/rest" + + +class ::Google::Cloud::Retail::V2::ModelService::Rest::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_count, :requests + + def initialize response, &block + @response = response + @block = block + @call_count = 0 + @requests = [] + end + + def make_get_request uri:, params: {}, options: {}, method_name: nil + make_http_request :get, uri: uri, body: nil, params: params, options: options, method_name: method_name + end + + def make_delete_request uri:, params: {}, options: {}, method_name: nil + make_http_request :delete, uri: uri, body: nil, params: params, options: options, method_name: method_name + end + + def make_post_request uri:, body: nil, params: {}, options: {}, method_name: nil + make_http_request :post, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_patch_request uri:, body:, params: {}, options: {}, method_name: nil + make_http_request :patch, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_put_request uri:, body:, params: {}, options: {}, method_name: nil + make_http_request :put, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_http_request *args, **kwargs + @call_count += 1 + + @requests << @block&.call(*args, **kwargs) + + @response + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_create_model + # Create test objects. + client_result = ::Google::Longrunning::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + model = {} + dry_run = true + + create_model_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::ModelService::Rest::ServiceStub.stub :transcode_create_model_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, create_model_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ModelService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.create_model({ parent: parent, model: model, dry_run: dry_run }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.create_model parent: parent, model: model, dry_run: dry_run do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.create_model ::Google::Cloud::Retail::V2::CreateModelRequest.new(parent: parent, model: model, dry_run: dry_run) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.create_model({ parent: parent, model: model, dry_run: dry_run }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.create_model(::Google::Cloud::Retail::V2::CreateModelRequest.new(parent: parent, model: model, dry_run: dry_run), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, create_model_client_stub.call_count + end + end + end + + def test_get_model + # Create test objects. + client_result = ::Google::Cloud::Retail::V2::Model.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_model_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::ModelService::Rest::ServiceStub.stub :transcode_get_model_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, get_model_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ModelService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.get_model({ name: name }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.get_model name: name do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.get_model ::Google::Cloud::Retail::V2::GetModelRequest.new(name: name) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.get_model({ name: name }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.get_model(::Google::Cloud::Retail::V2::GetModelRequest.new(name: name), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, get_model_client_stub.call_count + end + end + end + + def test_pause_model + # Create test objects. + client_result = ::Google::Cloud::Retail::V2::Model.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + pause_model_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::ModelService::Rest::ServiceStub.stub :transcode_pause_model_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, pause_model_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ModelService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.pause_model({ name: name }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.pause_model name: name do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.pause_model ::Google::Cloud::Retail::V2::PauseModelRequest.new(name: name) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.pause_model({ name: name }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.pause_model(::Google::Cloud::Retail::V2::PauseModelRequest.new(name: name), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, pause_model_client_stub.call_count + end + end + end + + def test_resume_model + # Create test objects. + client_result = ::Google::Cloud::Retail::V2::Model.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + resume_model_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::ModelService::Rest::ServiceStub.stub :transcode_resume_model_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, resume_model_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ModelService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.resume_model({ name: name }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.resume_model name: name do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.resume_model ::Google::Cloud::Retail::V2::ResumeModelRequest.new(name: name) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.resume_model({ name: name }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.resume_model(::Google::Cloud::Retail::V2::ResumeModelRequest.new(name: name), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, resume_model_client_stub.call_count + end + end + end + + def test_delete_model + # Create test objects. + client_result = ::Google::Protobuf::Empty.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + delete_model_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::ModelService::Rest::ServiceStub.stub :transcode_delete_model_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, delete_model_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ModelService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.delete_model({ name: name }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.delete_model name: name do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.delete_model ::Google::Cloud::Retail::V2::DeleteModelRequest.new(name: name) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.delete_model({ name: name }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.delete_model(::Google::Cloud::Retail::V2::DeleteModelRequest.new(name: name), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, delete_model_client_stub.call_count + end + end + end + + def test_list_models + # Create test objects. + client_result = ::Google::Cloud::Retail::V2::ListModelsResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + page_size = 42 + page_token = "hello world" + + list_models_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::ModelService::Rest::ServiceStub.stub :transcode_list_models_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, list_models_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ModelService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.list_models({ parent: parent, page_size: page_size, page_token: page_token }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.list_models parent: parent, page_size: page_size, page_token: page_token do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.list_models ::Google::Cloud::Retail::V2::ListModelsRequest.new(parent: parent, page_size: page_size, page_token: page_token) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.list_models({ parent: parent, page_size: page_size, page_token: page_token }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.list_models(::Google::Cloud::Retail::V2::ListModelsRequest.new(parent: parent, page_size: page_size, page_token: page_token), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, list_models_client_stub.call_count + end + end + end + + def test_update_model + # Create test objects. + client_result = ::Google::Cloud::Retail::V2::Model.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + model = {} + update_mask = {} + + update_model_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::ModelService::Rest::ServiceStub.stub :transcode_update_model_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, update_model_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ModelService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.update_model({ model: model, update_mask: update_mask }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.update_model model: model, update_mask: update_mask do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.update_model ::Google::Cloud::Retail::V2::UpdateModelRequest.new(model: model, update_mask: update_mask) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.update_model({ model: model, update_mask: update_mask }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.update_model(::Google::Cloud::Retail::V2::UpdateModelRequest.new(model: model, update_mask: update_mask), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, update_model_client_stub.call_count + end + end + end + + def test_tune_model + # Create test objects. + client_result = ::Google::Longrunning::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + tune_model_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::ModelService::Rest::ServiceStub.stub :transcode_tune_model_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, tune_model_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ModelService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.tune_model({ name: name }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.tune_model name: name do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.tune_model ::Google::Cloud::Retail::V2::TuneModelRequest.new(name: name) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.tune_model({ name: name }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.tune_model(::Google::Cloud::Retail::V2::TuneModelRequest.new(name: name), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, tune_model_client_stub.call_count + end + end + end + + def test_configure + credentials_token = :dummy_value + + client = block_config = config = nil + dummy_stub = ClientStub.new nil + Gapic::Rest::ClientStub.stub :new, dummy_stub do + client = ::Google::Cloud::Retail::V2::ModelService::Rest::Client.new do |config| + config.credentials = credentials_token + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::Retail::V2::ModelService::Rest::Client::Configuration, config + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/model_service_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/model_service_test.rb new file mode 100644 index 000000000000..c512995eb660 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/model_service_test.rb @@ -0,0 +1,607 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/cloud/retail/v2/model_service_pb" +require "google/cloud/retail/v2/model_service" + +class ::Google::Cloud::Retail::V2::ModelService::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_rpc_count, :requests + + def initialize response, operation, &block + @response = response + @operation = operation + @block = block + @call_rpc_count = 0 + @requests = [] + end + + def call_rpc *args, **kwargs + @call_rpc_count += 1 + + @requests << @block&.call(*args, **kwargs) + + catch :response do + yield @response, @operation if block_given? + @response + end + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_create_model + # Create GRPC objects. + grpc_response = ::Google::Longrunning::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + model = {} + dry_run = true + + create_model_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :create_model, name + assert_kind_of ::Google::Cloud::Retail::V2::CreateModelRequest, request + assert_equal "hello world", request["parent"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::Model), request["model"] + assert_equal true, request["dry_run"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, create_model_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ModelService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.create_model({ parent: parent, model: model, dry_run: dry_run }) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use named arguments + c.create_model parent: parent, model: model, dry_run: dry_run do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.create_model ::Google::Cloud::Retail::V2::CreateModelRequest.new(parent: parent, model: model, dry_run: dry_run) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.create_model({ parent: parent, model: model, dry_run: dry_run }, grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.create_model(::Google::Cloud::Retail::V2::CreateModelRequest.new(parent: parent, model: model, dry_run: dry_run), grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, create_model_client_stub.call_rpc_count + end + end + + def test_get_model + # Create GRPC objects. + grpc_response = ::Google::Cloud::Retail::V2::Model.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_model_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :get_model, name + assert_kind_of ::Google::Cloud::Retail::V2::GetModelRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, get_model_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ModelService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.get_model({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.get_model name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.get_model ::Google::Cloud::Retail::V2::GetModelRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.get_model({ name: name }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.get_model(::Google::Cloud::Retail::V2::GetModelRequest.new(name: name), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, get_model_client_stub.call_rpc_count + end + end + + def test_pause_model + # Create GRPC objects. + grpc_response = ::Google::Cloud::Retail::V2::Model.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + pause_model_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :pause_model, name + assert_kind_of ::Google::Cloud::Retail::V2::PauseModelRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, pause_model_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ModelService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.pause_model({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.pause_model name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.pause_model ::Google::Cloud::Retail::V2::PauseModelRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.pause_model({ name: name }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.pause_model(::Google::Cloud::Retail::V2::PauseModelRequest.new(name: name), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, pause_model_client_stub.call_rpc_count + end + end + + def test_resume_model + # Create GRPC objects. + grpc_response = ::Google::Cloud::Retail::V2::Model.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + resume_model_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :resume_model, name + assert_kind_of ::Google::Cloud::Retail::V2::ResumeModelRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, resume_model_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ModelService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.resume_model({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.resume_model name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.resume_model ::Google::Cloud::Retail::V2::ResumeModelRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.resume_model({ name: name }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.resume_model(::Google::Cloud::Retail::V2::ResumeModelRequest.new(name: name), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, resume_model_client_stub.call_rpc_count + end + end + + def test_delete_model + # Create GRPC objects. + grpc_response = ::Google::Protobuf::Empty.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + delete_model_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :delete_model, name + assert_kind_of ::Google::Cloud::Retail::V2::DeleteModelRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, delete_model_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ModelService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.delete_model({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.delete_model name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.delete_model ::Google::Cloud::Retail::V2::DeleteModelRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.delete_model({ name: name }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.delete_model(::Google::Cloud::Retail::V2::DeleteModelRequest.new(name: name), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, delete_model_client_stub.call_rpc_count + end + end + + def test_list_models + # Create GRPC objects. + grpc_response = ::Google::Cloud::Retail::V2::ListModelsResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + page_size = 42 + page_token = "hello world" + + list_models_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :list_models, name + assert_kind_of ::Google::Cloud::Retail::V2::ListModelsRequest, request + assert_equal "hello world", request["parent"] + assert_equal 42, request["page_size"] + assert_equal "hello world", request["page_token"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, list_models_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ModelService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.list_models({ parent: parent, page_size: page_size, page_token: page_token }) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.list_models parent: parent, page_size: page_size, page_token: page_token do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.list_models ::Google::Cloud::Retail::V2::ListModelsRequest.new(parent: parent, page_size: page_size, page_token: page_token) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.list_models({ parent: parent, page_size: page_size, page_token: page_token }, grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.list_models(::Google::Cloud::Retail::V2::ListModelsRequest.new(parent: parent, page_size: page_size, page_token: page_token), grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, list_models_client_stub.call_rpc_count + end + end + + def test_update_model + # Create GRPC objects. + grpc_response = ::Google::Cloud::Retail::V2::Model.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + model = {} + update_mask = {} + + update_model_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :update_model, name + assert_kind_of ::Google::Cloud::Retail::V2::UpdateModelRequest, request + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::Model), request["model"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::FieldMask), request["update_mask"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, update_model_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ModelService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.update_model({ model: model, update_mask: update_mask }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.update_model model: model, update_mask: update_mask do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.update_model ::Google::Cloud::Retail::V2::UpdateModelRequest.new(model: model, update_mask: update_mask) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.update_model({ model: model, update_mask: update_mask }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.update_model(::Google::Cloud::Retail::V2::UpdateModelRequest.new(model: model, update_mask: update_mask), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, update_model_client_stub.call_rpc_count + end + end + + def test_tune_model + # Create GRPC objects. + grpc_response = ::Google::Longrunning::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + tune_model_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :tune_model, name + assert_kind_of ::Google::Cloud::Retail::V2::TuneModelRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, tune_model_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ModelService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.tune_model({ name: name }) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use named arguments + c.tune_model name: name do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.tune_model ::Google::Cloud::Retail::V2::TuneModelRequest.new(name: name) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.tune_model({ name: name }, grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.tune_model(::Google::Cloud::Retail::V2::TuneModelRequest.new(name: name), grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, tune_model_client_stub.call_rpc_count + end + end + + def test_configure + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + + client = block_config = config = nil + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Retail::V2::ModelService::Client.new do |config| + config.credentials = grpc_channel + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::Retail::V2::ModelService::Client::Configuration, config + end + + def test_credentials + key = OpenSSL::PKey::RSA.new 2048 + cred_json = { + "private_key" => key.to_pem, + "client_email" => "app@developer.gserviceaccount.com", + "type" => "service_account" + } + key_file = StringIO.new cred_json.to_json + creds = Google::Auth::ServiceAccountCredentials.make_creds({ json_key_io: key_file }) + + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Retail::V2::ModelService::Client.new do |config| + config.credentials = creds + end + assert_kind_of ::Google::Cloud::Retail::V2::ModelService::Client, client + assert_equal creds, client.configure.credentials + end + end + + def test_operations_client + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + + client = nil + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Retail::V2::ModelService::Client.new do |config| + config.credentials = grpc_channel + end + end + + assert_kind_of ::Google::Cloud::Retail::V2::ModelService::Operations, client.operations_client + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/prediction_service_paths_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/prediction_service_paths_test.rb new file mode 100644 index 000000000000..531290668702 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/prediction_service_paths_test.rb @@ -0,0 +1,55 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/cloud/retail/v2/prediction_service" + +class ::Google::Cloud::Retail::V2::PredictionService::ClientPathsTest < Minitest::Test + class DummyStub + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_product_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::Retail::V2::PredictionService::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.product_path project: "value0", location: "value1", catalog: "value2", branch: "value3", product: "value4" + assert_equal "projects/value0/locations/value1/catalogs/value2/branches/value3/products/value4", path + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/prediction_service_rest_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/prediction_service_rest_test.rb new file mode 100644 index 000000000000..6f32476ef660 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/prediction_service_rest_test.rb @@ -0,0 +1,160 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" +require "gapic/rest" +require "google/cloud/retail/v2/prediction_service_pb" +require "google/cloud/retail/v2/prediction_service/rest" + + +class ::Google::Cloud::Retail::V2::PredictionService::Rest::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_count, :requests + + def initialize response, &block + @response = response + @block = block + @call_count = 0 + @requests = [] + end + + def make_get_request uri:, params: {}, options: {}, method_name: nil + make_http_request :get, uri: uri, body: nil, params: params, options: options, method_name: method_name + end + + def make_delete_request uri:, params: {}, options: {}, method_name: nil + make_http_request :delete, uri: uri, body: nil, params: params, options: options, method_name: method_name + end + + def make_post_request uri:, body: nil, params: {}, options: {}, method_name: nil + make_http_request :post, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_patch_request uri:, body:, params: {}, options: {}, method_name: nil + make_http_request :patch, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_put_request uri:, body:, params: {}, options: {}, method_name: nil + make_http_request :put, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_http_request *args, **kwargs + @call_count += 1 + + @requests << @block&.call(*args, **kwargs) + + @response + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_predict + # Create test objects. + client_result = ::Google::Cloud::Retail::V2::PredictResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + placement = "hello world" + user_event = {} + page_size = 42 + page_token = "hello world" + filter = "hello world" + validate_only = true + params = {} + labels = {} + + predict_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::PredictionService::Rest::ServiceStub.stub :transcode_predict_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, predict_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::PredictionService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.predict({ placement: placement, user_event: user_event, page_size: page_size, page_token: page_token, filter: filter, validate_only: validate_only, params: params, labels: labels }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.predict placement: placement, user_event: user_event, page_size: page_size, page_token: page_token, filter: filter, validate_only: validate_only, params: params, labels: labels do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.predict ::Google::Cloud::Retail::V2::PredictRequest.new(placement: placement, user_event: user_event, page_size: page_size, page_token: page_token, filter: filter, validate_only: validate_only, params: params, labels: labels) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.predict({ placement: placement, user_event: user_event, page_size: page_size, page_token: page_token, filter: filter, validate_only: validate_only, params: params, labels: labels }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.predict(::Google::Cloud::Retail::V2::PredictRequest.new(placement: placement, user_event: user_event, page_size: page_size, page_token: page_token, filter: filter, validate_only: validate_only, params: params, labels: labels), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, predict_client_stub.call_count + end + end + end + + def test_configure + credentials_token = :dummy_value + + client = block_config = config = nil + dummy_stub = ClientStub.new nil + Gapic::Rest::ClientStub.stub :new, dummy_stub do + client = ::Google::Cloud::Retail::V2::PredictionService::Rest::Client.new do |config| + config.credentials = credentials_token + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::Retail::V2::PredictionService::Rest::Client::Configuration, config + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/prediction_service_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/prediction_service_test.rb new file mode 100644 index 000000000000..3d5ed0aafaaa --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/prediction_service_test.rb @@ -0,0 +1,176 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/cloud/retail/v2/prediction_service_pb" +require "google/cloud/retail/v2/prediction_service" + +class ::Google::Cloud::Retail::V2::PredictionService::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_rpc_count, :requests + + def initialize response, operation, &block + @response = response + @operation = operation + @block = block + @call_rpc_count = 0 + @requests = [] + end + + def call_rpc *args, **kwargs + @call_rpc_count += 1 + + @requests << @block&.call(*args, **kwargs) + + catch :response do + yield @response, @operation if block_given? + @response + end + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_predict + # Create GRPC objects. + grpc_response = ::Google::Cloud::Retail::V2::PredictResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + placement = "hello world" + user_event = {} + page_size = 42 + page_token = "hello world" + filter = "hello world" + validate_only = true + params = {} + labels = {} + + predict_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :predict, name + assert_kind_of ::Google::Cloud::Retail::V2::PredictRequest, request + assert_equal "hello world", request["placement"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::UserEvent), request["user_event"] + assert_equal 42, request["page_size"] + assert_equal "hello world", request["page_token"] + assert_equal "hello world", request["filter"] + assert_equal true, request["validate_only"] + assert_equal({}, request["params"].to_h) + assert_equal({}, request["labels"].to_h) + refute_nil options + end + + Gapic::ServiceStub.stub :new, predict_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::PredictionService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.predict({ placement: placement, user_event: user_event, page_size: page_size, page_token: page_token, filter: filter, validate_only: validate_only, params: params, labels: labels }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.predict placement: placement, user_event: user_event, page_size: page_size, page_token: page_token, filter: filter, validate_only: validate_only, params: params, labels: labels do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.predict ::Google::Cloud::Retail::V2::PredictRequest.new(placement: placement, user_event: user_event, page_size: page_size, page_token: page_token, filter: filter, validate_only: validate_only, params: params, labels: labels) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.predict({ placement: placement, user_event: user_event, page_size: page_size, page_token: page_token, filter: filter, validate_only: validate_only, params: params, labels: labels }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.predict(::Google::Cloud::Retail::V2::PredictRequest.new(placement: placement, user_event: user_event, page_size: page_size, page_token: page_token, filter: filter, validate_only: validate_only, params: params, labels: labels), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, predict_client_stub.call_rpc_count + end + end + + def test_configure + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + + client = block_config = config = nil + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Retail::V2::PredictionService::Client.new do |config| + config.credentials = grpc_channel + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::Retail::V2::PredictionService::Client::Configuration, config + end + + def test_credentials + key = OpenSSL::PKey::RSA.new 2048 + cred_json = { + "private_key" => key.to_pem, + "client_email" => "app@developer.gserviceaccount.com", + "type" => "service_account" + } + key_file = StringIO.new cred_json.to_json + creds = Google::Auth::ServiceAccountCredentials.make_creds({ json_key_io: key_file }) + + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Retail::V2::PredictionService::Client.new do |config| + config.credentials = creds + end + assert_kind_of ::Google::Cloud::Retail::V2::PredictionService::Client, client + assert_equal creds, client.configure.credentials + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/product_service_operations_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/product_service_operations_test.rb new file mode 100644 index 000000000000..6aaed25a5816 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/product_service_operations_test.rb @@ -0,0 +1,400 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/cloud/retail/v2/product_service_pb" +require "google/cloud/retail/v2/product_service_services_pb" +require "google/cloud/retail/v2/product_service" + +class ::Google::Cloud::Retail::V2::ProductService::OperationsTest < Minitest::Test + class ClientStub + attr_accessor :call_rpc_count, :requests + + def initialize response, operation, &block + @response = response + @operation = operation + @block = block + @call_rpc_count = 0 + @requests = [] + end + + def call_rpc *args, **kwargs + @call_rpc_count += 1 + + @requests << @block&.call(*args, **kwargs) + + catch :response do + yield @response, @operation if block_given? + @response + end + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_list_operations + # Create GRPC objects. + grpc_response = ::Google::Longrunning::ListOperationsResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + filter = "hello world" + page_size = 42 + page_token = "hello world" + return_partial_success = true + + list_operations_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :list_operations, name + assert_kind_of ::Google::Longrunning::ListOperationsRequest, request + assert_equal "hello world", request["name"] + assert_equal "hello world", request["filter"] + assert_equal 42, request["page_size"] + assert_equal "hello world", request["page_token"] + assert_equal true, request["return_partial_success"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, list_operations_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ProductService::Operations.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.list_operations({ name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success }) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.list_operations name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.list_operations ::Google::Longrunning::ListOperationsRequest.new(name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.list_operations({ name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success }, grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.list_operations(::Google::Longrunning::ListOperationsRequest.new(name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success), grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, list_operations_client_stub.call_rpc_count + end + end + + def test_get_operation + # Create GRPC objects. + grpc_response = ::Google::Longrunning::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :get_operation, name + assert_kind_of ::Google::Longrunning::GetOperationRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, get_operation_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ProductService::Operations.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.get_operation({ name: name }) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use named arguments + c.get_operation name: name do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.get_operation ::Google::Longrunning::GetOperationRequest.new(name: name) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.get_operation({ name: name }, grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.get_operation(::Google::Longrunning::GetOperationRequest.new(name: name), grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, get_operation_client_stub.call_rpc_count + end + end + + def test_delete_operation + # Create GRPC objects. + grpc_response = ::Google::Protobuf::Empty.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + delete_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :delete_operation, name + assert_kind_of ::Google::Longrunning::DeleteOperationRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, delete_operation_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ProductService::Operations.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.delete_operation({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.delete_operation name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.delete_operation ::Google::Longrunning::DeleteOperationRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.delete_operation({ name: name }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.delete_operation(::Google::Longrunning::DeleteOperationRequest.new(name: name), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, delete_operation_client_stub.call_rpc_count + end + end + + def test_cancel_operation + # Create GRPC objects. + grpc_response = ::Google::Protobuf::Empty.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + cancel_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :cancel_operation, name + assert_kind_of ::Google::Longrunning::CancelOperationRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, cancel_operation_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ProductService::Operations.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.cancel_operation({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.cancel_operation name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.cancel_operation ::Google::Longrunning::CancelOperationRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.cancel_operation({ name: name }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.cancel_operation(::Google::Longrunning::CancelOperationRequest.new(name: name), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, cancel_operation_client_stub.call_rpc_count + end + end + + def test_wait_operation + # Create GRPC objects. + grpc_response = ::Google::Longrunning::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + timeout = {} + + wait_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :wait_operation, name + assert_kind_of ::Google::Longrunning::WaitOperationRequest, request + assert_equal "hello world", request["name"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::Duration), request["timeout"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, wait_operation_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ProductService::Operations.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.wait_operation({ name: name, timeout: timeout }) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use named arguments + c.wait_operation name: name, timeout: timeout do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.wait_operation ::Google::Longrunning::WaitOperationRequest.new(name: name, timeout: timeout) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.wait_operation({ name: name, timeout: timeout }, grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.wait_operation(::Google::Longrunning::WaitOperationRequest.new(name: name, timeout: timeout), grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, wait_operation_client_stub.call_rpc_count + end + end + + def test_configure + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + + client = block_config = config = nil + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Retail::V2::ProductService::Operations.new do |config| + config.credentials = grpc_channel + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::Retail::V2::ProductService::Operations::Configuration, config + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/product_service_paths_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/product_service_paths_test.rb new file mode 100644 index 000000000000..b58df28b3831 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/product_service_paths_test.rb @@ -0,0 +1,67 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/cloud/retail/v2/product_service" + +class ::Google::Cloud::Retail::V2::ProductService::ClientPathsTest < Minitest::Test + class DummyStub + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_branch_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::Retail::V2::ProductService::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.branch_path project: "value0", location: "value1", catalog: "value2", branch: "value3" + assert_equal "projects/value0/locations/value1/catalogs/value2/branches/value3", path + end + end + + def test_product_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::Retail::V2::ProductService::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.product_path project: "value0", location: "value1", catalog: "value2", branch: "value3", product: "value4" + assert_equal "projects/value0/locations/value1/catalogs/value2/branches/value3/products/value4", path + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/product_service_rest_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/product_service_rest_test.rb new file mode 100644 index 000000000000..b362952cd6c4 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/product_service_rest_test.rb @@ -0,0 +1,781 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" +require "gapic/rest" +require "google/cloud/retail/v2/product_service_pb" +require "google/cloud/retail/v2/product_service/rest" + + +class ::Google::Cloud::Retail::V2::ProductService::Rest::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_count, :requests + + def initialize response, &block + @response = response + @block = block + @call_count = 0 + @requests = [] + end + + def make_get_request uri:, params: {}, options: {}, method_name: nil + make_http_request :get, uri: uri, body: nil, params: params, options: options, method_name: method_name + end + + def make_delete_request uri:, params: {}, options: {}, method_name: nil + make_http_request :delete, uri: uri, body: nil, params: params, options: options, method_name: method_name + end + + def make_post_request uri:, body: nil, params: {}, options: {}, method_name: nil + make_http_request :post, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_patch_request uri:, body:, params: {}, options: {}, method_name: nil + make_http_request :patch, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_put_request uri:, body:, params: {}, options: {}, method_name: nil + make_http_request :put, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_http_request *args, **kwargs + @call_count += 1 + + @requests << @block&.call(*args, **kwargs) + + @response + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_create_product + # Create test objects. + client_result = ::Google::Cloud::Retail::V2::Product.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + product = {} + product_id = "hello world" + + create_product_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::ProductService::Rest::ServiceStub.stub :transcode_create_product_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, create_product_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ProductService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.create_product({ parent: parent, product: product, product_id: product_id }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.create_product parent: parent, product: product, product_id: product_id do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.create_product ::Google::Cloud::Retail::V2::CreateProductRequest.new(parent: parent, product: product, product_id: product_id) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.create_product({ parent: parent, product: product, product_id: product_id }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.create_product(::Google::Cloud::Retail::V2::CreateProductRequest.new(parent: parent, product: product, product_id: product_id), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, create_product_client_stub.call_count + end + end + end + + def test_get_product + # Create test objects. + client_result = ::Google::Cloud::Retail::V2::Product.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_product_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::ProductService::Rest::ServiceStub.stub :transcode_get_product_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, get_product_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ProductService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.get_product({ name: name }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.get_product name: name do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.get_product ::Google::Cloud::Retail::V2::GetProductRequest.new(name: name) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.get_product({ name: name }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.get_product(::Google::Cloud::Retail::V2::GetProductRequest.new(name: name), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, get_product_client_stub.call_count + end + end + end + + def test_list_products + # Create test objects. + client_result = ::Google::Cloud::Retail::V2::ListProductsResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + page_size = 42 + page_token = "hello world" + filter = "hello world" + read_mask = {} + + list_products_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::ProductService::Rest::ServiceStub.stub :transcode_list_products_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, list_products_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ProductService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.list_products({ parent: parent, page_size: page_size, page_token: page_token, filter: filter, read_mask: read_mask }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.list_products parent: parent, page_size: page_size, page_token: page_token, filter: filter, read_mask: read_mask do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.list_products ::Google::Cloud::Retail::V2::ListProductsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter, read_mask: read_mask) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.list_products({ parent: parent, page_size: page_size, page_token: page_token, filter: filter, read_mask: read_mask }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.list_products(::Google::Cloud::Retail::V2::ListProductsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter, read_mask: read_mask), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, list_products_client_stub.call_count + end + end + end + + def test_update_product + # Create test objects. + client_result = ::Google::Cloud::Retail::V2::Product.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + product = {} + update_mask = {} + allow_missing = true + + update_product_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::ProductService::Rest::ServiceStub.stub :transcode_update_product_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, update_product_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ProductService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.update_product({ product: product, update_mask: update_mask, allow_missing: allow_missing }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.update_product product: product, update_mask: update_mask, allow_missing: allow_missing do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.update_product ::Google::Cloud::Retail::V2::UpdateProductRequest.new(product: product, update_mask: update_mask, allow_missing: allow_missing) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.update_product({ product: product, update_mask: update_mask, allow_missing: allow_missing }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.update_product(::Google::Cloud::Retail::V2::UpdateProductRequest.new(product: product, update_mask: update_mask, allow_missing: allow_missing), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, update_product_client_stub.call_count + end + end + end + + def test_delete_product + # Create test objects. + client_result = ::Google::Protobuf::Empty.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + delete_product_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::ProductService::Rest::ServiceStub.stub :transcode_delete_product_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, delete_product_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ProductService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.delete_product({ name: name }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.delete_product name: name do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.delete_product ::Google::Cloud::Retail::V2::DeleteProductRequest.new(name: name) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.delete_product({ name: name }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.delete_product(::Google::Cloud::Retail::V2::DeleteProductRequest.new(name: name), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, delete_product_client_stub.call_count + end + end + end + + def test_purge_products + # Create test objects. + client_result = ::Google::Longrunning::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + filter = "hello world" + force = true + + purge_products_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::ProductService::Rest::ServiceStub.stub :transcode_purge_products_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, purge_products_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ProductService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.purge_products({ parent: parent, filter: filter, force: force }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.purge_products parent: parent, filter: filter, force: force do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.purge_products ::Google::Cloud::Retail::V2::PurgeProductsRequest.new(parent: parent, filter: filter, force: force) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.purge_products({ parent: parent, filter: filter, force: force }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.purge_products(::Google::Cloud::Retail::V2::PurgeProductsRequest.new(parent: parent, filter: filter, force: force), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, purge_products_client_stub.call_count + end + end + end + + def test_import_products + # Create test objects. + client_result = ::Google::Longrunning::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + request_id = "hello world" + input_config = {} + errors_config = {} + update_mask = {} + reconciliation_mode = :RECONCILIATION_MODE_UNSPECIFIED + notification_pubsub_topic = "hello world" + + import_products_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::ProductService::Rest::ServiceStub.stub :transcode_import_products_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, import_products_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ProductService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.import_products({ parent: parent, request_id: request_id, input_config: input_config, errors_config: errors_config, update_mask: update_mask, reconciliation_mode: reconciliation_mode, notification_pubsub_topic: notification_pubsub_topic }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.import_products parent: parent, request_id: request_id, input_config: input_config, errors_config: errors_config, update_mask: update_mask, reconciliation_mode: reconciliation_mode, notification_pubsub_topic: notification_pubsub_topic do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.import_products ::Google::Cloud::Retail::V2::ImportProductsRequest.new(parent: parent, request_id: request_id, input_config: input_config, errors_config: errors_config, update_mask: update_mask, reconciliation_mode: reconciliation_mode, notification_pubsub_topic: notification_pubsub_topic) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.import_products({ parent: parent, request_id: request_id, input_config: input_config, errors_config: errors_config, update_mask: update_mask, reconciliation_mode: reconciliation_mode, notification_pubsub_topic: notification_pubsub_topic }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.import_products(::Google::Cloud::Retail::V2::ImportProductsRequest.new(parent: parent, request_id: request_id, input_config: input_config, errors_config: errors_config, update_mask: update_mask, reconciliation_mode: reconciliation_mode, notification_pubsub_topic: notification_pubsub_topic), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, import_products_client_stub.call_count + end + end + end + + def test_set_inventory + # Create test objects. + client_result = ::Google::Longrunning::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + inventory = {} + set_mask = {} + set_time = {} + allow_missing = true + + set_inventory_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::ProductService::Rest::ServiceStub.stub :transcode_set_inventory_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, set_inventory_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ProductService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.set_inventory({ inventory: inventory, set_mask: set_mask, set_time: set_time, allow_missing: allow_missing }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.set_inventory inventory: inventory, set_mask: set_mask, set_time: set_time, allow_missing: allow_missing do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.set_inventory ::Google::Cloud::Retail::V2::SetInventoryRequest.new(inventory: inventory, set_mask: set_mask, set_time: set_time, allow_missing: allow_missing) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.set_inventory({ inventory: inventory, set_mask: set_mask, set_time: set_time, allow_missing: allow_missing }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.set_inventory(::Google::Cloud::Retail::V2::SetInventoryRequest.new(inventory: inventory, set_mask: set_mask, set_time: set_time, allow_missing: allow_missing), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, set_inventory_client_stub.call_count + end + end + end + + def test_add_fulfillment_places + # Create test objects. + client_result = ::Google::Longrunning::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + product = "hello world" + type = "hello world" + place_ids = ["hello world"] + add_time = {} + allow_missing = true + + add_fulfillment_places_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::ProductService::Rest::ServiceStub.stub :transcode_add_fulfillment_places_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, add_fulfillment_places_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ProductService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.add_fulfillment_places({ product: product, type: type, place_ids: place_ids, add_time: add_time, allow_missing: allow_missing }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.add_fulfillment_places product: product, type: type, place_ids: place_ids, add_time: add_time, allow_missing: allow_missing do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.add_fulfillment_places ::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest.new(product: product, type: type, place_ids: place_ids, add_time: add_time, allow_missing: allow_missing) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.add_fulfillment_places({ product: product, type: type, place_ids: place_ids, add_time: add_time, allow_missing: allow_missing }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.add_fulfillment_places(::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest.new(product: product, type: type, place_ids: place_ids, add_time: add_time, allow_missing: allow_missing), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, add_fulfillment_places_client_stub.call_count + end + end + end + + def test_remove_fulfillment_places + # Create test objects. + client_result = ::Google::Longrunning::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + product = "hello world" + type = "hello world" + place_ids = ["hello world"] + remove_time = {} + allow_missing = true + + remove_fulfillment_places_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::ProductService::Rest::ServiceStub.stub :transcode_remove_fulfillment_places_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, remove_fulfillment_places_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ProductService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.remove_fulfillment_places({ product: product, type: type, place_ids: place_ids, remove_time: remove_time, allow_missing: allow_missing }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.remove_fulfillment_places product: product, type: type, place_ids: place_ids, remove_time: remove_time, allow_missing: allow_missing do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.remove_fulfillment_places ::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest.new(product: product, type: type, place_ids: place_ids, remove_time: remove_time, allow_missing: allow_missing) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.remove_fulfillment_places({ product: product, type: type, place_ids: place_ids, remove_time: remove_time, allow_missing: allow_missing }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.remove_fulfillment_places(::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest.new(product: product, type: type, place_ids: place_ids, remove_time: remove_time, allow_missing: allow_missing), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, remove_fulfillment_places_client_stub.call_count + end + end + end + + def test_add_local_inventories + # Create test objects. + client_result = ::Google::Longrunning::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + product = "hello world" + local_inventories = [{}] + add_mask = {} + add_time = {} + allow_missing = true + + add_local_inventories_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::ProductService::Rest::ServiceStub.stub :transcode_add_local_inventories_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, add_local_inventories_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ProductService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.add_local_inventories({ product: product, local_inventories: local_inventories, add_mask: add_mask, add_time: add_time, allow_missing: allow_missing }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.add_local_inventories product: product, local_inventories: local_inventories, add_mask: add_mask, add_time: add_time, allow_missing: allow_missing do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.add_local_inventories ::Google::Cloud::Retail::V2::AddLocalInventoriesRequest.new(product: product, local_inventories: local_inventories, add_mask: add_mask, add_time: add_time, allow_missing: allow_missing) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.add_local_inventories({ product: product, local_inventories: local_inventories, add_mask: add_mask, add_time: add_time, allow_missing: allow_missing }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.add_local_inventories(::Google::Cloud::Retail::V2::AddLocalInventoriesRequest.new(product: product, local_inventories: local_inventories, add_mask: add_mask, add_time: add_time, allow_missing: allow_missing), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, add_local_inventories_client_stub.call_count + end + end + end + + def test_remove_local_inventories + # Create test objects. + client_result = ::Google::Longrunning::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + product = "hello world" + place_ids = ["hello world"] + remove_time = {} + allow_missing = true + + remove_local_inventories_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::ProductService::Rest::ServiceStub.stub :transcode_remove_local_inventories_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, remove_local_inventories_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ProductService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.remove_local_inventories({ product: product, place_ids: place_ids, remove_time: remove_time, allow_missing: allow_missing }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.remove_local_inventories product: product, place_ids: place_ids, remove_time: remove_time, allow_missing: allow_missing do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.remove_local_inventories ::Google::Cloud::Retail::V2::RemoveLocalInventoriesRequest.new(product: product, place_ids: place_ids, remove_time: remove_time, allow_missing: allow_missing) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.remove_local_inventories({ product: product, place_ids: place_ids, remove_time: remove_time, allow_missing: allow_missing }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.remove_local_inventories(::Google::Cloud::Retail::V2::RemoveLocalInventoriesRequest.new(product: product, place_ids: place_ids, remove_time: remove_time, allow_missing: allow_missing), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, remove_local_inventories_client_stub.call_count + end + end + end + + def test_configure + credentials_token = :dummy_value + + client = block_config = config = nil + dummy_stub = ClientStub.new nil + Gapic::Rest::ClientStub.stub :new, dummy_stub do + client = ::Google::Cloud::Retail::V2::ProductService::Rest::Client.new do |config| + config.credentials = credentials_token + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::Retail::V2::ProductService::Rest::Client::Configuration, config + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/product_service_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/product_service_test.rb new file mode 100644 index 000000000000..c4620093e075 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/product_service_test.rb @@ -0,0 +1,922 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/cloud/retail/v2/product_service_pb" +require "google/cloud/retail/v2/product_service" + +class ::Google::Cloud::Retail::V2::ProductService::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_rpc_count, :requests + + def initialize response, operation, &block + @response = response + @operation = operation + @block = block + @call_rpc_count = 0 + @requests = [] + end + + def call_rpc *args, **kwargs + @call_rpc_count += 1 + + @requests << @block&.call(*args, **kwargs) + + catch :response do + yield @response, @operation if block_given? + @response + end + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_create_product + # Create GRPC objects. + grpc_response = ::Google::Cloud::Retail::V2::Product.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + product = {} + product_id = "hello world" + + create_product_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :create_product, name + assert_kind_of ::Google::Cloud::Retail::V2::CreateProductRequest, request + assert_equal "hello world", request["parent"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::Product), request["product"] + assert_equal "hello world", request["product_id"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, create_product_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ProductService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.create_product({ parent: parent, product: product, product_id: product_id }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.create_product parent: parent, product: product, product_id: product_id do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.create_product ::Google::Cloud::Retail::V2::CreateProductRequest.new(parent: parent, product: product, product_id: product_id) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.create_product({ parent: parent, product: product, product_id: product_id }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.create_product(::Google::Cloud::Retail::V2::CreateProductRequest.new(parent: parent, product: product, product_id: product_id), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, create_product_client_stub.call_rpc_count + end + end + + def test_get_product + # Create GRPC objects. + grpc_response = ::Google::Cloud::Retail::V2::Product.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_product_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :get_product, name + assert_kind_of ::Google::Cloud::Retail::V2::GetProductRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, get_product_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ProductService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.get_product({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.get_product name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.get_product ::Google::Cloud::Retail::V2::GetProductRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.get_product({ name: name }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.get_product(::Google::Cloud::Retail::V2::GetProductRequest.new(name: name), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, get_product_client_stub.call_rpc_count + end + end + + def test_list_products + # Create GRPC objects. + grpc_response = ::Google::Cloud::Retail::V2::ListProductsResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + page_size = 42 + page_token = "hello world" + filter = "hello world" + read_mask = {} + + list_products_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :list_products, name + assert_kind_of ::Google::Cloud::Retail::V2::ListProductsRequest, request + assert_equal "hello world", request["parent"] + assert_equal 42, request["page_size"] + assert_equal "hello world", request["page_token"] + assert_equal "hello world", request["filter"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::FieldMask), request["read_mask"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, list_products_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ProductService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.list_products({ parent: parent, page_size: page_size, page_token: page_token, filter: filter, read_mask: read_mask }) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.list_products parent: parent, page_size: page_size, page_token: page_token, filter: filter, read_mask: read_mask do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.list_products ::Google::Cloud::Retail::V2::ListProductsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter, read_mask: read_mask) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.list_products({ parent: parent, page_size: page_size, page_token: page_token, filter: filter, read_mask: read_mask }, grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.list_products(::Google::Cloud::Retail::V2::ListProductsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter, read_mask: read_mask), grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, list_products_client_stub.call_rpc_count + end + end + + def test_update_product + # Create GRPC objects. + grpc_response = ::Google::Cloud::Retail::V2::Product.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + product = {} + update_mask = {} + allow_missing = true + + update_product_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :update_product, name + assert_kind_of ::Google::Cloud::Retail::V2::UpdateProductRequest, request + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::Product), request["product"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::FieldMask), request["update_mask"] + assert_equal true, request["allow_missing"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, update_product_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ProductService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.update_product({ product: product, update_mask: update_mask, allow_missing: allow_missing }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.update_product product: product, update_mask: update_mask, allow_missing: allow_missing do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.update_product ::Google::Cloud::Retail::V2::UpdateProductRequest.new(product: product, update_mask: update_mask, allow_missing: allow_missing) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.update_product({ product: product, update_mask: update_mask, allow_missing: allow_missing }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.update_product(::Google::Cloud::Retail::V2::UpdateProductRequest.new(product: product, update_mask: update_mask, allow_missing: allow_missing), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, update_product_client_stub.call_rpc_count + end + end + + def test_delete_product + # Create GRPC objects. + grpc_response = ::Google::Protobuf::Empty.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + delete_product_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :delete_product, name + assert_kind_of ::Google::Cloud::Retail::V2::DeleteProductRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, delete_product_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ProductService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.delete_product({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.delete_product name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.delete_product ::Google::Cloud::Retail::V2::DeleteProductRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.delete_product({ name: name }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.delete_product(::Google::Cloud::Retail::V2::DeleteProductRequest.new(name: name), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, delete_product_client_stub.call_rpc_count + end + end + + def test_purge_products + # Create GRPC objects. + grpc_response = ::Google::Longrunning::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + filter = "hello world" + force = true + + purge_products_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :purge_products, name + assert_kind_of ::Google::Cloud::Retail::V2::PurgeProductsRequest, request + assert_equal "hello world", request["parent"] + assert_equal "hello world", request["filter"] + assert_equal true, request["force"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, purge_products_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ProductService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.purge_products({ parent: parent, filter: filter, force: force }) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use named arguments + c.purge_products parent: parent, filter: filter, force: force do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.purge_products ::Google::Cloud::Retail::V2::PurgeProductsRequest.new(parent: parent, filter: filter, force: force) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.purge_products({ parent: parent, filter: filter, force: force }, grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.purge_products(::Google::Cloud::Retail::V2::PurgeProductsRequest.new(parent: parent, filter: filter, force: force), grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, purge_products_client_stub.call_rpc_count + end + end + + def test_import_products + # Create GRPC objects. + grpc_response = ::Google::Longrunning::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + request_id = "hello world" + input_config = {} + errors_config = {} + update_mask = {} + reconciliation_mode = :RECONCILIATION_MODE_UNSPECIFIED + notification_pubsub_topic = "hello world" + + import_products_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :import_products, name + assert_kind_of ::Google::Cloud::Retail::V2::ImportProductsRequest, request + assert_equal "hello world", request["parent"] + assert_equal "hello world", request["request_id"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::ProductInputConfig), request["input_config"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::ImportErrorsConfig), request["errors_config"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::FieldMask), request["update_mask"] + assert_equal :RECONCILIATION_MODE_UNSPECIFIED, request["reconciliation_mode"] + assert_equal "hello world", request["notification_pubsub_topic"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, import_products_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ProductService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.import_products({ parent: parent, request_id: request_id, input_config: input_config, errors_config: errors_config, update_mask: update_mask, reconciliation_mode: reconciliation_mode, notification_pubsub_topic: notification_pubsub_topic }) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use named arguments + c.import_products parent: parent, request_id: request_id, input_config: input_config, errors_config: errors_config, update_mask: update_mask, reconciliation_mode: reconciliation_mode, notification_pubsub_topic: notification_pubsub_topic do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.import_products ::Google::Cloud::Retail::V2::ImportProductsRequest.new(parent: parent, request_id: request_id, input_config: input_config, errors_config: errors_config, update_mask: update_mask, reconciliation_mode: reconciliation_mode, notification_pubsub_topic: notification_pubsub_topic) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.import_products({ parent: parent, request_id: request_id, input_config: input_config, errors_config: errors_config, update_mask: update_mask, reconciliation_mode: reconciliation_mode, notification_pubsub_topic: notification_pubsub_topic }, grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.import_products(::Google::Cloud::Retail::V2::ImportProductsRequest.new(parent: parent, request_id: request_id, input_config: input_config, errors_config: errors_config, update_mask: update_mask, reconciliation_mode: reconciliation_mode, notification_pubsub_topic: notification_pubsub_topic), grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, import_products_client_stub.call_rpc_count + end + end + + def test_set_inventory + # Create GRPC objects. + grpc_response = ::Google::Longrunning::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + inventory = {} + set_mask = {} + set_time = {} + allow_missing = true + + set_inventory_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :set_inventory, name + assert_kind_of ::Google::Cloud::Retail::V2::SetInventoryRequest, request + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::Product), request["inventory"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::FieldMask), request["set_mask"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::Timestamp), request["set_time"] + assert_equal true, request["allow_missing"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, set_inventory_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ProductService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.set_inventory({ inventory: inventory, set_mask: set_mask, set_time: set_time, allow_missing: allow_missing }) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use named arguments + c.set_inventory inventory: inventory, set_mask: set_mask, set_time: set_time, allow_missing: allow_missing do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.set_inventory ::Google::Cloud::Retail::V2::SetInventoryRequest.new(inventory: inventory, set_mask: set_mask, set_time: set_time, allow_missing: allow_missing) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.set_inventory({ inventory: inventory, set_mask: set_mask, set_time: set_time, allow_missing: allow_missing }, grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.set_inventory(::Google::Cloud::Retail::V2::SetInventoryRequest.new(inventory: inventory, set_mask: set_mask, set_time: set_time, allow_missing: allow_missing), grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, set_inventory_client_stub.call_rpc_count + end + end + + def test_add_fulfillment_places + # Create GRPC objects. + grpc_response = ::Google::Longrunning::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + product = "hello world" + type = "hello world" + place_ids = ["hello world"] + add_time = {} + allow_missing = true + + add_fulfillment_places_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :add_fulfillment_places, name + assert_kind_of ::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest, request + assert_equal "hello world", request["product"] + assert_equal "hello world", request["type"] + assert_equal ["hello world"], request["place_ids"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::Timestamp), request["add_time"] + assert_equal true, request["allow_missing"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, add_fulfillment_places_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ProductService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.add_fulfillment_places({ product: product, type: type, place_ids: place_ids, add_time: add_time, allow_missing: allow_missing }) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use named arguments + c.add_fulfillment_places product: product, type: type, place_ids: place_ids, add_time: add_time, allow_missing: allow_missing do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.add_fulfillment_places ::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest.new(product: product, type: type, place_ids: place_ids, add_time: add_time, allow_missing: allow_missing) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.add_fulfillment_places({ product: product, type: type, place_ids: place_ids, add_time: add_time, allow_missing: allow_missing }, grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.add_fulfillment_places(::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest.new(product: product, type: type, place_ids: place_ids, add_time: add_time, allow_missing: allow_missing), grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, add_fulfillment_places_client_stub.call_rpc_count + end + end + + def test_remove_fulfillment_places + # Create GRPC objects. + grpc_response = ::Google::Longrunning::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + product = "hello world" + type = "hello world" + place_ids = ["hello world"] + remove_time = {} + allow_missing = true + + remove_fulfillment_places_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :remove_fulfillment_places, name + assert_kind_of ::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest, request + assert_equal "hello world", request["product"] + assert_equal "hello world", request["type"] + assert_equal ["hello world"], request["place_ids"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::Timestamp), request["remove_time"] + assert_equal true, request["allow_missing"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, remove_fulfillment_places_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ProductService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.remove_fulfillment_places({ product: product, type: type, place_ids: place_ids, remove_time: remove_time, allow_missing: allow_missing }) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use named arguments + c.remove_fulfillment_places product: product, type: type, place_ids: place_ids, remove_time: remove_time, allow_missing: allow_missing do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.remove_fulfillment_places ::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest.new(product: product, type: type, place_ids: place_ids, remove_time: remove_time, allow_missing: allow_missing) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.remove_fulfillment_places({ product: product, type: type, place_ids: place_ids, remove_time: remove_time, allow_missing: allow_missing }, grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.remove_fulfillment_places(::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest.new(product: product, type: type, place_ids: place_ids, remove_time: remove_time, allow_missing: allow_missing), grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, remove_fulfillment_places_client_stub.call_rpc_count + end + end + + def test_add_local_inventories + # Create GRPC objects. + grpc_response = ::Google::Longrunning::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + product = "hello world" + local_inventories = [{}] + add_mask = {} + add_time = {} + allow_missing = true + + add_local_inventories_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :add_local_inventories, name + assert_kind_of ::Google::Cloud::Retail::V2::AddLocalInventoriesRequest, request + assert_equal "hello world", request["product"] + assert_kind_of ::Google::Cloud::Retail::V2::LocalInventory, request["local_inventories"].first + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::FieldMask), request["add_mask"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::Timestamp), request["add_time"] + assert_equal true, request["allow_missing"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, add_local_inventories_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ProductService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.add_local_inventories({ product: product, local_inventories: local_inventories, add_mask: add_mask, add_time: add_time, allow_missing: allow_missing }) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use named arguments + c.add_local_inventories product: product, local_inventories: local_inventories, add_mask: add_mask, add_time: add_time, allow_missing: allow_missing do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.add_local_inventories ::Google::Cloud::Retail::V2::AddLocalInventoriesRequest.new(product: product, local_inventories: local_inventories, add_mask: add_mask, add_time: add_time, allow_missing: allow_missing) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.add_local_inventories({ product: product, local_inventories: local_inventories, add_mask: add_mask, add_time: add_time, allow_missing: allow_missing }, grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.add_local_inventories(::Google::Cloud::Retail::V2::AddLocalInventoriesRequest.new(product: product, local_inventories: local_inventories, add_mask: add_mask, add_time: add_time, allow_missing: allow_missing), grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, add_local_inventories_client_stub.call_rpc_count + end + end + + def test_remove_local_inventories + # Create GRPC objects. + grpc_response = ::Google::Longrunning::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + product = "hello world" + place_ids = ["hello world"] + remove_time = {} + allow_missing = true + + remove_local_inventories_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :remove_local_inventories, name + assert_kind_of ::Google::Cloud::Retail::V2::RemoveLocalInventoriesRequest, request + assert_equal "hello world", request["product"] + assert_equal ["hello world"], request["place_ids"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::Timestamp), request["remove_time"] + assert_equal true, request["allow_missing"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, remove_local_inventories_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ProductService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.remove_local_inventories({ product: product, place_ids: place_ids, remove_time: remove_time, allow_missing: allow_missing }) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use named arguments + c.remove_local_inventories product: product, place_ids: place_ids, remove_time: remove_time, allow_missing: allow_missing do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.remove_local_inventories ::Google::Cloud::Retail::V2::RemoveLocalInventoriesRequest.new(product: product, place_ids: place_ids, remove_time: remove_time, allow_missing: allow_missing) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.remove_local_inventories({ product: product, place_ids: place_ids, remove_time: remove_time, allow_missing: allow_missing }, grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.remove_local_inventories(::Google::Cloud::Retail::V2::RemoveLocalInventoriesRequest.new(product: product, place_ids: place_ids, remove_time: remove_time, allow_missing: allow_missing), grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, remove_local_inventories_client_stub.call_rpc_count + end + end + + def test_configure + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + + client = block_config = config = nil + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Retail::V2::ProductService::Client.new do |config| + config.credentials = grpc_channel + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::Retail::V2::ProductService::Client::Configuration, config + end + + def test_credentials + key = OpenSSL::PKey::RSA.new 2048 + cred_json = { + "private_key" => key.to_pem, + "client_email" => "app@developer.gserviceaccount.com", + "type" => "service_account" + } + key_file = StringIO.new cred_json.to_json + creds = Google::Auth::ServiceAccountCredentials.make_creds({ json_key_io: key_file }) + + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Retail::V2::ProductService::Client.new do |config| + config.credentials = creds + end + assert_kind_of ::Google::Cloud::Retail::V2::ProductService::Client, client + assert_equal creds, client.configure.credentials + end + end + + def test_operations_client + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + + client = nil + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Retail::V2::ProductService::Client.new do |config| + config.credentials = grpc_channel + end + end + + assert_kind_of ::Google::Cloud::Retail::V2::ProductService::Operations, client.operations_client + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/search_service_paths_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/search_service_paths_test.rb new file mode 100644 index 000000000000..666f380e368d --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/search_service_paths_test.rb @@ -0,0 +1,55 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/cloud/retail/v2/search_service" + +class ::Google::Cloud::Retail::V2::SearchService::ClientPathsTest < Minitest::Test + class DummyStub + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_branch_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::Retail::V2::SearchService::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.branch_path project: "value0", location: "value1", catalog: "value2", branch: "value3" + assert_equal "projects/value0/locations/value1/catalogs/value2/branches/value3", path + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/search_service_rest_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/search_service_rest_test.rb new file mode 100644 index 000000000000..a800cefe2ac7 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/search_service_rest_test.rb @@ -0,0 +1,180 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" +require "gapic/rest" +require "google/cloud/retail/v2/search_service_pb" +require "google/cloud/retail/v2/search_service/rest" + + +class ::Google::Cloud::Retail::V2::SearchService::Rest::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_count, :requests + + def initialize response, &block + @response = response + @block = block + @call_count = 0 + @requests = [] + end + + def make_get_request uri:, params: {}, options: {}, method_name: nil + make_http_request :get, uri: uri, body: nil, params: params, options: options, method_name: method_name + end + + def make_delete_request uri:, params: {}, options: {}, method_name: nil + make_http_request :delete, uri: uri, body: nil, params: params, options: options, method_name: method_name + end + + def make_post_request uri:, body: nil, params: {}, options: {}, method_name: nil + make_http_request :post, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_patch_request uri:, body:, params: {}, options: {}, method_name: nil + make_http_request :patch, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_put_request uri:, body:, params: {}, options: {}, method_name: nil + make_http_request :put, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_http_request *args, **kwargs + @call_count += 1 + + @requests << @block&.call(*args, **kwargs) + + @response + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_search + # Create test objects. + client_result = ::Google::Cloud::Retail::V2::SearchResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + placement = "hello world" + branch = "hello world" + query = "hello world" + visitor_id = "hello world" + user_info = {} + page_size = 42 + page_token = "hello world" + offset = 42 + filter = "hello world" + canonical_filter = "hello world" + order_by = "hello world" + facet_specs = [{}] + dynamic_facet_spec = {} + boost_spec = {} + query_expansion_spec = {} + variant_rollup_keys = ["hello world"] + page_categories = ["hello world"] + search_mode = :SEARCH_MODE_UNSPECIFIED + personalization_spec = {} + labels = {} + spell_correction_spec = {} + entity = "hello world" + conversational_search_spec = {} + tile_navigation_spec = {} + language_code = "hello world" + region_code = "hello world" + place_id = "hello world" + user_attributes = {} + + search_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::SearchService::Rest::ServiceStub.stub :transcode_search_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, search_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::SearchService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.search({ placement: placement, branch: branch, query: query, visitor_id: visitor_id, user_info: user_info, page_size: page_size, page_token: page_token, offset: offset, filter: filter, canonical_filter: canonical_filter, order_by: order_by, facet_specs: facet_specs, dynamic_facet_spec: dynamic_facet_spec, boost_spec: boost_spec, query_expansion_spec: query_expansion_spec, variant_rollup_keys: variant_rollup_keys, page_categories: page_categories, search_mode: search_mode, personalization_spec: personalization_spec, labels: labels, spell_correction_spec: spell_correction_spec, entity: entity, conversational_search_spec: conversational_search_spec, tile_navigation_spec: tile_navigation_spec, language_code: language_code, region_code: region_code, place_id: place_id, user_attributes: user_attributes }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.search placement: placement, branch: branch, query: query, visitor_id: visitor_id, user_info: user_info, page_size: page_size, page_token: page_token, offset: offset, filter: filter, canonical_filter: canonical_filter, order_by: order_by, facet_specs: facet_specs, dynamic_facet_spec: dynamic_facet_spec, boost_spec: boost_spec, query_expansion_spec: query_expansion_spec, variant_rollup_keys: variant_rollup_keys, page_categories: page_categories, search_mode: search_mode, personalization_spec: personalization_spec, labels: labels, spell_correction_spec: spell_correction_spec, entity: entity, conversational_search_spec: conversational_search_spec, tile_navigation_spec: tile_navigation_spec, language_code: language_code, region_code: region_code, place_id: place_id, user_attributes: user_attributes do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.search ::Google::Cloud::Retail::V2::SearchRequest.new(placement: placement, branch: branch, query: query, visitor_id: visitor_id, user_info: user_info, page_size: page_size, page_token: page_token, offset: offset, filter: filter, canonical_filter: canonical_filter, order_by: order_by, facet_specs: facet_specs, dynamic_facet_spec: dynamic_facet_spec, boost_spec: boost_spec, query_expansion_spec: query_expansion_spec, variant_rollup_keys: variant_rollup_keys, page_categories: page_categories, search_mode: search_mode, personalization_spec: personalization_spec, labels: labels, spell_correction_spec: spell_correction_spec, entity: entity, conversational_search_spec: conversational_search_spec, tile_navigation_spec: tile_navigation_spec, language_code: language_code, region_code: region_code, place_id: place_id, user_attributes: user_attributes) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.search({ placement: placement, branch: branch, query: query, visitor_id: visitor_id, user_info: user_info, page_size: page_size, page_token: page_token, offset: offset, filter: filter, canonical_filter: canonical_filter, order_by: order_by, facet_specs: facet_specs, dynamic_facet_spec: dynamic_facet_spec, boost_spec: boost_spec, query_expansion_spec: query_expansion_spec, variant_rollup_keys: variant_rollup_keys, page_categories: page_categories, search_mode: search_mode, personalization_spec: personalization_spec, labels: labels, spell_correction_spec: spell_correction_spec, entity: entity, conversational_search_spec: conversational_search_spec, tile_navigation_spec: tile_navigation_spec, language_code: language_code, region_code: region_code, place_id: place_id, user_attributes: user_attributes }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.search(::Google::Cloud::Retail::V2::SearchRequest.new(placement: placement, branch: branch, query: query, visitor_id: visitor_id, user_info: user_info, page_size: page_size, page_token: page_token, offset: offset, filter: filter, canonical_filter: canonical_filter, order_by: order_by, facet_specs: facet_specs, dynamic_facet_spec: dynamic_facet_spec, boost_spec: boost_spec, query_expansion_spec: query_expansion_spec, variant_rollup_keys: variant_rollup_keys, page_categories: page_categories, search_mode: search_mode, personalization_spec: personalization_spec, labels: labels, spell_correction_spec: spell_correction_spec, entity: entity, conversational_search_spec: conversational_search_spec, tile_navigation_spec: tile_navigation_spec, language_code: language_code, region_code: region_code, place_id: place_id, user_attributes: user_attributes), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, search_client_stub.call_count + end + end + end + + def test_configure + credentials_token = :dummy_value + + client = block_config = config = nil + dummy_stub = ClientStub.new nil + Gapic::Rest::ClientStub.stub :new, dummy_stub do + client = ::Google::Cloud::Retail::V2::SearchService::Rest::Client.new do |config| + config.credentials = credentials_token + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::Retail::V2::SearchService::Rest::Client::Configuration, config + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/search_service_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/search_service_test.rb new file mode 100644 index 000000000000..ba77fbd1cd82 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/search_service_test.rb @@ -0,0 +1,222 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/cloud/retail/v2/search_service_pb" +require "google/cloud/retail/v2/search_service" + +class ::Google::Cloud::Retail::V2::SearchService::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_rpc_count, :requests + + def initialize response, operation, &block + @response = response + @operation = operation + @block = block + @call_rpc_count = 0 + @requests = [] + end + + def call_rpc *args, **kwargs + @call_rpc_count += 1 + + @requests << @block&.call(*args, **kwargs) + + catch :response do + yield @response, @operation if block_given? + @response + end + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_search + # Create GRPC objects. + grpc_response = ::Google::Cloud::Retail::V2::SearchResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + placement = "hello world" + branch = "hello world" + query = "hello world" + visitor_id = "hello world" + user_info = {} + page_size = 42 + page_token = "hello world" + offset = 42 + filter = "hello world" + canonical_filter = "hello world" + order_by = "hello world" + facet_specs = [{}] + dynamic_facet_spec = {} + boost_spec = {} + query_expansion_spec = {} + variant_rollup_keys = ["hello world"] + page_categories = ["hello world"] + search_mode = :SEARCH_MODE_UNSPECIFIED + personalization_spec = {} + labels = {} + spell_correction_spec = {} + entity = "hello world" + conversational_search_spec = {} + tile_navigation_spec = {} + language_code = "hello world" + region_code = "hello world" + place_id = "hello world" + user_attributes = {} + + search_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :search, name + assert_kind_of ::Google::Cloud::Retail::V2::SearchRequest, request + assert_equal "hello world", request["placement"] + assert_equal "hello world", request["branch"] + assert_equal "hello world", request["query"] + assert_equal "hello world", request["visitor_id"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::UserInfo), request["user_info"] + assert_equal 42, request["page_size"] + assert_equal "hello world", request["page_token"] + assert_equal 42, request["offset"] + assert_equal "hello world", request["filter"] + assert_equal "hello world", request["canonical_filter"] + assert_equal "hello world", request["order_by"] + assert_kind_of ::Google::Cloud::Retail::V2::SearchRequest::FacetSpec, request["facet_specs"].first + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec), request["dynamic_facet_spec"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::SearchRequest::BoostSpec), request["boost_spec"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec), request["query_expansion_spec"] + assert_equal ["hello world"], request["variant_rollup_keys"] + assert_equal ["hello world"], request["page_categories"] + assert_equal :SEARCH_MODE_UNSPECIFIED, request["search_mode"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec), request["personalization_spec"] + assert_equal({}, request["labels"].to_h) + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec), request["spell_correction_spec"] + assert request.has_spell_correction_spec? + assert_equal "hello world", request["entity"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec), request["conversational_search_spec"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::SearchRequest::TileNavigationSpec), request["tile_navigation_spec"] + assert_equal "hello world", request["language_code"] + assert_equal "hello world", request["region_code"] + assert_equal "hello world", request["place_id"] + assert_equal({}, request["user_attributes"].to_h) + refute_nil options + end + + Gapic::ServiceStub.stub :new, search_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::SearchService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.search({ placement: placement, branch: branch, query: query, visitor_id: visitor_id, user_info: user_info, page_size: page_size, page_token: page_token, offset: offset, filter: filter, canonical_filter: canonical_filter, order_by: order_by, facet_specs: facet_specs, dynamic_facet_spec: dynamic_facet_spec, boost_spec: boost_spec, query_expansion_spec: query_expansion_spec, variant_rollup_keys: variant_rollup_keys, page_categories: page_categories, search_mode: search_mode, personalization_spec: personalization_spec, labels: labels, spell_correction_spec: spell_correction_spec, entity: entity, conversational_search_spec: conversational_search_spec, tile_navigation_spec: tile_navigation_spec, language_code: language_code, region_code: region_code, place_id: place_id, user_attributes: user_attributes }) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.search placement: placement, branch: branch, query: query, visitor_id: visitor_id, user_info: user_info, page_size: page_size, page_token: page_token, offset: offset, filter: filter, canonical_filter: canonical_filter, order_by: order_by, facet_specs: facet_specs, dynamic_facet_spec: dynamic_facet_spec, boost_spec: boost_spec, query_expansion_spec: query_expansion_spec, variant_rollup_keys: variant_rollup_keys, page_categories: page_categories, search_mode: search_mode, personalization_spec: personalization_spec, labels: labels, spell_correction_spec: spell_correction_spec, entity: entity, conversational_search_spec: conversational_search_spec, tile_navigation_spec: tile_navigation_spec, language_code: language_code, region_code: region_code, place_id: place_id, user_attributes: user_attributes do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.search ::Google::Cloud::Retail::V2::SearchRequest.new(placement: placement, branch: branch, query: query, visitor_id: visitor_id, user_info: user_info, page_size: page_size, page_token: page_token, offset: offset, filter: filter, canonical_filter: canonical_filter, order_by: order_by, facet_specs: facet_specs, dynamic_facet_spec: dynamic_facet_spec, boost_spec: boost_spec, query_expansion_spec: query_expansion_spec, variant_rollup_keys: variant_rollup_keys, page_categories: page_categories, search_mode: search_mode, personalization_spec: personalization_spec, labels: labels, spell_correction_spec: spell_correction_spec, entity: entity, conversational_search_spec: conversational_search_spec, tile_navigation_spec: tile_navigation_spec, language_code: language_code, region_code: region_code, place_id: place_id, user_attributes: user_attributes) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.search({ placement: placement, branch: branch, query: query, visitor_id: visitor_id, user_info: user_info, page_size: page_size, page_token: page_token, offset: offset, filter: filter, canonical_filter: canonical_filter, order_by: order_by, facet_specs: facet_specs, dynamic_facet_spec: dynamic_facet_spec, boost_spec: boost_spec, query_expansion_spec: query_expansion_spec, variant_rollup_keys: variant_rollup_keys, page_categories: page_categories, search_mode: search_mode, personalization_spec: personalization_spec, labels: labels, spell_correction_spec: spell_correction_spec, entity: entity, conversational_search_spec: conversational_search_spec, tile_navigation_spec: tile_navigation_spec, language_code: language_code, region_code: region_code, place_id: place_id, user_attributes: user_attributes }, grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.search(::Google::Cloud::Retail::V2::SearchRequest.new(placement: placement, branch: branch, query: query, visitor_id: visitor_id, user_info: user_info, page_size: page_size, page_token: page_token, offset: offset, filter: filter, canonical_filter: canonical_filter, order_by: order_by, facet_specs: facet_specs, dynamic_facet_spec: dynamic_facet_spec, boost_spec: boost_spec, query_expansion_spec: query_expansion_spec, variant_rollup_keys: variant_rollup_keys, page_categories: page_categories, search_mode: search_mode, personalization_spec: personalization_spec, labels: labels, spell_correction_spec: spell_correction_spec, entity: entity, conversational_search_spec: conversational_search_spec, tile_navigation_spec: tile_navigation_spec, language_code: language_code, region_code: region_code, place_id: place_id, user_attributes: user_attributes), grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, search_client_stub.call_rpc_count + end + end + + def test_configure + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + + client = block_config = config = nil + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Retail::V2::SearchService::Client.new do |config| + config.credentials = grpc_channel + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::Retail::V2::SearchService::Client::Configuration, config + end + + def test_credentials + key = OpenSSL::PKey::RSA.new 2048 + cred_json = { + "private_key" => key.to_pem, + "client_email" => "app@developer.gserviceaccount.com", + "type" => "service_account" + } + key_file = StringIO.new cred_json.to_json + creds = Google::Auth::ServiceAccountCredentials.make_creds({ json_key_io: key_file }) + + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Retail::V2::SearchService::Client.new do |config| + config.credentials = creds + end + assert_kind_of ::Google::Cloud::Retail::V2::SearchService::Client, client + assert_equal creds, client.configure.credentials + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/serving_config_service_paths_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/serving_config_service_paths_test.rb new file mode 100644 index 000000000000..68252813b8a3 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/serving_config_service_paths_test.rb @@ -0,0 +1,67 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/cloud/retail/v2/serving_config_service" + +class ::Google::Cloud::Retail::V2::ServingConfigService::ClientPathsTest < Minitest::Test + class DummyStub + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_catalog_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::Retail::V2::ServingConfigService::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.catalog_path project: "value0", location: "value1", catalog: "value2" + assert_equal "projects/value0/locations/value1/catalogs/value2", path + end + end + + def test_serving_config_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::Retail::V2::ServingConfigService::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.serving_config_path project: "value0", location: "value1", catalog: "value2", serving_config: "value3" + assert_equal "projects/value0/locations/value1/catalogs/value2/servingConfigs/value3", path + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/serving_config_service_rest_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/serving_config_service_rest_test.rb new file mode 100644 index 000000000000..448a287af110 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/serving_config_service_rest_test.rb @@ -0,0 +1,484 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" +require "gapic/rest" +require "google/cloud/retail/v2/serving_config_service_pb" +require "google/cloud/retail/v2/serving_config_service/rest" + + +class ::Google::Cloud::Retail::V2::ServingConfigService::Rest::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_count, :requests + + def initialize response, &block + @response = response + @block = block + @call_count = 0 + @requests = [] + end + + def make_get_request uri:, params: {}, options: {}, method_name: nil + make_http_request :get, uri: uri, body: nil, params: params, options: options, method_name: method_name + end + + def make_delete_request uri:, params: {}, options: {}, method_name: nil + make_http_request :delete, uri: uri, body: nil, params: params, options: options, method_name: method_name + end + + def make_post_request uri:, body: nil, params: {}, options: {}, method_name: nil + make_http_request :post, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_patch_request uri:, body:, params: {}, options: {}, method_name: nil + make_http_request :patch, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_put_request uri:, body:, params: {}, options: {}, method_name: nil + make_http_request :put, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_http_request *args, **kwargs + @call_count += 1 + + @requests << @block&.call(*args, **kwargs) + + @response + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_create_serving_config + # Create test objects. + client_result = ::Google::Cloud::Retail::V2::ServingConfig.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + serving_config = {} + serving_config_id = "hello world" + + create_serving_config_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::ServingConfigService::Rest::ServiceStub.stub :transcode_create_serving_config_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, create_serving_config_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ServingConfigService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.create_serving_config({ parent: parent, serving_config: serving_config, serving_config_id: serving_config_id }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.create_serving_config parent: parent, serving_config: serving_config, serving_config_id: serving_config_id do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.create_serving_config ::Google::Cloud::Retail::V2::CreateServingConfigRequest.new(parent: parent, serving_config: serving_config, serving_config_id: serving_config_id) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.create_serving_config({ parent: parent, serving_config: serving_config, serving_config_id: serving_config_id }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.create_serving_config(::Google::Cloud::Retail::V2::CreateServingConfigRequest.new(parent: parent, serving_config: serving_config, serving_config_id: serving_config_id), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, create_serving_config_client_stub.call_count + end + end + end + + def test_delete_serving_config + # Create test objects. + client_result = ::Google::Protobuf::Empty.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + delete_serving_config_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::ServingConfigService::Rest::ServiceStub.stub :transcode_delete_serving_config_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, delete_serving_config_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ServingConfigService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.delete_serving_config({ name: name }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.delete_serving_config name: name do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.delete_serving_config ::Google::Cloud::Retail::V2::DeleteServingConfigRequest.new(name: name) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.delete_serving_config({ name: name }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.delete_serving_config(::Google::Cloud::Retail::V2::DeleteServingConfigRequest.new(name: name), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, delete_serving_config_client_stub.call_count + end + end + end + + def test_update_serving_config + # Create test objects. + client_result = ::Google::Cloud::Retail::V2::ServingConfig.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + serving_config = {} + update_mask = {} + + update_serving_config_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::ServingConfigService::Rest::ServiceStub.stub :transcode_update_serving_config_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, update_serving_config_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ServingConfigService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.update_serving_config({ serving_config: serving_config, update_mask: update_mask }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.update_serving_config serving_config: serving_config, update_mask: update_mask do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.update_serving_config ::Google::Cloud::Retail::V2::UpdateServingConfigRequest.new(serving_config: serving_config, update_mask: update_mask) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.update_serving_config({ serving_config: serving_config, update_mask: update_mask }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.update_serving_config(::Google::Cloud::Retail::V2::UpdateServingConfigRequest.new(serving_config: serving_config, update_mask: update_mask), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, update_serving_config_client_stub.call_count + end + end + end + + def test_get_serving_config + # Create test objects. + client_result = ::Google::Cloud::Retail::V2::ServingConfig.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_serving_config_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::ServingConfigService::Rest::ServiceStub.stub :transcode_get_serving_config_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, get_serving_config_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ServingConfigService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.get_serving_config({ name: name }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.get_serving_config name: name do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.get_serving_config ::Google::Cloud::Retail::V2::GetServingConfigRequest.new(name: name) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.get_serving_config({ name: name }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.get_serving_config(::Google::Cloud::Retail::V2::GetServingConfigRequest.new(name: name), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, get_serving_config_client_stub.call_count + end + end + end + + def test_list_serving_configs + # Create test objects. + client_result = ::Google::Cloud::Retail::V2::ListServingConfigsResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + page_size = 42 + page_token = "hello world" + + list_serving_configs_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::ServingConfigService::Rest::ServiceStub.stub :transcode_list_serving_configs_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, list_serving_configs_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ServingConfigService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.list_serving_configs({ parent: parent, page_size: page_size, page_token: page_token }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.list_serving_configs parent: parent, page_size: page_size, page_token: page_token do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.list_serving_configs ::Google::Cloud::Retail::V2::ListServingConfigsRequest.new(parent: parent, page_size: page_size, page_token: page_token) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.list_serving_configs({ parent: parent, page_size: page_size, page_token: page_token }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.list_serving_configs(::Google::Cloud::Retail::V2::ListServingConfigsRequest.new(parent: parent, page_size: page_size, page_token: page_token), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, list_serving_configs_client_stub.call_count + end + end + end + + def test_add_control + # Create test objects. + client_result = ::Google::Cloud::Retail::V2::ServingConfig.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + serving_config = "hello world" + control_id = "hello world" + + add_control_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::ServingConfigService::Rest::ServiceStub.stub :transcode_add_control_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, add_control_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ServingConfigService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.add_control({ serving_config: serving_config, control_id: control_id }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.add_control serving_config: serving_config, control_id: control_id do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.add_control ::Google::Cloud::Retail::V2::AddControlRequest.new(serving_config: serving_config, control_id: control_id) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.add_control({ serving_config: serving_config, control_id: control_id }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.add_control(::Google::Cloud::Retail::V2::AddControlRequest.new(serving_config: serving_config, control_id: control_id), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, add_control_client_stub.call_count + end + end + end + + def test_remove_control + # Create test objects. + client_result = ::Google::Cloud::Retail::V2::ServingConfig.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + serving_config = "hello world" + control_id = "hello world" + + remove_control_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::ServingConfigService::Rest::ServiceStub.stub :transcode_remove_control_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, remove_control_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ServingConfigService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.remove_control({ serving_config: serving_config, control_id: control_id }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.remove_control serving_config: serving_config, control_id: control_id do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.remove_control ::Google::Cloud::Retail::V2::RemoveControlRequest.new(serving_config: serving_config, control_id: control_id) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.remove_control({ serving_config: serving_config, control_id: control_id }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.remove_control(::Google::Cloud::Retail::V2::RemoveControlRequest.new(serving_config: serving_config, control_id: control_id), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, remove_control_client_stub.call_count + end + end + end + + def test_configure + credentials_token = :dummy_value + + client = block_config = config = nil + dummy_stub = ClientStub.new nil + Gapic::Rest::ClientStub.stub :new, dummy_stub do + client = ::Google::Cloud::Retail::V2::ServingConfigService::Rest::Client.new do |config| + config.credentials = credentials_token + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::Retail::V2::ServingConfigService::Rest::Client::Configuration, config + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/serving_config_service_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/serving_config_service_test.rb new file mode 100644 index 000000000000..6715965a490e --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/serving_config_service_test.rb @@ -0,0 +1,529 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/cloud/retail/v2/serving_config_service_pb" +require "google/cloud/retail/v2/serving_config_service" + +class ::Google::Cloud::Retail::V2::ServingConfigService::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_rpc_count, :requests + + def initialize response, operation, &block + @response = response + @operation = operation + @block = block + @call_rpc_count = 0 + @requests = [] + end + + def call_rpc *args, **kwargs + @call_rpc_count += 1 + + @requests << @block&.call(*args, **kwargs) + + catch :response do + yield @response, @operation if block_given? + @response + end + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_create_serving_config + # Create GRPC objects. + grpc_response = ::Google::Cloud::Retail::V2::ServingConfig.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + serving_config = {} + serving_config_id = "hello world" + + create_serving_config_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :create_serving_config, name + assert_kind_of ::Google::Cloud::Retail::V2::CreateServingConfigRequest, request + assert_equal "hello world", request["parent"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::ServingConfig), request["serving_config"] + assert_equal "hello world", request["serving_config_id"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, create_serving_config_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ServingConfigService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.create_serving_config({ parent: parent, serving_config: serving_config, serving_config_id: serving_config_id }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.create_serving_config parent: parent, serving_config: serving_config, serving_config_id: serving_config_id do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.create_serving_config ::Google::Cloud::Retail::V2::CreateServingConfigRequest.new(parent: parent, serving_config: serving_config, serving_config_id: serving_config_id) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.create_serving_config({ parent: parent, serving_config: serving_config, serving_config_id: serving_config_id }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.create_serving_config(::Google::Cloud::Retail::V2::CreateServingConfigRequest.new(parent: parent, serving_config: serving_config, serving_config_id: serving_config_id), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, create_serving_config_client_stub.call_rpc_count + end + end + + def test_delete_serving_config + # Create GRPC objects. + grpc_response = ::Google::Protobuf::Empty.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + delete_serving_config_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :delete_serving_config, name + assert_kind_of ::Google::Cloud::Retail::V2::DeleteServingConfigRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, delete_serving_config_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ServingConfigService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.delete_serving_config({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.delete_serving_config name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.delete_serving_config ::Google::Cloud::Retail::V2::DeleteServingConfigRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.delete_serving_config({ name: name }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.delete_serving_config(::Google::Cloud::Retail::V2::DeleteServingConfigRequest.new(name: name), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, delete_serving_config_client_stub.call_rpc_count + end + end + + def test_update_serving_config + # Create GRPC objects. + grpc_response = ::Google::Cloud::Retail::V2::ServingConfig.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + serving_config = {} + update_mask = {} + + update_serving_config_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :update_serving_config, name + assert_kind_of ::Google::Cloud::Retail::V2::UpdateServingConfigRequest, request + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::ServingConfig), request["serving_config"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::FieldMask), request["update_mask"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, update_serving_config_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ServingConfigService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.update_serving_config({ serving_config: serving_config, update_mask: update_mask }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.update_serving_config serving_config: serving_config, update_mask: update_mask do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.update_serving_config ::Google::Cloud::Retail::V2::UpdateServingConfigRequest.new(serving_config: serving_config, update_mask: update_mask) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.update_serving_config({ serving_config: serving_config, update_mask: update_mask }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.update_serving_config(::Google::Cloud::Retail::V2::UpdateServingConfigRequest.new(serving_config: serving_config, update_mask: update_mask), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, update_serving_config_client_stub.call_rpc_count + end + end + + def test_get_serving_config + # Create GRPC objects. + grpc_response = ::Google::Cloud::Retail::V2::ServingConfig.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_serving_config_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :get_serving_config, name + assert_kind_of ::Google::Cloud::Retail::V2::GetServingConfigRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, get_serving_config_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ServingConfigService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.get_serving_config({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.get_serving_config name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.get_serving_config ::Google::Cloud::Retail::V2::GetServingConfigRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.get_serving_config({ name: name }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.get_serving_config(::Google::Cloud::Retail::V2::GetServingConfigRequest.new(name: name), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, get_serving_config_client_stub.call_rpc_count + end + end + + def test_list_serving_configs + # Create GRPC objects. + grpc_response = ::Google::Cloud::Retail::V2::ListServingConfigsResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + page_size = 42 + page_token = "hello world" + + list_serving_configs_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :list_serving_configs, name + assert_kind_of ::Google::Cloud::Retail::V2::ListServingConfigsRequest, request + assert_equal "hello world", request["parent"] + assert_equal 42, request["page_size"] + assert_equal "hello world", request["page_token"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, list_serving_configs_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ServingConfigService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.list_serving_configs({ parent: parent, page_size: page_size, page_token: page_token }) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.list_serving_configs parent: parent, page_size: page_size, page_token: page_token do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.list_serving_configs ::Google::Cloud::Retail::V2::ListServingConfigsRequest.new(parent: parent, page_size: page_size, page_token: page_token) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.list_serving_configs({ parent: parent, page_size: page_size, page_token: page_token }, grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.list_serving_configs(::Google::Cloud::Retail::V2::ListServingConfigsRequest.new(parent: parent, page_size: page_size, page_token: page_token), grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, list_serving_configs_client_stub.call_rpc_count + end + end + + def test_add_control + # Create GRPC objects. + grpc_response = ::Google::Cloud::Retail::V2::ServingConfig.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + serving_config = "hello world" + control_id = "hello world" + + add_control_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :add_control, name + assert_kind_of ::Google::Cloud::Retail::V2::AddControlRequest, request + assert_equal "hello world", request["serving_config"] + assert_equal "hello world", request["control_id"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, add_control_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ServingConfigService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.add_control({ serving_config: serving_config, control_id: control_id }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.add_control serving_config: serving_config, control_id: control_id do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.add_control ::Google::Cloud::Retail::V2::AddControlRequest.new(serving_config: serving_config, control_id: control_id) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.add_control({ serving_config: serving_config, control_id: control_id }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.add_control(::Google::Cloud::Retail::V2::AddControlRequest.new(serving_config: serving_config, control_id: control_id), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, add_control_client_stub.call_rpc_count + end + end + + def test_remove_control + # Create GRPC objects. + grpc_response = ::Google::Cloud::Retail::V2::ServingConfig.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + serving_config = "hello world" + control_id = "hello world" + + remove_control_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :remove_control, name + assert_kind_of ::Google::Cloud::Retail::V2::RemoveControlRequest, request + assert_equal "hello world", request["serving_config"] + assert_equal "hello world", request["control_id"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, remove_control_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::ServingConfigService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.remove_control({ serving_config: serving_config, control_id: control_id }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.remove_control serving_config: serving_config, control_id: control_id do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.remove_control ::Google::Cloud::Retail::V2::RemoveControlRequest.new(serving_config: serving_config, control_id: control_id) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.remove_control({ serving_config: serving_config, control_id: control_id }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.remove_control(::Google::Cloud::Retail::V2::RemoveControlRequest.new(serving_config: serving_config, control_id: control_id), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, remove_control_client_stub.call_rpc_count + end + end + + def test_configure + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + + client = block_config = config = nil + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Retail::V2::ServingConfigService::Client.new do |config| + config.credentials = grpc_channel + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::Retail::V2::ServingConfigService::Client::Configuration, config + end + + def test_credentials + key = OpenSSL::PKey::RSA.new 2048 + cred_json = { + "private_key" => key.to_pem, + "client_email" => "app@developer.gserviceaccount.com", + "type" => "service_account" + } + key_file = StringIO.new cred_json.to_json + creds = Google::Auth::ServiceAccountCredentials.make_creds({ json_key_io: key_file }) + + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Retail::V2::ServingConfigService::Client.new do |config| + config.credentials = creds + end + assert_kind_of ::Google::Cloud::Retail::V2::ServingConfigService::Client, client + assert_equal creds, client.configure.credentials + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/user_event_service_operations_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/user_event_service_operations_test.rb new file mode 100644 index 000000000000..a0bcbc887f9f --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/user_event_service_operations_test.rb @@ -0,0 +1,400 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/cloud/retail/v2/user_event_service_pb" +require "google/cloud/retail/v2/user_event_service_services_pb" +require "google/cloud/retail/v2/user_event_service" + +class ::Google::Cloud::Retail::V2::UserEventService::OperationsTest < Minitest::Test + class ClientStub + attr_accessor :call_rpc_count, :requests + + def initialize response, operation, &block + @response = response + @operation = operation + @block = block + @call_rpc_count = 0 + @requests = [] + end + + def call_rpc *args, **kwargs + @call_rpc_count += 1 + + @requests << @block&.call(*args, **kwargs) + + catch :response do + yield @response, @operation if block_given? + @response + end + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_list_operations + # Create GRPC objects. + grpc_response = ::Google::Longrunning::ListOperationsResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + filter = "hello world" + page_size = 42 + page_token = "hello world" + return_partial_success = true + + list_operations_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :list_operations, name + assert_kind_of ::Google::Longrunning::ListOperationsRequest, request + assert_equal "hello world", request["name"] + assert_equal "hello world", request["filter"] + assert_equal 42, request["page_size"] + assert_equal "hello world", request["page_token"] + assert_equal true, request["return_partial_success"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, list_operations_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::UserEventService::Operations.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.list_operations({ name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success }) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.list_operations name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.list_operations ::Google::Longrunning::ListOperationsRequest.new(name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.list_operations({ name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success }, grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.list_operations(::Google::Longrunning::ListOperationsRequest.new(name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success), grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, list_operations_client_stub.call_rpc_count + end + end + + def test_get_operation + # Create GRPC objects. + grpc_response = ::Google::Longrunning::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :get_operation, name + assert_kind_of ::Google::Longrunning::GetOperationRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, get_operation_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::UserEventService::Operations.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.get_operation({ name: name }) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use named arguments + c.get_operation name: name do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.get_operation ::Google::Longrunning::GetOperationRequest.new(name: name) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.get_operation({ name: name }, grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.get_operation(::Google::Longrunning::GetOperationRequest.new(name: name), grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, get_operation_client_stub.call_rpc_count + end + end + + def test_delete_operation + # Create GRPC objects. + grpc_response = ::Google::Protobuf::Empty.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + delete_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :delete_operation, name + assert_kind_of ::Google::Longrunning::DeleteOperationRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, delete_operation_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::UserEventService::Operations.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.delete_operation({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.delete_operation name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.delete_operation ::Google::Longrunning::DeleteOperationRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.delete_operation({ name: name }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.delete_operation(::Google::Longrunning::DeleteOperationRequest.new(name: name), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, delete_operation_client_stub.call_rpc_count + end + end + + def test_cancel_operation + # Create GRPC objects. + grpc_response = ::Google::Protobuf::Empty.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + cancel_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :cancel_operation, name + assert_kind_of ::Google::Longrunning::CancelOperationRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, cancel_operation_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::UserEventService::Operations.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.cancel_operation({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.cancel_operation name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.cancel_operation ::Google::Longrunning::CancelOperationRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.cancel_operation({ name: name }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.cancel_operation(::Google::Longrunning::CancelOperationRequest.new(name: name), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, cancel_operation_client_stub.call_rpc_count + end + end + + def test_wait_operation + # Create GRPC objects. + grpc_response = ::Google::Longrunning::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + timeout = {} + + wait_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :wait_operation, name + assert_kind_of ::Google::Longrunning::WaitOperationRequest, request + assert_equal "hello world", request["name"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::Duration), request["timeout"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, wait_operation_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::UserEventService::Operations.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.wait_operation({ name: name, timeout: timeout }) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use named arguments + c.wait_operation name: name, timeout: timeout do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.wait_operation ::Google::Longrunning::WaitOperationRequest.new(name: name, timeout: timeout) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.wait_operation({ name: name, timeout: timeout }, grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.wait_operation(::Google::Longrunning::WaitOperationRequest.new(name: name, timeout: timeout), grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, wait_operation_client_stub.call_rpc_count + end + end + + def test_configure + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + + client = block_config = config = nil + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Retail::V2::UserEventService::Operations.new do |config| + config.credentials = grpc_channel + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::Retail::V2::UserEventService::Operations::Configuration, config + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/user_event_service_paths_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/user_event_service_paths_test.rb new file mode 100644 index 000000000000..359bdf51e611 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/user_event_service_paths_test.rb @@ -0,0 +1,67 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/cloud/retail/v2/user_event_service" + +class ::Google::Cloud::Retail::V2::UserEventService::ClientPathsTest < Minitest::Test + class DummyStub + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_catalog_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::Retail::V2::UserEventService::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.catalog_path project: "value0", location: "value1", catalog: "value2" + assert_equal "projects/value0/locations/value1/catalogs/value2", path + end + end + + def test_product_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::Retail::V2::UserEventService::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.product_path project: "value0", location: "value1", catalog: "value2", branch: "value3", product: "value4" + assert_equal "projects/value0/locations/value1/catalogs/value2/branches/value3/products/value4", path + end + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/user_event_service_rest_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/user_event_service_rest_test.rb new file mode 100644 index 000000000000..91464499cee3 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/user_event_service_rest_test.rb @@ -0,0 +1,381 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" +require "gapic/rest" +require "google/cloud/retail/v2/user_event_service_pb" +require "google/cloud/retail/v2/user_event_service/rest" + + +class ::Google::Cloud::Retail::V2::UserEventService::Rest::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_count, :requests + + def initialize response, &block + @response = response + @block = block + @call_count = 0 + @requests = [] + end + + def make_get_request uri:, params: {}, options: {}, method_name: nil + make_http_request :get, uri: uri, body: nil, params: params, options: options, method_name: method_name + end + + def make_delete_request uri:, params: {}, options: {}, method_name: nil + make_http_request :delete, uri: uri, body: nil, params: params, options: options, method_name: method_name + end + + def make_post_request uri:, body: nil, params: {}, options: {}, method_name: nil + make_http_request :post, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_patch_request uri:, body:, params: {}, options: {}, method_name: nil + make_http_request :patch, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_put_request uri:, body:, params: {}, options: {}, method_name: nil + make_http_request :put, uri: uri, body: body, params: params, options: options, method_name: method_name + end + + def make_http_request *args, **kwargs + @call_count += 1 + + @requests << @block&.call(*args, **kwargs) + + @response + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_write_user_event + # Create test objects. + client_result = ::Google::Cloud::Retail::V2::UserEvent.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + user_event = {} + write_async = true + + write_user_event_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::UserEventService::Rest::ServiceStub.stub :transcode_write_user_event_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, write_user_event_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::UserEventService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.write_user_event({ parent: parent, user_event: user_event, write_async: write_async }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.write_user_event parent: parent, user_event: user_event, write_async: write_async do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.write_user_event ::Google::Cloud::Retail::V2::WriteUserEventRequest.new(parent: parent, user_event: user_event, write_async: write_async) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.write_user_event({ parent: parent, user_event: user_event, write_async: write_async }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.write_user_event(::Google::Cloud::Retail::V2::WriteUserEventRequest.new(parent: parent, user_event: user_event, write_async: write_async), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, write_user_event_client_stub.call_count + end + end + end + + def test_collect_user_event + # Create test objects. + client_result = ::Google::Api::HttpBody.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + prebuilt_rule = "hello world" + parent = "hello world" + user_event = "hello world" + uri = "hello world" + ets = 42 + raw_json = "hello world" + + collect_user_event_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::UserEventService::Rest::ServiceStub.stub :transcode_collect_user_event_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, collect_user_event_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::UserEventService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.collect_user_event({ prebuilt_rule: prebuilt_rule, parent: parent, user_event: user_event, uri: uri, ets: ets, raw_json: raw_json }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.collect_user_event prebuilt_rule: prebuilt_rule, parent: parent, user_event: user_event, uri: uri, ets: ets, raw_json: raw_json do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.collect_user_event ::Google::Cloud::Retail::V2::CollectUserEventRequest.new(prebuilt_rule: prebuilt_rule, parent: parent, user_event: user_event, uri: uri, ets: ets, raw_json: raw_json) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.collect_user_event({ prebuilt_rule: prebuilt_rule, parent: parent, user_event: user_event, uri: uri, ets: ets, raw_json: raw_json }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.collect_user_event(::Google::Cloud::Retail::V2::CollectUserEventRequest.new(prebuilt_rule: prebuilt_rule, parent: parent, user_event: user_event, uri: uri, ets: ets, raw_json: raw_json), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, collect_user_event_client_stub.call_count + end + end + end + + def test_purge_user_events + # Create test objects. + client_result = ::Google::Longrunning::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + filter = "hello world" + force = true + + purge_user_events_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::UserEventService::Rest::ServiceStub.stub :transcode_purge_user_events_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, purge_user_events_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::UserEventService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.purge_user_events({ parent: parent, filter: filter, force: force }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.purge_user_events parent: parent, filter: filter, force: force do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.purge_user_events ::Google::Cloud::Retail::V2::PurgeUserEventsRequest.new(parent: parent, filter: filter, force: force) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.purge_user_events({ parent: parent, filter: filter, force: force }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.purge_user_events(::Google::Cloud::Retail::V2::PurgeUserEventsRequest.new(parent: parent, filter: filter, force: force), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, purge_user_events_client_stub.call_count + end + end + end + + def test_import_user_events + # Create test objects. + client_result = ::Google::Longrunning::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + input_config = {} + errors_config = {} + + import_user_events_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::UserEventService::Rest::ServiceStub.stub :transcode_import_user_events_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, import_user_events_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::UserEventService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.import_user_events({ parent: parent, input_config: input_config, errors_config: errors_config }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.import_user_events parent: parent, input_config: input_config, errors_config: errors_config do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.import_user_events ::Google::Cloud::Retail::V2::ImportUserEventsRequest.new(parent: parent, input_config: input_config, errors_config: errors_config) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.import_user_events({ parent: parent, input_config: input_config, errors_config: errors_config }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.import_user_events(::Google::Cloud::Retail::V2::ImportUserEventsRequest.new(parent: parent, input_config: input_config, errors_config: errors_config), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, import_user_events_client_stub.call_count + end + end + end + + def test_rejoin_user_events + # Create test objects. + client_result = ::Google::Longrunning::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + user_event_rejoin_scope = :USER_EVENT_REJOIN_SCOPE_UNSPECIFIED + + rejoin_user_events_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Retail::V2::UserEventService::Rest::ServiceStub.stub :transcode_rejoin_user_events_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, rejoin_user_events_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::UserEventService::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + c.rejoin_user_events({ parent: parent, user_event_rejoin_scope: user_event_rejoin_scope }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + c.rejoin_user_events parent: parent, user_event_rejoin_scope: user_event_rejoin_scope do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + c.rejoin_user_events ::Google::Cloud::Retail::V2::RejoinUserEventsRequest.new(parent: parent, user_event_rejoin_scope: user_event_rejoin_scope) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + c.rejoin_user_events({ parent: parent, user_event_rejoin_scope: user_event_rejoin_scope }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + c.rejoin_user_events(::Google::Cloud::Retail::V2::RejoinUserEventsRequest.new(parent: parent, user_event_rejoin_scope: user_event_rejoin_scope), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, rejoin_user_events_client_stub.call_count + end + end + end + + def test_configure + credentials_token = :dummy_value + + client = block_config = config = nil + dummy_stub = ClientStub.new nil + Gapic::Rest::ClientStub.stub :new, dummy_stub do + client = ::Google::Cloud::Retail::V2::UserEventService::Rest::Client.new do |config| + config.credentials = credentials_token + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::Retail::V2::UserEventService::Rest::Client::Configuration, config + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/user_event_service_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/user_event_service_test.rb new file mode 100644 index 000000000000..9b8c7aae2a75 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/user_event_service_test.rb @@ -0,0 +1,448 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +require "helper" + +require "gapic/grpc/service_stub" + +require "google/cloud/retail/v2/user_event_service_pb" +require "google/cloud/retail/v2/user_event_service" + +class ::Google::Cloud::Retail::V2::UserEventService::ClientTest < Minitest::Test + class ClientStub + attr_accessor :call_rpc_count, :requests + + def initialize response, operation, &block + @response = response + @operation = operation + @block = block + @call_rpc_count = 0 + @requests = [] + end + + def call_rpc *args, **kwargs + @call_rpc_count += 1 + + @requests << @block&.call(*args, **kwargs) + + catch :response do + yield @response, @operation if block_given? + @response + end + end + + def endpoint + "endpoint.example.com" + end + + def universe_domain + "example.com" + end + + def stub_logger + nil + end + + def logger + nil + end + end + + def test_write_user_event + # Create GRPC objects. + grpc_response = ::Google::Cloud::Retail::V2::UserEvent.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + user_event = {} + write_async = true + + write_user_event_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :write_user_event, name + assert_kind_of ::Google::Cloud::Retail::V2::WriteUserEventRequest, request + assert_equal "hello world", request["parent"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::UserEvent), request["user_event"] + assert_equal true, request["write_async"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, write_user_event_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::UserEventService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.write_user_event({ parent: parent, user_event: user_event, write_async: write_async }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.write_user_event parent: parent, user_event: user_event, write_async: write_async do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.write_user_event ::Google::Cloud::Retail::V2::WriteUserEventRequest.new(parent: parent, user_event: user_event, write_async: write_async) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.write_user_event({ parent: parent, user_event: user_event, write_async: write_async }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.write_user_event(::Google::Cloud::Retail::V2::WriteUserEventRequest.new(parent: parent, user_event: user_event, write_async: write_async), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, write_user_event_client_stub.call_rpc_count + end + end + + def test_collect_user_event + # Create GRPC objects. + grpc_response = ::Google::Api::HttpBody.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + prebuilt_rule = "hello world" + parent = "hello world" + user_event = "hello world" + uri = "hello world" + ets = 42 + raw_json = "hello world" + + collect_user_event_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :collect_user_event, name + assert_kind_of ::Google::Cloud::Retail::V2::CollectUserEventRequest, request + assert_equal "hello world", request["prebuilt_rule"] + assert_equal :prebuilt_rule, request.conversion_rule + assert_equal "hello world", request["parent"] + assert_equal "hello world", request["user_event"] + assert_equal "hello world", request["uri"] + assert_equal 42, request["ets"] + assert_equal "hello world", request["raw_json"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, collect_user_event_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::UserEventService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.collect_user_event({ prebuilt_rule: prebuilt_rule, parent: parent, user_event: user_event, uri: uri, ets: ets, raw_json: raw_json }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + c.collect_user_event prebuilt_rule: prebuilt_rule, parent: parent, user_event: user_event, uri: uri, ets: ets, raw_json: raw_json do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.collect_user_event ::Google::Cloud::Retail::V2::CollectUserEventRequest.new(prebuilt_rule: prebuilt_rule, parent: parent, user_event: user_event, uri: uri, ets: ets, raw_json: raw_json) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.collect_user_event({ prebuilt_rule: prebuilt_rule, parent: parent, user_event: user_event, uri: uri, ets: ets, raw_json: raw_json }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.collect_user_event(::Google::Cloud::Retail::V2::CollectUserEventRequest.new(prebuilt_rule: prebuilt_rule, parent: parent, user_event: user_event, uri: uri, ets: ets, raw_json: raw_json), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, collect_user_event_client_stub.call_rpc_count + end + end + + def test_purge_user_events + # Create GRPC objects. + grpc_response = ::Google::Longrunning::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + filter = "hello world" + force = true + + purge_user_events_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :purge_user_events, name + assert_kind_of ::Google::Cloud::Retail::V2::PurgeUserEventsRequest, request + assert_equal "hello world", request["parent"] + assert_equal "hello world", request["filter"] + assert_equal true, request["force"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, purge_user_events_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::UserEventService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.purge_user_events({ parent: parent, filter: filter, force: force }) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use named arguments + c.purge_user_events parent: parent, filter: filter, force: force do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.purge_user_events ::Google::Cloud::Retail::V2::PurgeUserEventsRequest.new(parent: parent, filter: filter, force: force) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.purge_user_events({ parent: parent, filter: filter, force: force }, grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.purge_user_events(::Google::Cloud::Retail::V2::PurgeUserEventsRequest.new(parent: parent, filter: filter, force: force), grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, purge_user_events_client_stub.call_rpc_count + end + end + + def test_import_user_events + # Create GRPC objects. + grpc_response = ::Google::Longrunning::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + input_config = {} + errors_config = {} + + import_user_events_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :import_user_events, name + assert_kind_of ::Google::Cloud::Retail::V2::ImportUserEventsRequest, request + assert_equal "hello world", request["parent"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::UserEventInputConfig), request["input_config"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::ImportErrorsConfig), request["errors_config"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, import_user_events_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::UserEventService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.import_user_events({ parent: parent, input_config: input_config, errors_config: errors_config }) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use named arguments + c.import_user_events parent: parent, input_config: input_config, errors_config: errors_config do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.import_user_events ::Google::Cloud::Retail::V2::ImportUserEventsRequest.new(parent: parent, input_config: input_config, errors_config: errors_config) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.import_user_events({ parent: parent, input_config: input_config, errors_config: errors_config }, grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.import_user_events(::Google::Cloud::Retail::V2::ImportUserEventsRequest.new(parent: parent, input_config: input_config, errors_config: errors_config), grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, import_user_events_client_stub.call_rpc_count + end + end + + def test_rejoin_user_events + # Create GRPC objects. + grpc_response = ::Google::Longrunning::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + user_event_rejoin_scope = :USER_EVENT_REJOIN_SCOPE_UNSPECIFIED + + rejoin_user_events_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :rejoin_user_events, name + assert_kind_of ::Google::Cloud::Retail::V2::RejoinUserEventsRequest, request + assert_equal "hello world", request["parent"] + assert_equal :USER_EVENT_REJOIN_SCOPE_UNSPECIFIED, request["user_event_rejoin_scope"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, rejoin_user_events_client_stub do + # Create client + c = ::Google::Cloud::Retail::V2::UserEventService::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + c.rejoin_user_events({ parent: parent, user_event_rejoin_scope: user_event_rejoin_scope }) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use named arguments + c.rejoin_user_events parent: parent, user_event_rejoin_scope: user_event_rejoin_scope do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object + c.rejoin_user_events ::Google::Cloud::Retail::V2::RejoinUserEventsRequest.new(parent: parent, user_event_rejoin_scope: user_event_rejoin_scope) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use hash object with options + c.rejoin_user_events({ parent: parent, user_event_rejoin_scope: user_event_rejoin_scope }, grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + c.rejoin_user_events(::Google::Cloud::Retail::V2::RejoinUserEventsRequest.new(parent: parent, user_event_rejoin_scope: user_event_rejoin_scope), grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, rejoin_user_events_client_stub.call_rpc_count + end + end + + def test_configure + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + + client = block_config = config = nil + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Retail::V2::UserEventService::Client.new do |config| + config.credentials = grpc_channel + end + end + + config = client.configure do |c| + block_config = c + end + + assert_same block_config, config + assert_kind_of ::Google::Cloud::Retail::V2::UserEventService::Client::Configuration, config + end + + def test_credentials + key = OpenSSL::PKey::RSA.new 2048 + cred_json = { + "private_key" => key.to_pem, + "client_email" => "app@developer.gserviceaccount.com", + "type" => "service_account" + } + key_file = StringIO.new cred_json.to_json + creds = Google::Auth::ServiceAccountCredentials.make_creds({ json_key_io: key_file }) + + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Retail::V2::UserEventService::Client.new do |config| + config.credentials = creds + end + assert_kind_of ::Google::Cloud::Retail::V2::UserEventService::Client, client + assert_equal creds, client.configure.credentials + end + end + + def test_operations_client + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + + client = nil + dummy_stub = ClientStub.new nil, nil + Gapic::ServiceStub.stub :new, dummy_stub do + client = ::Google::Cloud::Retail::V2::UserEventService::Client.new do |config| + config.credentials = grpc_channel + end + end + + assert_kind_of ::Google::Cloud::Retail::V2::UserEventService::Operations, client.operations_client + end +end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/helper.rb b/owl-bot-staging/google-cloud-retail-v2/test/helper.rb new file mode 100644 index 000000000000..4fb6756ac7e2 --- /dev/null +++ b/owl-bot-staging/google-cloud-retail-v2/test/helper.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# Load JUnit XML formatter from googleapis/ruby-common-tools to write +# tmp/reports/sponge_log.xml for Kokoro/TestGrid build health tracking. +if ENV["CI"] || ENV["KOKORO_JOB_NAME"] + begin + require "gapic/minitest_junit_preloader" + rescue LoadError + end +end + +require "minitest/autorun" +require "minitest/focus" +require "minitest/mock" +require "minitest/rg" + +require "grpc" + +require "ostruct" From 5a38a8fc83cc51364cd203ed5b1b3a57ba0e003a Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 7 Aug 2026 19:58:35 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- google-cloud-retail-v2/.owlbot-manifest.json | 3 +- google-cloud-retail-v2/.toys.rb | 2 +- google-cloud-retail-v2/README.md | 2 +- google-cloud-retail-v2/Rakefile | 2 +- .../google-cloud-retail-v2.gemspec | 2 +- .../lib/google-cloud-retail-v2.rb | 2 +- .../lib/google/cloud/retail/v2.rb | 2 +- .../cloud/retail/v2/analytics_service.rb | 2 +- .../retail/v2/analytics_service/client.rb | 2 +- .../v2/analytics_service/credentials.rb | 2 +- .../retail/v2/analytics_service/operations.rb | 2 +- .../cloud/retail/v2/analytics_service/rest.rb | 2 +- .../v2/analytics_service/rest/client.rb | 2 +- .../v2/analytics_service/rest/operations.rb | 2 +- .../v2/analytics_service/rest/service_stub.rb | 2 +- .../v2/analytics_service_services_pb.rb | 2 +- .../google/cloud/retail/v2/catalog_service.rb | 2 +- .../cloud/retail/v2/catalog_service/client.rb | 2 +- .../retail/v2/catalog_service/credentials.rb | 2 +- .../cloud/retail/v2/catalog_service/paths.rb | 2 +- .../cloud/retail/v2/catalog_service/rest.rb | 2 +- .../retail/v2/catalog_service/rest/client.rb | 2 +- .../v2/catalog_service/rest/service_stub.rb | 2 +- .../retail/v2/catalog_service_services_pb.rb | 2 +- .../cloud/retail/v2/completion_service.rb | 2 +- .../retail/v2/completion_service/client.rb | 2 +- .../v2/completion_service/credentials.rb | 2 +- .../v2/completion_service/operations.rb | 2 +- .../retail/v2/completion_service/paths.rb | 2 +- .../retail/v2/completion_service/rest.rb | 2 +- .../v2/completion_service/rest/client.rb | 2 +- .../v2/completion_service/rest/operations.rb | 2 +- .../completion_service/rest/service_stub.rb | 2 +- .../v2/completion_service_services_pb.rb | 2 +- .../google/cloud/retail/v2/control_service.rb | 2 +- .../cloud/retail/v2/control_service/client.rb | 2 +- .../retail/v2/control_service/credentials.rb | 2 +- .../cloud/retail/v2/control_service/paths.rb | 2 +- .../cloud/retail/v2/control_service/rest.rb | 2 +- .../retail/v2/control_service/rest/client.rb | 2 +- .../v2/control_service/rest/service_stub.rb | 2 +- .../retail/v2/control_service_services_pb.rb | 2 +- .../v2/conversational_search_service.rb | 2 +- .../conversational_search_service/client.rb | 2 +- .../credentials.rb | 2 +- .../v2/conversational_search_service/paths.rb | 2 +- .../v2/conversational_search_service/rest.rb | 2 +- .../rest/client.rb | 2 +- .../rest/service_stub.rb | 2 +- .../retail/v2/generative_question_service.rb | 2 +- .../v2/generative_question_service/client.rb | 2 +- .../credentials.rb | 2 +- .../v2/generative_question_service/paths.rb | 2 +- .../v2/generative_question_service/rest.rb | 2 +- .../rest/client.rb | 2 +- .../rest/service_stub.rb | 2 +- ...generative_question_service_services_pb.rb | 2 +- .../google/cloud/retail/v2/model_service.rb | 2 +- .../cloud/retail/v2/model_service/client.rb | 2 +- .../retail/v2/model_service/credentials.rb | 2 +- .../retail/v2/model_service/operations.rb | 2 +- .../cloud/retail/v2/model_service/paths.rb | 2 +- .../cloud/retail/v2/model_service/rest.rb | 2 +- .../retail/v2/model_service/rest/client.rb | 2 +- .../v2/model_service/rest/operations.rb | 2 +- .../v2/model_service/rest/service_stub.rb | 2 +- .../retail/v2/model_service_services_pb.rb | 2 +- .../cloud/retail/v2/prediction_service.rb | 2 +- .../retail/v2/prediction_service/client.rb | 2 +- .../v2/prediction_service/credentials.rb | 2 +- .../retail/v2/prediction_service/paths.rb | 2 +- .../retail/v2/prediction_service/rest.rb | 2 +- .../v2/prediction_service/rest/client.rb | 2 +- .../prediction_service/rest/service_stub.rb | 2 +- .../v2/prediction_service_services_pb.rb | 2 +- .../google/cloud/retail/v2/product_service.rb | 2 +- .../cloud/retail/v2/product_service/client.rb | 2 +- .../retail/v2/product_service/credentials.rb | 2 +- .../retail/v2/product_service/operations.rb | 2 +- .../cloud/retail/v2/product_service/paths.rb | 2 +- .../cloud/retail/v2/product_service/rest.rb | 2 +- .../retail/v2/product_service/rest/client.rb | 2 +- .../v2/product_service/rest/operations.rb | 2 +- .../v2/product_service/rest/service_stub.rb | 2 +- .../retail/v2/product_service_services_pb.rb | 2 +- .../lib/google/cloud/retail/v2/rest.rb | 2 +- .../google/cloud/retail/v2/search_service.rb | 2 +- .../cloud/retail/v2/search_service/client.rb | 2 +- .../retail/v2/search_service/credentials.rb | 2 +- .../cloud/retail/v2/search_service/paths.rb | 2 +- .../cloud/retail/v2/search_service/rest.rb | 2 +- .../retail/v2/search_service/rest/client.rb | 2 +- .../v2/search_service/rest/service_stub.rb | 2 +- .../retail/v2/search_service_services_pb.rb | 2 +- .../cloud/retail/v2/serving_config_service.rb | 2 +- .../v2/serving_config_service/client.rb | 2 +- .../v2/serving_config_service/credentials.rb | 2 +- .../retail/v2/serving_config_service/paths.rb | 2 +- .../retail/v2/serving_config_service/rest.rb | 2 +- .../v2/serving_config_service/rest/client.rb | 2 +- .../rest/service_stub.rb | 2 +- .../v2/serving_config_service_services_pb.rb | 2 +- .../cloud/retail/v2/user_event_service.rb | 2 +- .../retail/v2/user_event_service/client.rb | 2 +- .../v2/user_event_service/credentials.rb | 2 +- .../v2/user_event_service/operations.rb | 2 +- .../retail/v2/user_event_service/paths.rb | 2 +- .../retail/v2/user_event_service/rest.rb | 2 +- .../v2/user_event_service/rest/client.rb | 2 +- .../v2/user_event_service/rest/operations.rb | 2 +- .../user_event_service/rest/service_stub.rb | 2 +- .../v2/user_event_service_services_pb.rb | 2 +- .../proto_docs/google/api/client.rb | 2 +- .../proto_docs/google/api/field_behavior.rb | 2 +- .../proto_docs/google/api/httpbody.rb | 2 +- .../proto_docs/google/api/launch_stage.rb | 2 +- .../proto_docs/google/api/resource.rb | 2 +- .../google/cloud/retail/v2/catalog.rb | 2 +- .../google/cloud/retail/v2/catalog_service.rb | 2 +- .../google/cloud/retail/v2/common.rb | 2 +- .../cloud/retail/v2/completion_service.rb | 2 +- .../google/cloud/retail/v2/control.rb | 2 +- .../google/cloud/retail/v2/control_service.rb | 2 +- .../v2/conversational_search_service.rb | 2 +- .../google/cloud/retail/v2/export_config.rb | 2 +- .../cloud/retail/v2/generative_question.rb | 2 +- .../retail/v2/generative_question_service.rb | 2 +- .../google/cloud/retail/v2/import_config.rb | 2 +- .../google/cloud/retail/v2/model.rb | 2 +- .../google/cloud/retail/v2/model_service.rb | 2 +- .../cloud/retail/v2/prediction_service.rb | 2 +- .../google/cloud/retail/v2/product.rb | 2 +- .../google/cloud/retail/v2/product_service.rb | 2 +- .../google/cloud/retail/v2/promotion.rb | 2 +- .../google/cloud/retail/v2/purge_config.rb | 2 +- .../google/cloud/retail/v2/safety.rb | 2 +- .../google/cloud/retail/v2/search_service.rb | 2 +- .../google/cloud/retail/v2/serving_config.rb | 2 +- .../cloud/retail/v2/serving_config_service.rb | 2 +- .../google/cloud/retail/v2/user_event.rb | 2 +- .../cloud/retail/v2/user_event_service.rb | 2 +- .../google/longrunning/operations.rb | 2 +- .../proto_docs/google/protobuf/any.rb | 2 +- .../proto_docs/google/protobuf/duration.rb | 2 +- .../proto_docs/google/protobuf/empty.rb | 2 +- .../proto_docs/google/protobuf/field_mask.rb | 2 +- .../proto_docs/google/protobuf/struct.rb | 2 +- .../proto_docs/google/protobuf/timestamp.rb | 15 +- .../proto_docs/google/protobuf/wrappers.rb | 2 +- .../proto_docs/google/rpc/status.rb | 2 +- .../proto_docs/google/type/date.rb | 2 +- google-cloud-retail-v2/snippets/Gemfile | 2 +- .../export_analytics_metrics.rb | 2 +- .../catalog_service/add_catalog_attribute.rb | 2 +- .../catalog_service/get_attributes_config.rb | 2 +- .../catalog_service/get_completion_config.rb | 2 +- .../catalog_service/get_default_branch.rb | 2 +- .../snippets/catalog_service/list_catalogs.rb | 2 +- .../remove_catalog_attribute.rb | 2 +- .../replace_catalog_attribute.rb | 2 +- .../catalog_service/set_default_branch.rb | 2 +- .../update_attributes_config.rb | 2 +- .../catalog_service/update_catalog.rb | 2 +- .../update_completion_config.rb | 2 +- .../completion_service/complete_query.rb | 2 +- .../import_completion_data.rb | 2 +- .../control_service/create_control.rb | 2 +- .../control_service/delete_control.rb | 2 +- .../snippets/control_service/get_control.rb | 2 +- .../snippets/control_service/list_controls.rb | 2 +- .../control_service/update_control.rb | 2 +- .../conversational_search.rb | 2 +- ...atch_update_generative_question_configs.rb | 2 +- ...get_generative_questions_feature_config.rb | 2 +- .../list_generative_question_configs.rb | 2 +- .../update_generative_question_config.rb | 2 +- ...ate_generative_questions_feature_config.rb | 2 +- .../snippets/model_service/create_model.rb | 2 +- .../snippets/model_service/delete_model.rb | 2 +- .../snippets/model_service/get_model.rb | 2 +- .../snippets/model_service/list_models.rb | 2 +- .../snippets/model_service/pause_model.rb | 2 +- .../snippets/model_service/resume_model.rb | 2 +- .../snippets/model_service/tune_model.rb | 2 +- .../snippets/model_service/update_model.rb | 2 +- .../snippets/prediction_service/predict.rb | 2 +- .../product_service/add_fulfillment_places.rb | 2 +- .../product_service/add_local_inventories.rb | 2 +- .../product_service/create_product.rb | 2 +- .../product_service/delete_product.rb | 2 +- .../snippets/product_service/get_product.rb | 2 +- .../product_service/import_products.rb | 2 +- .../snippets/product_service/list_products.rb | 2 +- .../product_service/purge_products.rb | 2 +- .../remove_fulfillment_places.rb | 2 +- .../remove_local_inventories.rb | 2 +- .../snippets/product_service/set_inventory.rb | 2 +- .../product_service/update_product.rb | 2 +- .../snippets/search_service/search.rb | 2 +- .../serving_config_service/add_control.rb | 2 +- .../create_serving_config.rb | 2 +- .../delete_serving_config.rb | 2 +- .../get_serving_config.rb | 2 +- .../list_serving_configs.rb | 2 +- .../serving_config_service/remove_control.rb | 2 +- .../update_serving_config.rb | 2 +- .../user_event_service/collect_user_event.rb | 2 +- .../user_event_service/import_user_events.rb | 2 +- .../user_event_service/purge_user_events.rb | 2 +- .../user_event_service/rejoin_user_events.rb | 2 +- .../user_event_service/write_user_event.rb | 2 +- .../v2/analytics_service_operations_test.rb | 2 +- .../retail/v2/analytics_service_rest_test.rb | 2 +- .../cloud/retail/v2/analytics_service_test.rb | 2 +- .../retail/v2/catalog_service_paths_test.rb | 2 +- .../retail/v2/catalog_service_rest_test.rb | 2 +- .../cloud/retail/v2/catalog_service_test.rb | 2 +- .../v2/completion_service_operations_test.rb | 2 +- .../v2/completion_service_paths_test.rb | 2 +- .../retail/v2/completion_service_rest_test.rb | 2 +- .../retail/v2/completion_service_test.rb | 2 +- .../retail/v2/control_service_paths_test.rb | 2 +- .../retail/v2/control_service_rest_test.rb | 2 +- .../cloud/retail/v2/control_service_test.rb | 2 +- ...onversational_search_service_paths_test.rb | 2 +- ...conversational_search_service_rest_test.rb | 2 +- .../v2/conversational_search_service_test.rb | 2 +- .../generative_question_service_paths_test.rb | 2 +- .../generative_question_service_rest_test.rb | 2 +- .../v2/generative_question_service_test.rb | 2 +- .../v2/model_service_operations_test.rb | 2 +- .../retail/v2/model_service_paths_test.rb | 2 +- .../retail/v2/model_service_rest_test.rb | 2 +- .../cloud/retail/v2/model_service_test.rb | 2 +- .../v2/prediction_service_paths_test.rb | 2 +- .../retail/v2/prediction_service_rest_test.rb | 2 +- .../retail/v2/prediction_service_test.rb | 2 +- .../v2/product_service_operations_test.rb | 2 +- .../retail/v2/product_service_paths_test.rb | 2 +- .../retail/v2/product_service_rest_test.rb | 2 +- .../cloud/retail/v2/product_service_test.rb | 2 +- .../retail/v2/search_service_paths_test.rb | 2 +- .../retail/v2/search_service_rest_test.rb | 2 +- .../cloud/retail/v2/search_service_test.rb | 2 +- .../v2/serving_config_service_paths_test.rb | 2 +- .../v2/serving_config_service_rest_test.rb | 2 +- .../retail/v2/serving_config_service_test.rb | 2 +- .../v2/user_event_service_operations_test.rb | 2 +- .../v2/user_event_service_paths_test.rb | 2 +- .../retail/v2/user_event_service_rest_test.rb | 2 +- .../retail/v2/user_event_service_test.rb | 2 +- google-cloud-retail-v2/test/helper.rb | 2 +- .../google-cloud-retail-v2/.gitignore | 20 - .../.repo-metadata.json | 18 - .../google-cloud-retail-v2/.rubocop.yml | 33 - .../google-cloud-retail-v2/.toys.rb | 28 - .../google-cloud-retail-v2/.yardopts | 12 - .../google-cloud-retail-v2/AUTHENTICATION.md | 122 - .../google-cloud-retail-v2/CHANGELOG.md | 2 - .../google-cloud-retail-v2/Gemfile | 15 - .../google-cloud-retail-v2/LICENSE.md | 201 -- .../google-cloud-retail-v2/README.md | 154 -- .../google-cloud-retail-v2/Rakefile | 169 -- .../gapic_metadata.json | 412 --- .../google-cloud-retail-v2.gemspec | 29 - .../lib/google-cloud-retail-v2.rb | 21 - .../lib/google/cloud/retail/v2.rb | 56 - .../cloud/retail/v2/analytics_service.rb | 56 - .../retail/v2/analytics_service/client.rb | 543 ---- .../v2/analytics_service/credentials.rb | 51 - .../retail/v2/analytics_service/operations.rb | 843 ------ .../cloud/retail/v2/analytics_service/rest.rb | 53 - .../v2/analytics_service/rest/client.rb | 493 ---- .../v2/analytics_service/rest/operations.rb | 962 ------- .../v2/analytics_service/rest/service_stub.rb | 143 - .../cloud/retail/v2/analytics_service_pb.rb | 27 - .../v2/analytics_service_services_pb.rb | 49 - .../lib/google/cloud/retail/v2/catalog_pb.rb | 42 - .../google/cloud/retail/v2/catalog_service.rb | 55 - .../cloud/retail/v2/catalog_service/client.rb | 1590 ----------- .../retail/v2/catalog_service/credentials.rb | 51 - .../cloud/retail/v2/catalog_service/paths.rb | 128 - .../cloud/retail/v2/catalog_service/rest.rb | 52 - .../retail/v2/catalog_service/rest/client.rb | 1470 ---------- .../v2/catalog_service/rest/service_stub.rb | 759 ------ .../cloud/retail/v2/catalog_service_pb.rb | 42 - .../retail/v2/catalog_service_services_pb.rb | 125 - .../lib/google/cloud/retail/v2/common_pb.rb | 58 - .../cloud/retail/v2/completion_service.rb | 59 - .../retail/v2/completion_service/client.rb | 716 ----- .../v2/completion_service/credentials.rb | 51 - .../v2/completion_service/operations.rb | 843 ------ .../retail/v2/completion_service/paths.rb | 52 - .../retail/v2/completion_service/rest.rb | 56 - .../v2/completion_service/rest/client.rb | 659 ----- .../v2/completion_service/rest/operations.rb | 962 ------- .../completion_service/rest/service_stub.rb | 204 -- .../cloud/retail/v2/completion_service_pb.rb | 33 - .../v2/completion_service_services_pb.rb | 61 - .../lib/google/cloud/retail/v2/control_pb.rb | 25 - .../google/cloud/retail/v2/control_service.rb | 55 - .../cloud/retail/v2/control_service/client.rb | 911 ------- .../retail/v2/control_service/credentials.rb | 51 - .../cloud/retail/v2/control_service/paths.rb | 73 - .../cloud/retail/v2/control_service/rest.rb | 52 - .../retail/v2/control_service/rest/client.rb | 833 ------ .../v2/control_service/rest/service_stub.rb | 388 --- .../cloud/retail/v2/control_service_pb.rb | 34 - .../retail/v2/control_service_services_pb.rb | 65 - .../v2/conversational_search_service.rb | 59 - .../conversational_search_service/client.rb | 576 ---- .../credentials.rb | 51 - .../v2/conversational_search_service/paths.rb | 54 - .../v2/conversational_search_service/rest.rb | 56 - .../rest/client.rb | 528 ---- .../rest/service_stub.rb | 145 - .../v2/conversational_search_service_pb.rb | 41 - ...nversational_search_service_services_pb.rb | 52 - .../cloud/retail/v2/export_config_pb.rb | 35 - .../cloud/retail/v2/generative_question_pb.rb | 24 - .../retail/v2/generative_question_service.rb | 55 - .../v2/generative_question_service/client.rb | 879 ------ .../credentials.rb | 51 - .../v2/generative_question_service/paths.rb | 52 - .../v2/generative_question_service/rest.rb | 52 - .../rest/client.rb | 801 ------ .../rest/service_stub.rb | 389 --- .../v2/generative_question_service_pb.rb | 34 - ...generative_question_service_services_pb.rb | 55 - .../cloud/retail/v2/import_config_pb.rb | 46 - .../lib/google/cloud/retail/v2/model_pb.rb | 34 - .../google/cloud/retail/v2/model_service.rb | 67 - .../cloud/retail/v2/model_service/client.rb | 1221 --------- .../retail/v2/model_service/credentials.rb | 51 - .../retail/v2/model_service/operations.rb | 843 ------ .../cloud/retail/v2/model_service/paths.rb | 73 - .../cloud/retail/v2/model_service/rest.rb | 64 - .../retail/v2/model_service/rest/client.rb | 1122 -------- .../v2/model_service/rest/operations.rb | 962 ------- .../v2/model_service/rest/service_stub.rb | 574 ---- .../cloud/retail/v2/model_service_pb.rb | 41 - .../retail/v2/model_service_services_pb.rb | 73 - .../cloud/retail/v2/prediction_service.rb | 55 - .../retail/v2/prediction_service/client.rb | 623 ----- .../v2/prediction_service/credentials.rb | 51 - .../retail/v2/prediction_service/paths.rb | 56 - .../retail/v2/prediction_service/rest.rb | 52 - .../v2/prediction_service/rest/client.rb | 573 ---- .../prediction_service/rest/service_stub.rb | 151 -- .../cloud/retail/v2/prediction_service_pb.rb | 30 - .../v2/prediction_service_services_pb.rb | 45 - .../lib/google/cloud/retail/v2/product_pb.rb | 32 - .../google/cloud/retail/v2/product_service.rb | 57 - .../cloud/retail/v2/product_service/client.rb | 2239 ---------------- .../retail/v2/product_service/credentials.rb | 51 - .../retail/v2/product_service/operations.rb | 843 ------ .../cloud/retail/v2/product_service/paths.rb | 77 - .../cloud/retail/v2/product_service/rest.rb | 54 - .../retail/v2/product_service/rest/client.rb | 2112 --------------- .../v2/product_service/rest/operations.rb | 962 ------- .../v2/product_service/rest/service_stub.rb | 822 ------ .../cloud/retail/v2/product_service_pb.rb | 54 - .../retail/v2/product_service_services_pb.rb | 248 -- .../google/cloud/retail/v2/promotion_pb.rb | 21 - .../google/cloud/retail/v2/purge_config_pb.rb | 30 - .../lib/google/cloud/retail/v2/rest.rb | 48 - .../lib/google/cloud/retail/v2/safety_pb.rb | 26 - .../google/cloud/retail/v2/search_service.rb | 58 - .../cloud/retail/v2/search_service/client.rb | 789 ------ .../retail/v2/search_service/credentials.rb | 51 - .../cloud/retail/v2/search_service/paths.rb | 54 - .../cloud/retail/v2/search_service/rest.rb | 55 - .../retail/v2/search_service/rest/client.rb | 739 ----- .../v2/search_service/rest/service_stub.rb | 151 -- .../cloud/retail/v2/search_service_pb.rb | 61 - .../retail/v2/search_service_services_pb.rb | 51 - .../cloud/retail/v2/serving_config_pb.rb | 27 - .../cloud/retail/v2/serving_config_service.rb | 55 - .../v2/serving_config_service/client.rb | 1102 -------- .../v2/serving_config_service/credentials.rb | 51 - .../retail/v2/serving_config_service/paths.rb | 73 - .../retail/v2/serving_config_service/rest.rb | 52 - .../v2/serving_config_service/rest/client.rb | 1010 ------- .../rest/service_stub.rb | 512 ---- .../retail/v2/serving_config_service_pb.rb | 36 - .../v2/serving_config_service_services_pb.rb | 74 - .../google/cloud/retail/v2/user_event_pb.rb | 30 - .../cloud/retail/v2/user_event_service.rb | 56 - .../retail/v2/user_event_service/client.rb | 1008 ------- .../v2/user_event_service/credentials.rb | 51 - .../v2/user_event_service/operations.rb | 843 ------ .../retail/v2/user_event_service/paths.rb | 75 - .../retail/v2/user_event_service/rest.rb | 53 - .../v2/user_event_service/rest/client.rb | 930 ------- .../v2/user_event_service/rest/operations.rb | 962 ------- .../user_event_service/rest/service_stub.rb | 398 --- .../cloud/retail/v2/user_event_service_pb.rb | 36 - .../v2/user_event_service_services_pb.rb | 75 - .../lib/google/cloud/retail/v2/version.rb | 28 - .../proto_docs/README.md | 4 - .../proto_docs/google/api/client.rb | 593 ---- .../proto_docs/google/api/field_behavior.rb | 85 - .../proto_docs/google/api/httpbody.rb | 80 - .../proto_docs/google/api/launch_stage.rb | 71 - .../proto_docs/google/api/resource.rb | 227 -- .../google/cloud/retail/v2/catalog.rb | 516 ---- .../google/cloud/retail/v2/catalog_service.rb | 297 --- .../google/cloud/retail/v2/common.rb | 1085 -------- .../cloud/retail/v2/completion_service.rb | 230 -- .../google/cloud/retail/v2/control.rb | 75 - .../google/cloud/retail/v2/control_service.rb | 122 - .../v2/conversational_search_service.rb | 358 --- .../google/cloud/retail/v2/export_config.rb | 184 -- .../cloud/retail/v2/generative_question.rb | 75 - .../retail/v2/generative_question_service.rb | 109 - .../google/cloud/retail/v2/import_config.rb | 404 --- .../google/cloud/retail/v2/model.rb | 267 -- .../google/cloud/retail/v2/model_service.rb | 172 -- .../cloud/retail/v2/prediction_service.rb | 237 -- .../google/cloud/retail/v2/product.rb | 588 ---- .../google/cloud/retail/v2/product_service.rb | 653 ----- .../google/cloud/retail/v2/promotion.rb | 43 - .../google/cloud/retail/v2/purge_config.rb | 178 -- .../google/cloud/retail/v2/safety.rb | 96 - .../google/cloud/retail/v2/search_service.rb | 1301 --------- .../google/cloud/retail/v2/serving_config.rb | 259 -- .../cloud/retail/v2/serving_config_service.rb | 143 - .../google/cloud/retail/v2/user_event.rb | 364 --- .../cloud/retail/v2/user_event_service.rb | 130 - .../google/longrunning/operations.rb | 191 -- .../proto_docs/google/protobuf/any.rb | 145 - .../proto_docs/google/protobuf/duration.rb | 98 - .../proto_docs/google/protobuf/empty.rb | 34 - .../proto_docs/google/protobuf/field_mask.rb | 229 -- .../proto_docs/google/protobuf/struct.rb | 108 - .../proto_docs/google/protobuf/timestamp.rb | 128 - .../proto_docs/google/protobuf/wrappers.rb | 148 - .../proto_docs/google/rpc/status.rb | 48 - .../proto_docs/google/type/date.rb | 56 - .../google-cloud-retail-v2/snippets/Gemfile | 32 - .../export_analytics_metrics.rb | 54 - .../catalog_service/add_catalog_attribute.rb | 47 - .../catalog_service/get_attributes_config.rb | 47 - .../catalog_service/get_completion_config.rb | 47 - .../catalog_service/get_default_branch.rb | 47 - .../snippets/catalog_service/list_catalogs.rb | 51 - .../remove_catalog_attribute.rb | 47 - .../replace_catalog_attribute.rb | 47 - .../catalog_service/set_default_branch.rb | 47 - .../update_attributes_config.rb | 47 - .../catalog_service/update_catalog.rb | 47 - .../update_completion_config.rb | 47 - .../completion_service/complete_query.rb | 47 - .../import_completion_data.rb | 54 - .../control_service/create_control.rb | 47 - .../control_service/delete_control.rb | 47 - .../snippets/control_service/get_control.rb | 47 - .../snippets/control_service/list_controls.rb | 51 - .../control_service/update_control.rb | 47 - .../conversational_search.rb | 50 - ...atch_update_generative_question_configs.rb | 47 - ...get_generative_questions_feature_config.rb | 47 - .../list_generative_question_configs.rb | 47 - .../update_generative_question_config.rb | 47 - ...ate_generative_questions_feature_config.rb | 47 - .../snippets/model_service/create_model.rb | 54 - .../snippets/model_service/delete_model.rb | 47 - .../snippets/model_service/get_model.rb | 47 - .../snippets/model_service/list_models.rb | 51 - .../snippets/model_service/pause_model.rb | 47 - .../snippets/model_service/resume_model.rb | 47 - .../snippets/model_service/tune_model.rb | 54 - .../snippets/model_service/update_model.rb | 47 - .../snippets/prediction_service/predict.rb | 47 - .../product_service/add_fulfillment_places.rb | 54 - .../product_service/add_local_inventories.rb | 54 - .../product_service/create_product.rb | 47 - .../product_service/delete_product.rb | 47 - .../snippets/product_service/get_product.rb | 47 - .../product_service/import_products.rb | 54 - .../snippets/product_service/list_products.rb | 51 - .../product_service/purge_products.rb | 54 - .../remove_fulfillment_places.rb | 54 - .../remove_local_inventories.rb | 54 - .../snippets/product_service/set_inventory.rb | 54 - .../product_service/update_product.rb | 47 - .../snippets/search_service/search.rb | 51 - .../serving_config_service/add_control.rb | 47 - .../create_serving_config.rb | 47 - .../delete_serving_config.rb | 47 - .../get_serving_config.rb | 47 - .../list_serving_configs.rb | 51 - .../serving_config_service/remove_control.rb | 47 - .../update_serving_config.rb | 47 - ...ippet_metadata_google.cloud.retail.v2.json | 2375 ----------------- .../user_event_service/collect_user_event.rb | 47 - .../user_event_service/import_user_events.rb | 54 - .../user_event_service/purge_user_events.rb | 54 - .../user_event_service/rejoin_user_events.rb | 54 - .../user_event_service/write_user_event.rb | 47 - .../v2/analytics_service_operations_test.rb | 400 --- .../retail/v2/analytics_service_rest_test.rb | 155 -- .../cloud/retail/v2/analytics_service_test.rb | 185 -- .../retail/v2/catalog_service_paths_test.rb | 103 - .../retail/v2/catalog_service_rest_test.rb | 705 ----- .../cloud/retail/v2/catalog_service_test.rb | 771 ------ .../v2/completion_service_operations_test.rb | 400 --- .../v2/completion_service_paths_test.rb | 55 - .../retail/v2/completion_service_rest_test.rb | 217 -- .../retail/v2/completion_service_test.rb | 259 -- .../retail/v2/control_service_paths_test.rb | 67 - .../retail/v2/control_service_rest_test.rb | 375 --- .../cloud/retail/v2/control_service_test.rb | 411 --- ...onversational_search_service_paths_test.rb | 55 - ...conversational_search_service_rest_test.rb | 163 -- .../v2/conversational_search_service_test.rb | 197 -- .../generative_question_service_paths_test.rb | 55 - .../generative_question_service_rest_test.rb | 372 --- .../v2/generative_question_service_test.rb | 400 --- .../v2/model_service_operations_test.rb | 400 --- .../retail/v2/model_service_paths_test.rb | 67 - .../retail/v2/model_service_rest_test.rb | 536 ---- .../cloud/retail/v2/model_service_test.rb | 607 ----- .../v2/prediction_service_paths_test.rb | 55 - .../retail/v2/prediction_service_rest_test.rb | 160 -- .../retail/v2/prediction_service_test.rb | 176 -- .../v2/product_service_operations_test.rb | 400 --- .../retail/v2/product_service_paths_test.rb | 67 - .../retail/v2/product_service_rest_test.rb | 781 ------ .../cloud/retail/v2/product_service_test.rb | 922 ------- .../retail/v2/search_service_paths_test.rb | 55 - .../retail/v2/search_service_rest_test.rb | 180 -- .../cloud/retail/v2/search_service_test.rb | 222 -- .../v2/serving_config_service_paths_test.rb | 67 - .../v2/serving_config_service_rest_test.rb | 484 ---- .../retail/v2/serving_config_service_test.rb | 529 ---- .../v2/user_event_service_operations_test.rb | 400 --- .../v2/user_event_service_paths_test.rb | 67 - .../retail/v2/user_event_service_rest_test.rb | 381 --- .../retail/v2/user_event_service_test.rb | 448 ---- .../google-cloud-retail-v2/test/helper.rb | 35 - 541 files changed, 260 insertions(+), 71163 deletions(-) delete mode 100644 owl-bot-staging/google-cloud-retail-v2/.gitignore delete mode 100644 owl-bot-staging/google-cloud-retail-v2/.repo-metadata.json delete mode 100644 owl-bot-staging/google-cloud-retail-v2/.rubocop.yml delete mode 100644 owl-bot-staging/google-cloud-retail-v2/.toys.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/.yardopts delete mode 100644 owl-bot-staging/google-cloud-retail-v2/AUTHENTICATION.md delete mode 100644 owl-bot-staging/google-cloud-retail-v2/CHANGELOG.md delete mode 100644 owl-bot-staging/google-cloud-retail-v2/Gemfile delete mode 100644 owl-bot-staging/google-cloud-retail-v2/LICENSE.md delete mode 100644 owl-bot-staging/google-cloud-retail-v2/README.md delete mode 100644 owl-bot-staging/google-cloud-retail-v2/Rakefile delete mode 100644 owl-bot-staging/google-cloud-retail-v2/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-retail-v2/google-cloud-retail-v2.gemspec delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google-cloud-retail-v2.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/client.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/credentials.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/operations.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/rest.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/rest/client.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/rest/operations.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/rest/service_stub.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service_pb.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service_services_pb.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_pb.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/client.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/credentials.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/paths.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/rest.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/rest/client.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/rest/service_stub.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service_pb.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service_services_pb.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/common_pb.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/client.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/credentials.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/operations.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/paths.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/rest.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/rest/client.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/rest/operations.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/rest/service_stub.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service_pb.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service_services_pb.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_pb.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/client.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/credentials.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/paths.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/rest.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/rest/client.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/rest/service_stub.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service_pb.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service_services_pb.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/client.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/credentials.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/paths.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/rest.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/rest/client.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/rest/service_stub.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service_pb.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service_services_pb.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/export_config_pb.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_pb.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/client.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/credentials.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/paths.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/rest.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/rest/client.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/rest/service_stub.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service_pb.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service_services_pb.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/import_config_pb.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_pb.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/client.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/credentials.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/operations.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/paths.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/rest.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/rest/client.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/rest/operations.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/rest/service_stub.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service_pb.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service_services_pb.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/client.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/credentials.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/paths.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/rest.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/rest/client.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/rest/service_stub.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service_pb.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service_services_pb.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_pb.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/client.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/credentials.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/operations.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/paths.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/rest.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/rest/client.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/rest/operations.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/rest/service_stub.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service_pb.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service_services_pb.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/promotion_pb.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/purge_config_pb.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/rest.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/safety_pb.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/client.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/credentials.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/paths.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/rest.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/rest/client.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/rest/service_stub.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service_pb.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service_services_pb.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_pb.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/client.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/credentials.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/paths.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/rest.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/rest/client.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/rest/service_stub.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service_pb.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service_services_pb.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_pb.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/client.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/credentials.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/operations.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/paths.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/rest.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/rest/client.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/rest/operations.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/rest/service_stub.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service_pb.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service_services_pb.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/version.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/README.md delete mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/api/client.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/api/field_behavior.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/api/httpbody.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/api/launch_stage.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/api/resource.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/catalog.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/catalog_service.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/common.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/completion_service.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/control.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/control_service.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/conversational_search_service.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/export_config.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/generative_question.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/generative_question_service.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/import_config.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/model.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/model_service.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/prediction_service.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/product.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/product_service.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/promotion.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/purge_config.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/safety.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/search_service.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/serving_config.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/serving_config_service.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/user_event.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/user_event_service.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/longrunning/operations.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/any.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/duration.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/empty.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/field_mask.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/struct.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/timestamp.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/wrappers.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/rpc/status.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/proto_docs/google/type/date.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/Gemfile delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/analytics_service/export_analytics_metrics.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/add_catalog_attribute.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/get_attributes_config.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/get_completion_config.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/get_default_branch.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/list_catalogs.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/remove_catalog_attribute.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/replace_catalog_attribute.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/set_default_branch.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/update_attributes_config.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/update_catalog.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/update_completion_config.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/completion_service/complete_query.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/completion_service/import_completion_data.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/control_service/create_control.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/control_service/delete_control.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/control_service/get_control.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/control_service/list_controls.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/control_service/update_control.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/conversational_search_service/conversational_search.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/generative_question_service/batch_update_generative_question_configs.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/generative_question_service/get_generative_questions_feature_config.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/generative_question_service/list_generative_question_configs.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/generative_question_service/update_generative_question_config.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/generative_question_service/update_generative_questions_feature_config.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/model_service/create_model.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/model_service/delete_model.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/model_service/get_model.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/model_service/list_models.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/model_service/pause_model.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/model_service/resume_model.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/model_service/tune_model.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/model_service/update_model.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/prediction_service/predict.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/product_service/add_fulfillment_places.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/product_service/add_local_inventories.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/product_service/create_product.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/product_service/delete_product.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/product_service/get_product.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/product_service/import_products.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/product_service/list_products.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/product_service/purge_products.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/product_service/remove_fulfillment_places.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/product_service/remove_local_inventories.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/product_service/set_inventory.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/product_service/update_product.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/search_service/search.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/add_control.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/create_serving_config.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/delete_serving_config.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/get_serving_config.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/list_serving_configs.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/remove_control.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/update_serving_config.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/snippet_metadata_google.cloud.retail.v2.json delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/user_event_service/collect_user_event.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/user_event_service/import_user_events.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/user_event_service/purge_user_events.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/user_event_service/rejoin_user_events.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/snippets/user_event_service/write_user_event.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/analytics_service_operations_test.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/analytics_service_rest_test.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/analytics_service_test.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/catalog_service_paths_test.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/catalog_service_rest_test.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/catalog_service_test.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/completion_service_operations_test.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/completion_service_paths_test.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/completion_service_rest_test.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/completion_service_test.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/control_service_paths_test.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/control_service_rest_test.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/control_service_test.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/conversational_search_service_paths_test.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/conversational_search_service_rest_test.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/conversational_search_service_test.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/generative_question_service_paths_test.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/generative_question_service_rest_test.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/generative_question_service_test.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/model_service_operations_test.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/model_service_paths_test.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/model_service_rest_test.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/model_service_test.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/prediction_service_paths_test.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/prediction_service_rest_test.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/prediction_service_test.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/product_service_operations_test.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/product_service_paths_test.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/product_service_rest_test.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/product_service_test.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/search_service_paths_test.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/search_service_rest_test.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/search_service_test.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/serving_config_service_paths_test.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/serving_config_service_rest_test.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/serving_config_service_test.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/user_event_service_operations_test.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/user_event_service_paths_test.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/user_event_service_rest_test.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/user_event_service_test.rb delete mode 100644 owl-bot-staging/google-cloud-retail-v2/test/helper.rb diff --git a/google-cloud-retail-v2/.owlbot-manifest.json b/google-cloud-retail-v2/.owlbot-manifest.json index e574fe2198fd..c9f17189fa99 100644 --- a/google-cloud-retail-v2/.owlbot-manifest.json +++ b/google-cloud-retail-v2/.owlbot-manifest.json @@ -291,6 +291,7 @@ "test/helper.rb" ], "static": [ - ".OwlBot.yaml" + ".OwlBot.yaml", + "Gemfile.lock" ] } diff --git a/google-cloud-retail-v2/.toys.rb b/google-cloud-retail-v2/.toys.rb index 23434bdd5d5b..177e22456e8a 100644 --- a/google-cloud-retail-v2/.toys.rb +++ b/google-cloud-retail-v2/.toys.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2024 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/README.md b/google-cloud-retail-v2/README.md index 7315dd6ad65a..43e25a86caf7 100644 --- a/google-cloud-retail-v2/README.md +++ b/google-cloud-retail-v2/README.md @@ -1,6 +1,6 @@ # Ruby Client for the Retail V2 API -Vertex AI Search for commerce API is made up of Retail Search, Browse and Recommendations. These discovery AI solutions help you implement personalized search, browse and recommendations, based on machine learning models, across your websites and mobile applications. +AI Commerce Search API is made up of Search, Browse and Recommendations. These discovery AI solutions help you implement personalized search, browse and recommendations, based on machine learning models, across your websites and mobile applications. Retail enables you to build an end-to-end personalized recommendation system based on state-of-the-art deep learning ML models, without a need for expertise in ML or recommendation systems. diff --git a/google-cloud-retail-v2/Rakefile b/google-cloud-retail-v2/Rakefile index 6a4315b5eeb4..b4e6091ef9cd 100644 --- a/google-cloud-retail-v2/Rakefile +++ b/google-cloud-retail-v2/Rakefile @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/google-cloud-retail-v2.gemspec b/google-cloud-retail-v2/google-cloud-retail-v2.gemspec index 65271100dc2d..e93626b80550 100644 --- a/google-cloud-retail-v2/google-cloud-retail-v2.gemspec +++ b/google-cloud-retail-v2/google-cloud-retail-v2.gemspec @@ -10,7 +10,7 @@ Gem::Specification.new do |gem| gem.authors = ["Google LLC"] gem.email = "googleapis-packages@google.com" gem.description = "Retail enables you to build an end-to-end personalized recommendation system based on state-of-the-art deep learning ML models, without a need for expertise in ML or recommendation systems. Note that google-cloud-retail-v2 is a version-specific client library. For most uses, we recommend installing the main client library google-cloud-retail instead. See the readme for more details." - gem.summary = "Vertex AI Search for commerce API is made up of Retail Search, Browse and Recommendations. These discovery AI solutions help you implement personalized search, browse and recommendations, based on machine learning models, across your websites and mobile applications." + gem.summary = "AI Commerce Search API is made up of Search, Browse and Recommendations. These discovery AI solutions help you implement personalized search, browse and recommendations, based on machine learning models, across your websites and mobile applications." gem.homepage = "https://github.com/googleapis/google-cloud-ruby" gem.license = "Apache-2.0" diff --git a/google-cloud-retail-v2/lib/google-cloud-retail-v2.rb b/google-cloud-retail-v2/lib/google-cloud-retail-v2.rb index 2d2b450b360a..45db4898f66c 100644 --- a/google-cloud-retail-v2/lib/google-cloud-retail-v2.rb +++ b/google-cloud-retail-v2/lib/google-cloud-retail-v2.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2.rb index 202c40fb87c8..4214f1307e58 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service.rb index 5e0cd4b2e086..3eb7f4cce88a 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2024 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/client.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/client.rb index 6a70d419f55a..6bf39fd8fb1d 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/client.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/client.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2024 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/credentials.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/credentials.rb index 2d4817a416a8..89a3470cd910 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/credentials.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/credentials.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2024 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/operations.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/operations.rb index 38270dbbe77c..a95ff44ed70d 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/operations.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/operations.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2024 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/rest.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/rest.rb index 695cd71f592c..df3ab00fece5 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/rest.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/rest.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2024 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/rest/client.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/rest/client.rb index 4f9153b5f49d..f8af9a9f4f30 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/rest/client.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/rest/client.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2024 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/rest/operations.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/rest/operations.rb index 042956fa497a..637809c95842 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/rest/operations.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/rest/operations.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2024 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/rest/service_stub.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/rest/service_stub.rb index 07d002374750..b35aff3ed4cc 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/rest/service_stub.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/rest/service_stub.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2024 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service_services_pb.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service_services_pb.rb index ebfe581a8f12..b9425168a3f7 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service_services_pb.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service_services_pb.rb @@ -1,7 +1,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # Source: google/cloud/retail/v2/analytics_service.proto for package 'Google.Cloud.Retail.V2' # Original file comments: -# Copyright 2021 Google LLC +# Copyright 2025 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service.rb index 0972bc7a382a..a11f97aecb81 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/client.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/client.rb index 78ce99bcdb0f..47fce9e01293 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/client.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/client.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/credentials.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/credentials.rb index 15a902b2fcda..181a310393b3 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/credentials.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/credentials.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/paths.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/paths.rb index e2242b26c50b..19287ee026f3 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/paths.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/paths.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/rest.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/rest.rb index 176011a2cba9..ea2c8cf3fcef 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/rest.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/rest.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/rest/client.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/rest/client.rb index e064c29b243f..7627e97bdcbd 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/rest/client.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/rest/client.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/rest/service_stub.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/rest/service_stub.rb index 1df856bb1d4c..aba96c79d1c5 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/rest/service_stub.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/rest/service_stub.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service_services_pb.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service_services_pb.rb index 438318e3f7ab..bfd199b2e5c5 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service_services_pb.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service_services_pb.rb @@ -1,7 +1,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # Source: google/cloud/retail/v2/catalog_service.proto for package 'Google.Cloud.Retail.V2' # Original file comments: -# Copyright 2020 Google LLC +# Copyright 2025 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service.rb index 9dc5ddf4023e..910963175533 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/client.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/client.rb index 35872c2b9509..956d00b4dee1 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/client.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/client.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/credentials.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/credentials.rb index 9b6dcd92efb0..fad74ea58827 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/credentials.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/credentials.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/operations.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/operations.rb index a7d6ba1a5310..0c0957f84195 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/operations.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/operations.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/paths.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/paths.rb index d2ab3620660e..600b86ed9a0d 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/paths.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/paths.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/rest.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/rest.rb index 93e102745c4d..1cf8247a53be 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/rest.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/rest.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/rest/client.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/rest/client.rb index f620a0b42f02..7e1ea70c6b10 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/rest/client.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/rest/client.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/rest/operations.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/rest/operations.rb index af6c0c678042..ab0fc41898c9 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/rest/operations.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/rest/operations.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/rest/service_stub.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/rest/service_stub.rb index a8ea7e4b97c1..31957d90f097 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/rest/service_stub.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/rest/service_stub.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service_services_pb.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service_services_pb.rb index 46aed79ddd8d..64e7fdaa4af5 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service_services_pb.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service_services_pb.rb @@ -1,7 +1,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # Source: google/cloud/retail/v2/completion_service.proto for package 'Google.Cloud.Retail.V2' # Original file comments: -# Copyright 2020 Google LLC +# Copyright 2025 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service.rb index 07ee03926575..e93086f0a231 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2022 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/client.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/client.rb index 3f0a1f442873..58f5be8a828e 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/client.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/client.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2022 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/credentials.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/credentials.rb index 8354ac246e9d..127904154fe5 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/credentials.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/credentials.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2022 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/paths.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/paths.rb index 1a30fa50b855..464e5d03b5ba 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/paths.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/paths.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2022 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/rest.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/rest.rb index 5d1c61c770cd..31828796abd0 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/rest.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/rest.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/rest/client.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/rest/client.rb index 26ebdfceb89a..8d4d1c1b8f6f 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/rest/client.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/rest/client.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/rest/service_stub.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/rest/service_stub.rb index bcb85496b9a8..61b0a0f77df2 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/rest/service_stub.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/rest/service_stub.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service_services_pb.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service_services_pb.rb index c75c46e11ae1..bcef36f6b4c1 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service_services_pb.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service_services_pb.rb @@ -1,7 +1,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # Source: google/cloud/retail/v2/control_service.proto for package 'Google.Cloud.Retail.V2' # Original file comments: -# Copyright 2021 Google LLC +# Copyright 2025 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service.rb index 766eca885ef5..c3b86da366b9 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/client.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/client.rb index 3ee32a9d0c97..0a37d6165e10 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/client.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/client.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/credentials.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/credentials.rb index 9c5d70081c2f..ccd5e02152d8 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/credentials.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/credentials.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/paths.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/paths.rb index c2b679367ecc..f19dca726f47 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/paths.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/paths.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/rest.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/rest.rb index c33e72994d45..2177b82399f5 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/rest.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/rest.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/rest/client.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/rest/client.rb index 33cd3ed3292a..a4a6d12e6df2 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/rest/client.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/rest/client.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/rest/service_stub.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/rest/service_stub.rb index 242177503599..45338f592c0b 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/rest/service_stub.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/rest/service_stub.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service.rb index 5c49d5ade7e7..820d713f4e45 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2024 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/client.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/client.rb index 4c0c7b651298..de3a2a9764ad 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/client.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/client.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2024 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/credentials.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/credentials.rb index b766fb6b429d..15af3d895c06 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/credentials.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/credentials.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2024 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/paths.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/paths.rb index d9bd89097e87..a01a45d7d88f 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/paths.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/paths.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2024 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/rest.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/rest.rb index c53eba228511..a4599e934284 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/rest.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/rest.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2024 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/rest/client.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/rest/client.rb index e3112bcc99e0..414fa2beac8b 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/rest/client.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/rest/client.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2024 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/rest/service_stub.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/rest/service_stub.rb index 5393bfc455ca..28bb60081ea8 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/rest/service_stub.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/rest/service_stub.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2024 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service_services_pb.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service_services_pb.rb index 58996e2e50a9..259ede2d8557 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service_services_pb.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service_services_pb.rb @@ -1,7 +1,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # Source: google/cloud/retail/v2/generative_question_service.proto for package 'Google.Cloud.Retail.V2' # Original file comments: -# Copyright 2024 Google LLC +# Copyright 2025 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service.rb index 080f830cc89b..7494180ffbb2 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/client.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/client.rb index d3e528bd5164..c39bfc7e2a36 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/client.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/client.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/credentials.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/credentials.rb index 681d4d81f81c..acf6300e811b 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/credentials.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/credentials.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/operations.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/operations.rb index 86b0fcdf5a55..ae16a84e1ee1 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/operations.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/operations.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/paths.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/paths.rb index 6733cb7ad4b2..dfac159c4ef5 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/paths.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/paths.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/rest.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/rest.rb index 19dd9dd9b308..09cc5600da6e 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/rest.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/rest.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/rest/client.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/rest/client.rb index 31b48f47833c..9c772ac0f01c 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/rest/client.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/rest/client.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/rest/operations.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/rest/operations.rb index ff8dafeb9782..ec084652ff45 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/rest/operations.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/rest/operations.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/rest/service_stub.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/rest/service_stub.rb index 0e98b9103960..fec1a150075d 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/rest/service_stub.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/rest/service_stub.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service_services_pb.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service_services_pb.rb index c4a44dbd0433..2f5b8ea64496 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service_services_pb.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service_services_pb.rb @@ -1,7 +1,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # Source: google/cloud/retail/v2/model_service.proto for package 'Google.Cloud.Retail.V2' # Original file comments: -# Copyright 2021 Google LLC +# Copyright 2025 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service.rb index 1d375cdb4331..621491985f8d 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/client.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/client.rb index 8810815a150f..9232ef60a2ed 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/client.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/client.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/credentials.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/credentials.rb index 28b8116cbea0..1da276c819f4 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/credentials.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/credentials.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/paths.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/paths.rb index 9cd4cb1d6e81..26277b36936a 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/paths.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/paths.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/rest.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/rest.rb index f2c3f0635777..351e68db6577 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/rest.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/rest.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/rest/client.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/rest/client.rb index dd19e3777f6f..58169840c4a5 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/rest/client.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/rest/client.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/rest/service_stub.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/rest/service_stub.rb index fd4e3a3e57d4..4717b50f2d91 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/rest/service_stub.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/rest/service_stub.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service_services_pb.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service_services_pb.rb index 69b6774d571f..050119438d40 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service_services_pb.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service_services_pb.rb @@ -1,7 +1,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # Source: google/cloud/retail/v2/prediction_service.proto for package 'Google.Cloud.Retail.V2' # Original file comments: -# Copyright 2020 Google LLC +# Copyright 2025 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service.rb index a312f5a00692..b0bca826b962 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/client.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/client.rb index a195265372c4..769fcf4f1fca 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/client.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/client.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/credentials.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/credentials.rb index 93275ed0b332..1a4d7700391f 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/credentials.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/credentials.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/operations.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/operations.rb index 94417c236385..73c2f7ea2412 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/operations.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/operations.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/paths.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/paths.rb index 4bb7975903b0..c0f4efbe2230 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/paths.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/paths.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/rest.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/rest.rb index 566c7cc1bcaf..1a50a1c1e9fd 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/rest.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/rest.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/rest/client.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/rest/client.rb index bcf6a2059134..489f7e6ccebb 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/rest/client.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/rest/client.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/rest/operations.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/rest/operations.rb index e19762bb9ad0..f14d649ba52d 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/rest/operations.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/rest/operations.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/rest/service_stub.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/rest/service_stub.rb index eb0d8fb7e6c4..164a945f0191 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/rest/service_stub.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/rest/service_stub.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service_services_pb.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service_services_pb.rb index f19b4313a1ac..5ae098e9d214 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service_services_pb.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service_services_pb.rb @@ -1,7 +1,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # Source: google/cloud/retail/v2/product_service.proto for package 'Google.Cloud.Retail.V2' # Original file comments: -# Copyright 2020 Google LLC +# Copyright 2025 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/rest.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/rest.rb index 2287197a5c7b..47b06c36e7ba 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/rest.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/rest.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service.rb index c24af546774a..dae214f30163 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/client.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/client.rb index a54ea30c6d33..7dcd0044183f 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/client.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/client.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/credentials.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/credentials.rb index ab50a4ebb244..cac1d6f0827c 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/credentials.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/credentials.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/paths.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/paths.rb index c8026b0d1ec2..9bc8dfbe2895 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/paths.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/paths.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/rest.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/rest.rb index e9e67112aaca..b7b1de13989c 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/rest.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/rest.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/rest/client.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/rest/client.rb index 3ec61f974698..5657920b447d 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/rest/client.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/rest/client.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/rest/service_stub.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/rest/service_stub.rb index 672768ee2022..826122ca8f8d 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/rest/service_stub.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/rest/service_stub.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service_services_pb.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service_services_pb.rb index efb299233afc..48bf05ab1516 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service_services_pb.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service_services_pb.rb @@ -1,7 +1,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # Source: google/cloud/retail/v2/search_service.proto for package 'Google.Cloud.Retail.V2' # Original file comments: -# Copyright 2020 Google LLC +# Copyright 2025 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service.rb index 4a48b4f468ec..4a0503a4322d 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2022 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/client.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/client.rb index fb2b2cddab23..1baa4825c690 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/client.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/client.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2022 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/credentials.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/credentials.rb index 3948e6000605..c42ba1c10eee 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/credentials.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/credentials.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2022 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/paths.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/paths.rb index 95da744c7ae6..bb9d885a6589 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/paths.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/paths.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2022 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/rest.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/rest.rb index 6c491159669b..f2b31df2bbc7 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/rest.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/rest.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/rest/client.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/rest/client.rb index e2540c84c50b..6974da79ed98 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/rest/client.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/rest/client.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/rest/service_stub.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/rest/service_stub.rb index 2b14bfc437a5..ade51caaf6b9 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/rest/service_stub.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/rest/service_stub.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service_services_pb.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service_services_pb.rb index 3161de55da84..ae1db2fde215 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service_services_pb.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service_services_pb.rb @@ -1,7 +1,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # Source: google/cloud/retail/v2/serving_config_service.proto for package 'Google.Cloud.Retail.V2' # Original file comments: -# Copyright 2021 Google LLC +# Copyright 2025 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service.rb index 6a2280d37fa9..7ff44608d216 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/client.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/client.rb index 4539a673c474..b7852fd0e142 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/client.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/client.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/credentials.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/credentials.rb index 19476d93f3d1..d7842cfcb893 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/credentials.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/credentials.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/operations.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/operations.rb index 1095eaeac6fd..77846fecafab 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/operations.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/operations.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/paths.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/paths.rb index 088d22cb3f59..83bc1611ec7f 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/paths.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/paths.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/rest.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/rest.rb index 89f2c5c4189f..dfa91294298f 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/rest.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/rest.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/rest/client.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/rest/client.rb index 135d70edf247..623b46759f10 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/rest/client.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/rest/client.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/rest/operations.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/rest/operations.rb index c7984915d35c..0cf60d8bffb9 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/rest/operations.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/rest/operations.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/rest/service_stub.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/rest/service_stub.rb index 5f2569d70783..d2603e85207f 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/rest/service_stub.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/rest/service_stub.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service_services_pb.rb b/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service_services_pb.rb index 2541e80457b5..65e9fe4b7c1f 100644 --- a/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service_services_pb.rb +++ b/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service_services_pb.rb @@ -1,7 +1,7 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # Source: google/cloud/retail/v2/user_event_service.proto for package 'Google.Cloud.Retail.V2' # Original file comments: -# Copyright 2020 Google LLC +# Copyright 2025 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/proto_docs/google/api/client.rb b/google-cloud-retail-v2/proto_docs/google/api/client.rb index e62ceba4577a..3ab0b096d445 100644 --- a/google-cloud-retail-v2/proto_docs/google/api/client.rb +++ b/google-cloud-retail-v2/proto_docs/google/api/client.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2022 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/proto_docs/google/api/field_behavior.rb b/google-cloud-retail-v2/proto_docs/google/api/field_behavior.rb index 6be3cb0ed6c3..582be187d115 100644 --- a/google-cloud-retail-v2/proto_docs/google/api/field_behavior.rb +++ b/google-cloud-retail-v2/proto_docs/google/api/field_behavior.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/proto_docs/google/api/httpbody.rb b/google-cloud-retail-v2/proto_docs/google/api/httpbody.rb index cca50e4c8c5a..938f7ac6b2fd 100644 --- a/google-cloud-retail-v2/proto_docs/google/api/httpbody.rb +++ b/google-cloud-retail-v2/proto_docs/google/api/httpbody.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/proto_docs/google/api/launch_stage.rb b/google-cloud-retail-v2/proto_docs/google/api/launch_stage.rb index ce75038366ae..9392a413fb1b 100644 --- a/google-cloud-retail-v2/proto_docs/google/api/launch_stage.rb +++ b/google-cloud-retail-v2/proto_docs/google/api/launch_stage.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2022 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/proto_docs/google/api/resource.rb b/google-cloud-retail-v2/proto_docs/google/api/resource.rb index 85d0a8f50bba..25dec4847ac1 100644 --- a/google-cloud-retail-v2/proto_docs/google/api/resource.rb +++ b/google-cloud-retail-v2/proto_docs/google/api/resource.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/catalog.rb b/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/catalog.rb index 930d71419b1b..40edde6ddced 100644 --- a/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/catalog.rb +++ b/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/catalog.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/catalog_service.rb b/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/catalog_service.rb index e79b2b65e720..062dd48b9cbe 100644 --- a/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/catalog_service.rb +++ b/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/catalog_service.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/common.rb b/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/common.rb index 5eb7fd7575ee..d73fe6763594 100644 --- a/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/common.rb +++ b/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/common.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/completion_service.rb b/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/completion_service.rb index 2bfb5ea612f0..b0608b79614d 100644 --- a/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/completion_service.rb +++ b/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/completion_service.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/control.rb b/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/control.rb index 530c73c676ec..8a377de74e6d 100644 --- a/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/control.rb +++ b/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/control.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2022 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/control_service.rb b/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/control_service.rb index a57b1670be59..317de6e4a175 100644 --- a/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/control_service.rb +++ b/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/control_service.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2022 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/conversational_search_service.rb b/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/conversational_search_service.rb index 2e88bb2fc427..5d3753d8f9ec 100644 --- a/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/conversational_search_service.rb +++ b/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/conversational_search_service.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/export_config.rb b/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/export_config.rb index 9434a4b73f17..913e07ef4121 100644 --- a/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/export_config.rb +++ b/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/export_config.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2024 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/generative_question.rb b/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/generative_question.rb index 639bb6d663de..7a58a54f8f3c 100644 --- a/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/generative_question.rb +++ b/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/generative_question.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2024 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/generative_question_service.rb b/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/generative_question_service.rb index b30912df6640..dcd3144bc211 100644 --- a/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/generative_question_service.rb +++ b/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/generative_question_service.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2024 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/import_config.rb b/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/import_config.rb index 2cf6cbc01013..e95a50d7e11c 100644 --- a/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/import_config.rb +++ b/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/import_config.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/model.rb b/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/model.rb index e5f49fd86529..76ac3160ed3b 100644 --- a/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/model.rb +++ b/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/model.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/model_service.rb b/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/model_service.rb index d0a15e9604c7..0fe12a4770c2 100644 --- a/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/model_service.rb +++ b/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/model_service.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/prediction_service.rb b/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/prediction_service.rb index 64c48452caba..53e46e58df05 100644 --- a/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/prediction_service.rb +++ b/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/prediction_service.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/product.rb b/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/product.rb index 81d4c5e7b38e..a5c89f524c45 100644 --- a/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/product.rb +++ b/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/product.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/product_service.rb b/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/product_service.rb index 33540a83d3f2..c6fb71059137 100644 --- a/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/product_service.rb +++ b/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/product_service.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/promotion.rb b/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/promotion.rb index 688af81133e1..1b9a47b22ebd 100644 --- a/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/promotion.rb +++ b/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/promotion.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2022 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/purge_config.rb b/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/purge_config.rb index 87b37e3860a5..cfeb05692659 100644 --- a/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/purge_config.rb +++ b/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/purge_config.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/safety.rb b/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/safety.rb index b03313e6c14e..c4c11c6cbd93 100644 --- a/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/safety.rb +++ b/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/safety.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/search_service.rb b/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/search_service.rb index 2c88abf9b9c7..beb964cfdc66 100644 --- a/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/search_service.rb +++ b/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/search_service.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/serving_config.rb b/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/serving_config.rb index 8236b4e1159a..2237b3c08193 100644 --- a/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/serving_config.rb +++ b/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/serving_config.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2022 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/serving_config_service.rb b/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/serving_config_service.rb index ffb49f9dc361..943913f2996e 100644 --- a/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/serving_config_service.rb +++ b/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/serving_config_service.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2022 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/user_event.rb b/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/user_event.rb index 630fab1c882c..2c119fd76473 100644 --- a/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/user_event.rb +++ b/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/user_event.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/user_event_service.rb b/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/user_event_service.rb index f0ed5c09dd73..cb0896f85338 100644 --- a/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/user_event_service.rb +++ b/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/user_event_service.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/proto_docs/google/longrunning/operations.rb b/google-cloud-retail-v2/proto_docs/google/longrunning/operations.rb index 50f11f9f36d6..7a757f512165 100644 --- a/google-cloud-retail-v2/proto_docs/google/longrunning/operations.rb +++ b/google-cloud-retail-v2/proto_docs/google/longrunning/operations.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/proto_docs/google/protobuf/any.rb b/google-cloud-retail-v2/proto_docs/google/protobuf/any.rb index 4fde75cec2aa..58691995f02e 100644 --- a/google-cloud-retail-v2/proto_docs/google/protobuf/any.rb +++ b/google-cloud-retail-v2/proto_docs/google/protobuf/any.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/proto_docs/google/protobuf/duration.rb b/google-cloud-retail-v2/proto_docs/google/protobuf/duration.rb index dcc4a8a3c05b..ea59f1f91daf 100644 --- a/google-cloud-retail-v2/proto_docs/google/protobuf/duration.rb +++ b/google-cloud-retail-v2/proto_docs/google/protobuf/duration.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/proto_docs/google/protobuf/empty.rb b/google-cloud-retail-v2/proto_docs/google/protobuf/empty.rb index e63eb943257a..83e4481834a6 100644 --- a/google-cloud-retail-v2/proto_docs/google/protobuf/empty.rb +++ b/google-cloud-retail-v2/proto_docs/google/protobuf/empty.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/proto_docs/google/protobuf/field_mask.rb b/google-cloud-retail-v2/proto_docs/google/protobuf/field_mask.rb index 3db2d8f80bab..7f3ffc78601a 100644 --- a/google-cloud-retail-v2/proto_docs/google/protobuf/field_mask.rb +++ b/google-cloud-retail-v2/proto_docs/google/protobuf/field_mask.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/proto_docs/google/protobuf/struct.rb b/google-cloud-retail-v2/proto_docs/google/protobuf/struct.rb index e652d90148c0..39e1aca868d2 100644 --- a/google-cloud-retail-v2/proto_docs/google/protobuf/struct.rb +++ b/google-cloud-retail-v2/proto_docs/google/protobuf/struct.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/proto_docs/google/protobuf/timestamp.rb b/google-cloud-retail-v2/proto_docs/google/protobuf/timestamp.rb index 626cd5e0bf3a..e58202461f88 100644 --- a/google-cloud-retail-v2/proto_docs/google/protobuf/timestamp.rb +++ b/google-cloud-retail-v2/proto_docs/google/protobuf/timestamp.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -110,14 +110,15 @@ module Protobuf # ) to obtain a formatter capable of generating timestamps in this format. # @!attribute [rw] seconds # @return [::Integer] - # Represents seconds of UTC time since Unix epoch - # 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to - # 9999-12-31T23:59:59Z inclusive. + # Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must + # be between -315576000000 and 315576000000 inclusive (which corresponds to + # 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z). # @!attribute [rw] nanos # @return [::Integer] - # Non-negative fractions of a second at nanosecond resolution. Negative - # second values with fractions must still have non-negative nanos values - # that count forward in time. Must be from 0 to 999,999,999 + # Non-negative fractions of a second at nanosecond resolution. This field is + # the nanosecond portion of the duration, not an alternative to seconds. + # Negative second values with fractions must still have non-negative nanos + # values that count forward in time. Must be between 0 and 999,999,999 # inclusive. class Timestamp include ::Google::Protobuf::MessageExts diff --git a/google-cloud-retail-v2/proto_docs/google/protobuf/wrappers.rb b/google-cloud-retail-v2/proto_docs/google/protobuf/wrappers.rb index fe47f66f016f..9a7c0269fa42 100644 --- a/google-cloud-retail-v2/proto_docs/google/protobuf/wrappers.rb +++ b/google-cloud-retail-v2/proto_docs/google/protobuf/wrappers.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/proto_docs/google/rpc/status.rb b/google-cloud-retail-v2/proto_docs/google/rpc/status.rb index 1db3524e2da2..c1a1c07eb2db 100644 --- a/google-cloud-retail-v2/proto_docs/google/rpc/status.rb +++ b/google-cloud-retail-v2/proto_docs/google/rpc/status.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/proto_docs/google/type/date.rb b/google-cloud-retail-v2/proto_docs/google/type/date.rb index a7ce5a595a1e..a52275cebf89 100644 --- a/google-cloud-retail-v2/proto_docs/google/type/date.rb +++ b/google-cloud-retail-v2/proto_docs/google/type/date.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/Gemfile b/google-cloud-retail-v2/snippets/Gemfile index 2829239b01e7..d2cc0c1eb2ed 100755 --- a/google-cloud-retail-v2/snippets/Gemfile +++ b/google-cloud-retail-v2/snippets/Gemfile @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/analytics_service/export_analytics_metrics.rb b/google-cloud-retail-v2/snippets/analytics_service/export_analytics_metrics.rb index ffdeb5b8216c..f5249b7f1e32 100644 --- a/google-cloud-retail-v2/snippets/analytics_service/export_analytics_metrics.rb +++ b/google-cloud-retail-v2/snippets/analytics_service/export_analytics_metrics.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2024 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/catalog_service/add_catalog_attribute.rb b/google-cloud-retail-v2/snippets/catalog_service/add_catalog_attribute.rb index abed22f89464..dc85a92e6277 100644 --- a/google-cloud-retail-v2/snippets/catalog_service/add_catalog_attribute.rb +++ b/google-cloud-retail-v2/snippets/catalog_service/add_catalog_attribute.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2022 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/catalog_service/get_attributes_config.rb b/google-cloud-retail-v2/snippets/catalog_service/get_attributes_config.rb index ecb81a82bea0..cb21a1f8e879 100644 --- a/google-cloud-retail-v2/snippets/catalog_service/get_attributes_config.rb +++ b/google-cloud-retail-v2/snippets/catalog_service/get_attributes_config.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2022 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/catalog_service/get_completion_config.rb b/google-cloud-retail-v2/snippets/catalog_service/get_completion_config.rb index ec37713914a7..1668c703deda 100644 --- a/google-cloud-retail-v2/snippets/catalog_service/get_completion_config.rb +++ b/google-cloud-retail-v2/snippets/catalog_service/get_completion_config.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2022 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/catalog_service/get_default_branch.rb b/google-cloud-retail-v2/snippets/catalog_service/get_default_branch.rb index 094a7035fa06..a7c5c47a999d 100755 --- a/google-cloud-retail-v2/snippets/catalog_service/get_default_branch.rb +++ b/google-cloud-retail-v2/snippets/catalog_service/get_default_branch.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/catalog_service/list_catalogs.rb b/google-cloud-retail-v2/snippets/catalog_service/list_catalogs.rb index bc7b6d2ebfb6..27f668be91bd 100755 --- a/google-cloud-retail-v2/snippets/catalog_service/list_catalogs.rb +++ b/google-cloud-retail-v2/snippets/catalog_service/list_catalogs.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/catalog_service/remove_catalog_attribute.rb b/google-cloud-retail-v2/snippets/catalog_service/remove_catalog_attribute.rb index 6241839b6259..7e0a01dc5446 100644 --- a/google-cloud-retail-v2/snippets/catalog_service/remove_catalog_attribute.rb +++ b/google-cloud-retail-v2/snippets/catalog_service/remove_catalog_attribute.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2022 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/catalog_service/replace_catalog_attribute.rb b/google-cloud-retail-v2/snippets/catalog_service/replace_catalog_attribute.rb index ca16d3f531c3..7b7e35e9755b 100644 --- a/google-cloud-retail-v2/snippets/catalog_service/replace_catalog_attribute.rb +++ b/google-cloud-retail-v2/snippets/catalog_service/replace_catalog_attribute.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2022 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/catalog_service/set_default_branch.rb b/google-cloud-retail-v2/snippets/catalog_service/set_default_branch.rb index 450c750cf169..9c0d64022fa4 100755 --- a/google-cloud-retail-v2/snippets/catalog_service/set_default_branch.rb +++ b/google-cloud-retail-v2/snippets/catalog_service/set_default_branch.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/catalog_service/update_attributes_config.rb b/google-cloud-retail-v2/snippets/catalog_service/update_attributes_config.rb index 7c4c4f84f10a..1b5fc7f4253a 100644 --- a/google-cloud-retail-v2/snippets/catalog_service/update_attributes_config.rb +++ b/google-cloud-retail-v2/snippets/catalog_service/update_attributes_config.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2022 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/catalog_service/update_catalog.rb b/google-cloud-retail-v2/snippets/catalog_service/update_catalog.rb index bf2ec0c2308b..ea0eaa4f2b83 100755 --- a/google-cloud-retail-v2/snippets/catalog_service/update_catalog.rb +++ b/google-cloud-retail-v2/snippets/catalog_service/update_catalog.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/catalog_service/update_completion_config.rb b/google-cloud-retail-v2/snippets/catalog_service/update_completion_config.rb index 4a1ce94cf0bb..5d8036e6732d 100644 --- a/google-cloud-retail-v2/snippets/catalog_service/update_completion_config.rb +++ b/google-cloud-retail-v2/snippets/catalog_service/update_completion_config.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2022 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/completion_service/complete_query.rb b/google-cloud-retail-v2/snippets/completion_service/complete_query.rb index 87e1251f3a3c..874d7cee8d67 100755 --- a/google-cloud-retail-v2/snippets/completion_service/complete_query.rb +++ b/google-cloud-retail-v2/snippets/completion_service/complete_query.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/completion_service/import_completion_data.rb b/google-cloud-retail-v2/snippets/completion_service/import_completion_data.rb index 811ed5febbc6..fe1f28f0844e 100755 --- a/google-cloud-retail-v2/snippets/completion_service/import_completion_data.rb +++ b/google-cloud-retail-v2/snippets/completion_service/import_completion_data.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/control_service/create_control.rb b/google-cloud-retail-v2/snippets/control_service/create_control.rb index 9fe07332b4aa..32b89537acd9 100644 --- a/google-cloud-retail-v2/snippets/control_service/create_control.rb +++ b/google-cloud-retail-v2/snippets/control_service/create_control.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2022 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/control_service/delete_control.rb b/google-cloud-retail-v2/snippets/control_service/delete_control.rb index 486e220ee880..42aa73e1063a 100644 --- a/google-cloud-retail-v2/snippets/control_service/delete_control.rb +++ b/google-cloud-retail-v2/snippets/control_service/delete_control.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2022 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/control_service/get_control.rb b/google-cloud-retail-v2/snippets/control_service/get_control.rb index e2d6ab3d3a11..2785feb65202 100644 --- a/google-cloud-retail-v2/snippets/control_service/get_control.rb +++ b/google-cloud-retail-v2/snippets/control_service/get_control.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2022 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/control_service/list_controls.rb b/google-cloud-retail-v2/snippets/control_service/list_controls.rb index 81be17d68f42..7394fdd3076a 100644 --- a/google-cloud-retail-v2/snippets/control_service/list_controls.rb +++ b/google-cloud-retail-v2/snippets/control_service/list_controls.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2022 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/control_service/update_control.rb b/google-cloud-retail-v2/snippets/control_service/update_control.rb index 1658f87f39df..f3bf5821b03b 100644 --- a/google-cloud-retail-v2/snippets/control_service/update_control.rb +++ b/google-cloud-retail-v2/snippets/control_service/update_control.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2022 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/conversational_search_service/conversational_search.rb b/google-cloud-retail-v2/snippets/conversational_search_service/conversational_search.rb index a970c3d7663d..19ab711ac479 100644 --- a/google-cloud-retail-v2/snippets/conversational_search_service/conversational_search.rb +++ b/google-cloud-retail-v2/snippets/conversational_search_service/conversational_search.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/generative_question_service/batch_update_generative_question_configs.rb b/google-cloud-retail-v2/snippets/generative_question_service/batch_update_generative_question_configs.rb index eef20e224933..ec7f82414dea 100644 --- a/google-cloud-retail-v2/snippets/generative_question_service/batch_update_generative_question_configs.rb +++ b/google-cloud-retail-v2/snippets/generative_question_service/batch_update_generative_question_configs.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2024 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/generative_question_service/get_generative_questions_feature_config.rb b/google-cloud-retail-v2/snippets/generative_question_service/get_generative_questions_feature_config.rb index 5533961ca056..d9b400ceed6d 100644 --- a/google-cloud-retail-v2/snippets/generative_question_service/get_generative_questions_feature_config.rb +++ b/google-cloud-retail-v2/snippets/generative_question_service/get_generative_questions_feature_config.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2024 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/generative_question_service/list_generative_question_configs.rb b/google-cloud-retail-v2/snippets/generative_question_service/list_generative_question_configs.rb index 33c347b0a389..66d6f2d20042 100644 --- a/google-cloud-retail-v2/snippets/generative_question_service/list_generative_question_configs.rb +++ b/google-cloud-retail-v2/snippets/generative_question_service/list_generative_question_configs.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2024 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/generative_question_service/update_generative_question_config.rb b/google-cloud-retail-v2/snippets/generative_question_service/update_generative_question_config.rb index cb8180996f3d..73faa0a00347 100644 --- a/google-cloud-retail-v2/snippets/generative_question_service/update_generative_question_config.rb +++ b/google-cloud-retail-v2/snippets/generative_question_service/update_generative_question_config.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2024 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/generative_question_service/update_generative_questions_feature_config.rb b/google-cloud-retail-v2/snippets/generative_question_service/update_generative_questions_feature_config.rb index c2eb717527bd..edec3d61d8a8 100644 --- a/google-cloud-retail-v2/snippets/generative_question_service/update_generative_questions_feature_config.rb +++ b/google-cloud-retail-v2/snippets/generative_question_service/update_generative_questions_feature_config.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2024 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/model_service/create_model.rb b/google-cloud-retail-v2/snippets/model_service/create_model.rb index 275ca7f4dc2c..ffbfd59f4a13 100644 --- a/google-cloud-retail-v2/snippets/model_service/create_model.rb +++ b/google-cloud-retail-v2/snippets/model_service/create_model.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/model_service/delete_model.rb b/google-cloud-retail-v2/snippets/model_service/delete_model.rb index cad7354ed787..8a92e3fe6c8e 100644 --- a/google-cloud-retail-v2/snippets/model_service/delete_model.rb +++ b/google-cloud-retail-v2/snippets/model_service/delete_model.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/model_service/get_model.rb b/google-cloud-retail-v2/snippets/model_service/get_model.rb index e497c79c6882..8ca949873471 100644 --- a/google-cloud-retail-v2/snippets/model_service/get_model.rb +++ b/google-cloud-retail-v2/snippets/model_service/get_model.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/model_service/list_models.rb b/google-cloud-retail-v2/snippets/model_service/list_models.rb index 01310dd14df6..a652ccbdc26a 100644 --- a/google-cloud-retail-v2/snippets/model_service/list_models.rb +++ b/google-cloud-retail-v2/snippets/model_service/list_models.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/model_service/pause_model.rb b/google-cloud-retail-v2/snippets/model_service/pause_model.rb index 6499f4f72512..d563bf2a6c88 100644 --- a/google-cloud-retail-v2/snippets/model_service/pause_model.rb +++ b/google-cloud-retail-v2/snippets/model_service/pause_model.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/model_service/resume_model.rb b/google-cloud-retail-v2/snippets/model_service/resume_model.rb index 02f368183bb3..175e84817b36 100644 --- a/google-cloud-retail-v2/snippets/model_service/resume_model.rb +++ b/google-cloud-retail-v2/snippets/model_service/resume_model.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/model_service/tune_model.rb b/google-cloud-retail-v2/snippets/model_service/tune_model.rb index caa01884f825..8b60f30ed5ee 100644 --- a/google-cloud-retail-v2/snippets/model_service/tune_model.rb +++ b/google-cloud-retail-v2/snippets/model_service/tune_model.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/model_service/update_model.rb b/google-cloud-retail-v2/snippets/model_service/update_model.rb index 2bac5e51e330..0648bf6ab25e 100644 --- a/google-cloud-retail-v2/snippets/model_service/update_model.rb +++ b/google-cloud-retail-v2/snippets/model_service/update_model.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/prediction_service/predict.rb b/google-cloud-retail-v2/snippets/prediction_service/predict.rb index 52488e405b83..da0cc34c34ab 100755 --- a/google-cloud-retail-v2/snippets/prediction_service/predict.rb +++ b/google-cloud-retail-v2/snippets/prediction_service/predict.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/product_service/add_fulfillment_places.rb b/google-cloud-retail-v2/snippets/product_service/add_fulfillment_places.rb index 39b053be4a0a..4ec26b4419f7 100755 --- a/google-cloud-retail-v2/snippets/product_service/add_fulfillment_places.rb +++ b/google-cloud-retail-v2/snippets/product_service/add_fulfillment_places.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/product_service/add_local_inventories.rb b/google-cloud-retail-v2/snippets/product_service/add_local_inventories.rb index 24a90f4ab9a8..2f4627281ccb 100644 --- a/google-cloud-retail-v2/snippets/product_service/add_local_inventories.rb +++ b/google-cloud-retail-v2/snippets/product_service/add_local_inventories.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2022 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/product_service/create_product.rb b/google-cloud-retail-v2/snippets/product_service/create_product.rb index 7d2225df5d9b..4042ed4becf7 100755 --- a/google-cloud-retail-v2/snippets/product_service/create_product.rb +++ b/google-cloud-retail-v2/snippets/product_service/create_product.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/product_service/delete_product.rb b/google-cloud-retail-v2/snippets/product_service/delete_product.rb index 0bbf3f828b8b..6a95e9192bfa 100755 --- a/google-cloud-retail-v2/snippets/product_service/delete_product.rb +++ b/google-cloud-retail-v2/snippets/product_service/delete_product.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/product_service/get_product.rb b/google-cloud-retail-v2/snippets/product_service/get_product.rb index 11b5e2bfde43..72fa221658aa 100755 --- a/google-cloud-retail-v2/snippets/product_service/get_product.rb +++ b/google-cloud-retail-v2/snippets/product_service/get_product.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/product_service/import_products.rb b/google-cloud-retail-v2/snippets/product_service/import_products.rb index 4eae1c03bc81..1db99c203a0e 100755 --- a/google-cloud-retail-v2/snippets/product_service/import_products.rb +++ b/google-cloud-retail-v2/snippets/product_service/import_products.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/product_service/list_products.rb b/google-cloud-retail-v2/snippets/product_service/list_products.rb index 6bbf9bd5cc38..3c55a501794a 100755 --- a/google-cloud-retail-v2/snippets/product_service/list_products.rb +++ b/google-cloud-retail-v2/snippets/product_service/list_products.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/product_service/purge_products.rb b/google-cloud-retail-v2/snippets/product_service/purge_products.rb index 785ca27d81af..6ba93cc5c41b 100644 --- a/google-cloud-retail-v2/snippets/product_service/purge_products.rb +++ b/google-cloud-retail-v2/snippets/product_service/purge_products.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2024 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/product_service/remove_fulfillment_places.rb b/google-cloud-retail-v2/snippets/product_service/remove_fulfillment_places.rb index d68eda8fc551..7e48ed058cec 100755 --- a/google-cloud-retail-v2/snippets/product_service/remove_fulfillment_places.rb +++ b/google-cloud-retail-v2/snippets/product_service/remove_fulfillment_places.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/product_service/remove_local_inventories.rb b/google-cloud-retail-v2/snippets/product_service/remove_local_inventories.rb index 133a22e5e0da..348089c03910 100644 --- a/google-cloud-retail-v2/snippets/product_service/remove_local_inventories.rb +++ b/google-cloud-retail-v2/snippets/product_service/remove_local_inventories.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2022 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/product_service/set_inventory.rb b/google-cloud-retail-v2/snippets/product_service/set_inventory.rb index 5bec1ae856db..bae7bf9a57e5 100755 --- a/google-cloud-retail-v2/snippets/product_service/set_inventory.rb +++ b/google-cloud-retail-v2/snippets/product_service/set_inventory.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/product_service/update_product.rb b/google-cloud-retail-v2/snippets/product_service/update_product.rb index 149c88ad0dc8..36642534fa9e 100755 --- a/google-cloud-retail-v2/snippets/product_service/update_product.rb +++ b/google-cloud-retail-v2/snippets/product_service/update_product.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/search_service/search.rb b/google-cloud-retail-v2/snippets/search_service/search.rb index b49148dd7058..5dc88c9cf583 100755 --- a/google-cloud-retail-v2/snippets/search_service/search.rb +++ b/google-cloud-retail-v2/snippets/search_service/search.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/serving_config_service/add_control.rb b/google-cloud-retail-v2/snippets/serving_config_service/add_control.rb index 23f96f142e6e..220931b22733 100644 --- a/google-cloud-retail-v2/snippets/serving_config_service/add_control.rb +++ b/google-cloud-retail-v2/snippets/serving_config_service/add_control.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2022 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/serving_config_service/create_serving_config.rb b/google-cloud-retail-v2/snippets/serving_config_service/create_serving_config.rb index 6859b1925651..83294bf46733 100644 --- a/google-cloud-retail-v2/snippets/serving_config_service/create_serving_config.rb +++ b/google-cloud-retail-v2/snippets/serving_config_service/create_serving_config.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2022 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/serving_config_service/delete_serving_config.rb b/google-cloud-retail-v2/snippets/serving_config_service/delete_serving_config.rb index acba9d2607bb..40f9a2606fca 100644 --- a/google-cloud-retail-v2/snippets/serving_config_service/delete_serving_config.rb +++ b/google-cloud-retail-v2/snippets/serving_config_service/delete_serving_config.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2022 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/serving_config_service/get_serving_config.rb b/google-cloud-retail-v2/snippets/serving_config_service/get_serving_config.rb index 87624f09c0f8..c2f3df505c5f 100644 --- a/google-cloud-retail-v2/snippets/serving_config_service/get_serving_config.rb +++ b/google-cloud-retail-v2/snippets/serving_config_service/get_serving_config.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2022 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/serving_config_service/list_serving_configs.rb b/google-cloud-retail-v2/snippets/serving_config_service/list_serving_configs.rb index 1ae24fa34f1c..1c0c7dcdf923 100644 --- a/google-cloud-retail-v2/snippets/serving_config_service/list_serving_configs.rb +++ b/google-cloud-retail-v2/snippets/serving_config_service/list_serving_configs.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2022 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/serving_config_service/remove_control.rb b/google-cloud-retail-v2/snippets/serving_config_service/remove_control.rb index 3a6c319fc3fd..7917bea15485 100644 --- a/google-cloud-retail-v2/snippets/serving_config_service/remove_control.rb +++ b/google-cloud-retail-v2/snippets/serving_config_service/remove_control.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2022 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/serving_config_service/update_serving_config.rb b/google-cloud-retail-v2/snippets/serving_config_service/update_serving_config.rb index 24b53a0b117f..669a5bd2a303 100644 --- a/google-cloud-retail-v2/snippets/serving_config_service/update_serving_config.rb +++ b/google-cloud-retail-v2/snippets/serving_config_service/update_serving_config.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2022 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/user_event_service/collect_user_event.rb b/google-cloud-retail-v2/snippets/user_event_service/collect_user_event.rb index 36c2d9bdb56c..ee81b5ede9b4 100755 --- a/google-cloud-retail-v2/snippets/user_event_service/collect_user_event.rb +++ b/google-cloud-retail-v2/snippets/user_event_service/collect_user_event.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/user_event_service/import_user_events.rb b/google-cloud-retail-v2/snippets/user_event_service/import_user_events.rb index 3ff4fdbd29c0..4c20c5a126d4 100755 --- a/google-cloud-retail-v2/snippets/user_event_service/import_user_events.rb +++ b/google-cloud-retail-v2/snippets/user_event_service/import_user_events.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/user_event_service/purge_user_events.rb b/google-cloud-retail-v2/snippets/user_event_service/purge_user_events.rb index 482a449a1c04..7d7df5d779bd 100755 --- a/google-cloud-retail-v2/snippets/user_event_service/purge_user_events.rb +++ b/google-cloud-retail-v2/snippets/user_event_service/purge_user_events.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/user_event_service/rejoin_user_events.rb b/google-cloud-retail-v2/snippets/user_event_service/rejoin_user_events.rb index 556568a0e8d8..38e48c8b00d3 100755 --- a/google-cloud-retail-v2/snippets/user_event_service/rejoin_user_events.rb +++ b/google-cloud-retail-v2/snippets/user_event_service/rejoin_user_events.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/snippets/user_event_service/write_user_event.rb b/google-cloud-retail-v2/snippets/user_event_service/write_user_event.rb index 1d89cbd85650..e1946f8c6a8d 100755 --- a/google-cloud-retail-v2/snippets/user_event_service/write_user_event.rb +++ b/google-cloud-retail-v2/snippets/user_event_service/write_user_event.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/test/google/cloud/retail/v2/analytics_service_operations_test.rb b/google-cloud-retail-v2/test/google/cloud/retail/v2/analytics_service_operations_test.rb index fc6d30b0fd7b..66822830d222 100644 --- a/google-cloud-retail-v2/test/google/cloud/retail/v2/analytics_service_operations_test.rb +++ b/google-cloud-retail-v2/test/google/cloud/retail/v2/analytics_service_operations_test.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2024 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/test/google/cloud/retail/v2/analytics_service_rest_test.rb b/google-cloud-retail-v2/test/google/cloud/retail/v2/analytics_service_rest_test.rb index 342ffa50106c..28b40dfe1bfd 100644 --- a/google-cloud-retail-v2/test/google/cloud/retail/v2/analytics_service_rest_test.rb +++ b/google-cloud-retail-v2/test/google/cloud/retail/v2/analytics_service_rest_test.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2024 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/test/google/cloud/retail/v2/analytics_service_test.rb b/google-cloud-retail-v2/test/google/cloud/retail/v2/analytics_service_test.rb index a7e99fa77435..271b5dd21581 100644 --- a/google-cloud-retail-v2/test/google/cloud/retail/v2/analytics_service_test.rb +++ b/google-cloud-retail-v2/test/google/cloud/retail/v2/analytics_service_test.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2024 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/test/google/cloud/retail/v2/catalog_service_paths_test.rb b/google-cloud-retail-v2/test/google/cloud/retail/v2/catalog_service_paths_test.rb index 1e6011ac33cd..e107597737b1 100644 --- a/google-cloud-retail-v2/test/google/cloud/retail/v2/catalog_service_paths_test.rb +++ b/google-cloud-retail-v2/test/google/cloud/retail/v2/catalog_service_paths_test.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/test/google/cloud/retail/v2/catalog_service_rest_test.rb b/google-cloud-retail-v2/test/google/cloud/retail/v2/catalog_service_rest_test.rb index a402d9980780..b763a2854144 100644 --- a/google-cloud-retail-v2/test/google/cloud/retail/v2/catalog_service_rest_test.rb +++ b/google-cloud-retail-v2/test/google/cloud/retail/v2/catalog_service_rest_test.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/test/google/cloud/retail/v2/catalog_service_test.rb b/google-cloud-retail-v2/test/google/cloud/retail/v2/catalog_service_test.rb index fb24be544abb..78d3255c5df3 100644 --- a/google-cloud-retail-v2/test/google/cloud/retail/v2/catalog_service_test.rb +++ b/google-cloud-retail-v2/test/google/cloud/retail/v2/catalog_service_test.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/test/google/cloud/retail/v2/completion_service_operations_test.rb b/google-cloud-retail-v2/test/google/cloud/retail/v2/completion_service_operations_test.rb index df9ae6a42106..1fc78ca333ed 100644 --- a/google-cloud-retail-v2/test/google/cloud/retail/v2/completion_service_operations_test.rb +++ b/google-cloud-retail-v2/test/google/cloud/retail/v2/completion_service_operations_test.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/test/google/cloud/retail/v2/completion_service_paths_test.rb b/google-cloud-retail-v2/test/google/cloud/retail/v2/completion_service_paths_test.rb index 493630699c24..1fdf7e2de46a 100644 --- a/google-cloud-retail-v2/test/google/cloud/retail/v2/completion_service_paths_test.rb +++ b/google-cloud-retail-v2/test/google/cloud/retail/v2/completion_service_paths_test.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/test/google/cloud/retail/v2/completion_service_rest_test.rb b/google-cloud-retail-v2/test/google/cloud/retail/v2/completion_service_rest_test.rb index cdf603192722..2e1ef337e812 100644 --- a/google-cloud-retail-v2/test/google/cloud/retail/v2/completion_service_rest_test.rb +++ b/google-cloud-retail-v2/test/google/cloud/retail/v2/completion_service_rest_test.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/test/google/cloud/retail/v2/completion_service_test.rb b/google-cloud-retail-v2/test/google/cloud/retail/v2/completion_service_test.rb index bd8dc84ebd22..cfa7fce3193e 100644 --- a/google-cloud-retail-v2/test/google/cloud/retail/v2/completion_service_test.rb +++ b/google-cloud-retail-v2/test/google/cloud/retail/v2/completion_service_test.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/test/google/cloud/retail/v2/control_service_paths_test.rb b/google-cloud-retail-v2/test/google/cloud/retail/v2/control_service_paths_test.rb index 73ee13720c32..3a2ba3c8bc0f 100644 --- a/google-cloud-retail-v2/test/google/cloud/retail/v2/control_service_paths_test.rb +++ b/google-cloud-retail-v2/test/google/cloud/retail/v2/control_service_paths_test.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2022 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/test/google/cloud/retail/v2/control_service_rest_test.rb b/google-cloud-retail-v2/test/google/cloud/retail/v2/control_service_rest_test.rb index df98b2bac503..a01a2054149f 100644 --- a/google-cloud-retail-v2/test/google/cloud/retail/v2/control_service_rest_test.rb +++ b/google-cloud-retail-v2/test/google/cloud/retail/v2/control_service_rest_test.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/test/google/cloud/retail/v2/control_service_test.rb b/google-cloud-retail-v2/test/google/cloud/retail/v2/control_service_test.rb index d85a7de0bc94..91528d0ca0f7 100644 --- a/google-cloud-retail-v2/test/google/cloud/retail/v2/control_service_test.rb +++ b/google-cloud-retail-v2/test/google/cloud/retail/v2/control_service_test.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2022 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/test/google/cloud/retail/v2/conversational_search_service_paths_test.rb b/google-cloud-retail-v2/test/google/cloud/retail/v2/conversational_search_service_paths_test.rb index c0cbde3285de..fdef51260f2e 100644 --- a/google-cloud-retail-v2/test/google/cloud/retail/v2/conversational_search_service_paths_test.rb +++ b/google-cloud-retail-v2/test/google/cloud/retail/v2/conversational_search_service_paths_test.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/test/google/cloud/retail/v2/conversational_search_service_rest_test.rb b/google-cloud-retail-v2/test/google/cloud/retail/v2/conversational_search_service_rest_test.rb index c7212f3fea5e..6c3b9d2307b8 100644 --- a/google-cloud-retail-v2/test/google/cloud/retail/v2/conversational_search_service_rest_test.rb +++ b/google-cloud-retail-v2/test/google/cloud/retail/v2/conversational_search_service_rest_test.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/test/google/cloud/retail/v2/conversational_search_service_test.rb b/google-cloud-retail-v2/test/google/cloud/retail/v2/conversational_search_service_test.rb index 01e6f334ac70..01a7bfd250d9 100644 --- a/google-cloud-retail-v2/test/google/cloud/retail/v2/conversational_search_service_test.rb +++ b/google-cloud-retail-v2/test/google/cloud/retail/v2/conversational_search_service_test.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2025 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/test/google/cloud/retail/v2/generative_question_service_paths_test.rb b/google-cloud-retail-v2/test/google/cloud/retail/v2/generative_question_service_paths_test.rb index 799093d7abc1..453c3660b939 100644 --- a/google-cloud-retail-v2/test/google/cloud/retail/v2/generative_question_service_paths_test.rb +++ b/google-cloud-retail-v2/test/google/cloud/retail/v2/generative_question_service_paths_test.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2024 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/test/google/cloud/retail/v2/generative_question_service_rest_test.rb b/google-cloud-retail-v2/test/google/cloud/retail/v2/generative_question_service_rest_test.rb index 720899428a76..6fd27afd1cd0 100644 --- a/google-cloud-retail-v2/test/google/cloud/retail/v2/generative_question_service_rest_test.rb +++ b/google-cloud-retail-v2/test/google/cloud/retail/v2/generative_question_service_rest_test.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2024 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/test/google/cloud/retail/v2/generative_question_service_test.rb b/google-cloud-retail-v2/test/google/cloud/retail/v2/generative_question_service_test.rb index d9d8f035db96..402c20df7db6 100644 --- a/google-cloud-retail-v2/test/google/cloud/retail/v2/generative_question_service_test.rb +++ b/google-cloud-retail-v2/test/google/cloud/retail/v2/generative_question_service_test.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2024 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/test/google/cloud/retail/v2/model_service_operations_test.rb b/google-cloud-retail-v2/test/google/cloud/retail/v2/model_service_operations_test.rb index d7e2935c153f..a570cdc85e06 100644 --- a/google-cloud-retail-v2/test/google/cloud/retail/v2/model_service_operations_test.rb +++ b/google-cloud-retail-v2/test/google/cloud/retail/v2/model_service_operations_test.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/test/google/cloud/retail/v2/model_service_paths_test.rb b/google-cloud-retail-v2/test/google/cloud/retail/v2/model_service_paths_test.rb index bb4287a8c0ca..f077beeed1ed 100644 --- a/google-cloud-retail-v2/test/google/cloud/retail/v2/model_service_paths_test.rb +++ b/google-cloud-retail-v2/test/google/cloud/retail/v2/model_service_paths_test.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/test/google/cloud/retail/v2/model_service_rest_test.rb b/google-cloud-retail-v2/test/google/cloud/retail/v2/model_service_rest_test.rb index 52115fd89902..05afd9235f1a 100644 --- a/google-cloud-retail-v2/test/google/cloud/retail/v2/model_service_rest_test.rb +++ b/google-cloud-retail-v2/test/google/cloud/retail/v2/model_service_rest_test.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/test/google/cloud/retail/v2/model_service_test.rb b/google-cloud-retail-v2/test/google/cloud/retail/v2/model_service_test.rb index b28a826159d8..c512995eb660 100644 --- a/google-cloud-retail-v2/test/google/cloud/retail/v2/model_service_test.rb +++ b/google-cloud-retail-v2/test/google/cloud/retail/v2/model_service_test.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/test/google/cloud/retail/v2/prediction_service_paths_test.rb b/google-cloud-retail-v2/test/google/cloud/retail/v2/prediction_service_paths_test.rb index 8b2ad7dcc4c6..531290668702 100644 --- a/google-cloud-retail-v2/test/google/cloud/retail/v2/prediction_service_paths_test.rb +++ b/google-cloud-retail-v2/test/google/cloud/retail/v2/prediction_service_paths_test.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/test/google/cloud/retail/v2/prediction_service_rest_test.rb b/google-cloud-retail-v2/test/google/cloud/retail/v2/prediction_service_rest_test.rb index 8c33ba176b07..6f32476ef660 100644 --- a/google-cloud-retail-v2/test/google/cloud/retail/v2/prediction_service_rest_test.rb +++ b/google-cloud-retail-v2/test/google/cloud/retail/v2/prediction_service_rest_test.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/test/google/cloud/retail/v2/prediction_service_test.rb b/google-cloud-retail-v2/test/google/cloud/retail/v2/prediction_service_test.rb index e5e9dfd35897..3d5ed0aafaaa 100644 --- a/google-cloud-retail-v2/test/google/cloud/retail/v2/prediction_service_test.rb +++ b/google-cloud-retail-v2/test/google/cloud/retail/v2/prediction_service_test.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/test/google/cloud/retail/v2/product_service_operations_test.rb b/google-cloud-retail-v2/test/google/cloud/retail/v2/product_service_operations_test.rb index 56a6a1180276..6aaed25a5816 100644 --- a/google-cloud-retail-v2/test/google/cloud/retail/v2/product_service_operations_test.rb +++ b/google-cloud-retail-v2/test/google/cloud/retail/v2/product_service_operations_test.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/test/google/cloud/retail/v2/product_service_paths_test.rb b/google-cloud-retail-v2/test/google/cloud/retail/v2/product_service_paths_test.rb index 01a4242f6b90..b58df28b3831 100644 --- a/google-cloud-retail-v2/test/google/cloud/retail/v2/product_service_paths_test.rb +++ b/google-cloud-retail-v2/test/google/cloud/retail/v2/product_service_paths_test.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/test/google/cloud/retail/v2/product_service_rest_test.rb b/google-cloud-retail-v2/test/google/cloud/retail/v2/product_service_rest_test.rb index f8377271c2bb..b362952cd6c4 100644 --- a/google-cloud-retail-v2/test/google/cloud/retail/v2/product_service_rest_test.rb +++ b/google-cloud-retail-v2/test/google/cloud/retail/v2/product_service_rest_test.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/test/google/cloud/retail/v2/product_service_test.rb b/google-cloud-retail-v2/test/google/cloud/retail/v2/product_service_test.rb index cd0eaa50b0f3..c4620093e075 100644 --- a/google-cloud-retail-v2/test/google/cloud/retail/v2/product_service_test.rb +++ b/google-cloud-retail-v2/test/google/cloud/retail/v2/product_service_test.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/test/google/cloud/retail/v2/search_service_paths_test.rb b/google-cloud-retail-v2/test/google/cloud/retail/v2/search_service_paths_test.rb index b7b660275db5..666f380e368d 100644 --- a/google-cloud-retail-v2/test/google/cloud/retail/v2/search_service_paths_test.rb +++ b/google-cloud-retail-v2/test/google/cloud/retail/v2/search_service_paths_test.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/test/google/cloud/retail/v2/search_service_rest_test.rb b/google-cloud-retail-v2/test/google/cloud/retail/v2/search_service_rest_test.rb index af8933ac4156..a800cefe2ac7 100644 --- a/google-cloud-retail-v2/test/google/cloud/retail/v2/search_service_rest_test.rb +++ b/google-cloud-retail-v2/test/google/cloud/retail/v2/search_service_rest_test.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/test/google/cloud/retail/v2/search_service_test.rb b/google-cloud-retail-v2/test/google/cloud/retail/v2/search_service_test.rb index e74933a5a9b3..ba77fbd1cd82 100644 --- a/google-cloud-retail-v2/test/google/cloud/retail/v2/search_service_test.rb +++ b/google-cloud-retail-v2/test/google/cloud/retail/v2/search_service_test.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/test/google/cloud/retail/v2/serving_config_service_paths_test.rb b/google-cloud-retail-v2/test/google/cloud/retail/v2/serving_config_service_paths_test.rb index f77c3d6d71b2..68252813b8a3 100644 --- a/google-cloud-retail-v2/test/google/cloud/retail/v2/serving_config_service_paths_test.rb +++ b/google-cloud-retail-v2/test/google/cloud/retail/v2/serving_config_service_paths_test.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2022 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/test/google/cloud/retail/v2/serving_config_service_rest_test.rb b/google-cloud-retail-v2/test/google/cloud/retail/v2/serving_config_service_rest_test.rb index 990d8ba9f290..448a287af110 100644 --- a/google-cloud-retail-v2/test/google/cloud/retail/v2/serving_config_service_rest_test.rb +++ b/google-cloud-retail-v2/test/google/cloud/retail/v2/serving_config_service_rest_test.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/test/google/cloud/retail/v2/serving_config_service_test.rb b/google-cloud-retail-v2/test/google/cloud/retail/v2/serving_config_service_test.rb index 784cb7c47d94..6715965a490e 100644 --- a/google-cloud-retail-v2/test/google/cloud/retail/v2/serving_config_service_test.rb +++ b/google-cloud-retail-v2/test/google/cloud/retail/v2/serving_config_service_test.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2022 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/test/google/cloud/retail/v2/user_event_service_operations_test.rb b/google-cloud-retail-v2/test/google/cloud/retail/v2/user_event_service_operations_test.rb index ded823a6e938..a0bcbc887f9f 100644 --- a/google-cloud-retail-v2/test/google/cloud/retail/v2/user_event_service_operations_test.rb +++ b/google-cloud-retail-v2/test/google/cloud/retail/v2/user_event_service_operations_test.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/test/google/cloud/retail/v2/user_event_service_paths_test.rb b/google-cloud-retail-v2/test/google/cloud/retail/v2/user_event_service_paths_test.rb index 7b50ee2a7898..359bdf51e611 100644 --- a/google-cloud-retail-v2/test/google/cloud/retail/v2/user_event_service_paths_test.rb +++ b/google-cloud-retail-v2/test/google/cloud/retail/v2/user_event_service_paths_test.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/test/google/cloud/retail/v2/user_event_service_rest_test.rb b/google-cloud-retail-v2/test/google/cloud/retail/v2/user_event_service_rest_test.rb index 32b199fc5e9b..91464499cee3 100644 --- a/google-cloud-retail-v2/test/google/cloud/retail/v2/user_event_service_rest_test.rb +++ b/google-cloud-retail-v2/test/google/cloud/retail/v2/user_event_service_rest_test.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2023 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/test/google/cloud/retail/v2/user_event_service_test.rb b/google-cloud-retail-v2/test/google/cloud/retail/v2/user_event_service_test.rb index fe2c9537de31..9b8c7aae2a75 100644 --- a/google-cloud-retail-v2/test/google/cloud/retail/v2/user_event_service_test.rb +++ b/google-cloud-retail-v2/test/google/cloud/retail/v2/user_event_service_test.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google-cloud-retail-v2/test/helper.rb b/google-cloud-retail-v2/test/helper.rb index 9ead73a4e10a..4fb6756ac7e2 100644 --- a/google-cloud-retail-v2/test/helper.rb +++ b/google-cloud-retail-v2/test/helper.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Copyright 2021 Google LLC +# Copyright 2026 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/owl-bot-staging/google-cloud-retail-v2/.gitignore b/owl-bot-staging/google-cloud-retail-v2/.gitignore deleted file mode 100644 index a2e97ac84259..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/.gitignore +++ /dev/null @@ -1,20 +0,0 @@ -gems.locked - -# Ignore documentation output -doc/* -.yardoc/* - -# Ignore test output -coverage/* - -# Ignore build artifacts -pkg/* - -# Ignore files commonly present in certain dev environments -.vagrant -.DS_STORE -.idea -*.iml - -# Ignore synth output -__pycache__ diff --git a/owl-bot-staging/google-cloud-retail-v2/.repo-metadata.json b/owl-bot-staging/google-cloud-retail-v2/.repo-metadata.json deleted file mode 100644 index 034a00868333..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/.repo-metadata.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "api_id": "retail.googleapis.com", - "api_shortname": "retail", - "client_documentation": "https://cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest", - "distribution_name": "google-cloud-retail-v2", - "is_cloud": true, - "language": "ruby", - "name": "retail", - "name_pretty": "Retail V2 API", - "product_documentation": "https://cloud.google.com/retail/docs/apis", - "release_level": "unreleased", - "repo": "googleapis/google-cloud-ruby", - "requires_billing": true, - "ruby-cloud-description": "Retail enables you to build an end-to-end personalized recommendation system based on state-of-the-art deep learning ML models, without a need for expertise in ML or recommendation systems. Note that google-cloud-retail-v2 is a version-specific client library. For most uses, we recommend installing the main client library google-cloud-retail instead. See the readme for more details.", - "ruby-cloud-env-prefix": "RETAIL", - "ruby-cloud-product-url": "https://cloud.google.com/retail/docs/apis", - "library_type": "GAPIC_AUTO" -} diff --git a/owl-bot-staging/google-cloud-retail-v2/.rubocop.yml b/owl-bot-staging/google-cloud-retail-v2/.rubocop.yml deleted file mode 100644 index def961aa4ee5..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/.rubocop.yml +++ /dev/null @@ -1,33 +0,0 @@ -inherit_gem: - google-style: google-style.yml - -AllCops: - Exclude: - - "google-cloud-retail-v2.gemspec" - - "lib/**/*_pb.rb" - - "proto_docs/**/*" - - "test/**/*" - - "acceptance/**/*" - - "samples/acceptance/**/*" - - "Rakefile" - -Layout/LineLength: - Enabled: false -Metrics/AbcSize: - Enabled: false -Metrics/ClassLength: - Enabled: false -Metrics/CyclomaticComplexity: - Enabled: false -Metrics/MethodLength: - Enabled: false -Metrics/ModuleLength: - Enabled: false -Metrics/PerceivedComplexity: - Enabled: false -Naming/AccessorMethodName: - Exclude: - - "snippets/**/*.rb" -Naming/FileName: - Exclude: - - "lib/google-cloud-retail-v2.rb" diff --git a/owl-bot-staging/google-cloud-retail-v2/.toys.rb b/owl-bot-staging/google-cloud-retail-v2/.toys.rb deleted file mode 100644 index 177e22456e8a..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/.toys.rb +++ /dev/null @@ -1,28 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -toys_version! ">= 0.15.3" - -if ENV["RUBY_COMMON_TOOLS"] - common_tools_dir = File.expand_path ENV["RUBY_COMMON_TOOLS"] - load File.join(common_tools_dir, "toys", "gapic") -else - load_git remote: "https://github.com/googleapis/ruby-common-tools.git", - path: "toys/gapic", - update: true -end diff --git a/owl-bot-staging/google-cloud-retail-v2/.yardopts b/owl-bot-staging/google-cloud-retail-v2/.yardopts deleted file mode 100644 index 038190b897cc..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/.yardopts +++ /dev/null @@ -1,12 +0,0 @@ ---no-private ---title="Retail V2 API" ---exclude _pb\.rb$ ---markup markdown ---markup-provider redcarpet - -./lib/**/*.rb -./proto_docs/**/*.rb -- -README.md -LICENSE.md -AUTHENTICATION.md diff --git a/owl-bot-staging/google-cloud-retail-v2/AUTHENTICATION.md b/owl-bot-staging/google-cloud-retail-v2/AUTHENTICATION.md deleted file mode 100644 index 8862a3fae853..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/AUTHENTICATION.md +++ /dev/null @@ -1,122 +0,0 @@ -# Authentication - -The recommended way to authenticate to the google-cloud-retail-v2 library is to use -[Application Default Credentials (ADC)](https://cloud.google.com/docs/authentication/application-default-credentials). -To review all of your authentication options, see [Credentials lookup](#credential-lookup). - -## Quickstart - -The following example shows how to set up authentication for a local development -environment with your user credentials. - -**NOTE:** This method is _not_ recommended for running in production. User credentials -should be used only during development. - -1. [Download and install the Google Cloud CLI](https://cloud.google.com/sdk). -2. Set up a local ADC file with your user credentials: - -```sh -gcloud auth application-default login -``` - -3. Write code as if already authenticated. - -For more information about setting up authentication for a local development environment, see -[Set up Application Default Credentials](https://cloud.google.com/docs/authentication/provide-credentials-adc#local-dev). - -## Credential Lookup - -The google-cloud-retail-v2 library provides several mechanisms to configure your system. -Generally, using Application Default Credentials to facilitate automatic -credentials discovery is the easist method. But if you need to explicitly specify -credentials, there are several methods available to you. - -Credentials are accepted in the following ways, in the following order or precedence: - -1. Credentials specified in method arguments -2. Credentials specified in configuration -3. Credentials pointed to or included in environment variables -4. Credentials found in local ADC file -5. Credentials returned by the metadata server for the attached service account (GCP) - -### Configuration - -You can configure a path to a JSON credentials file, either for an individual client object or -globally, for all client objects. The JSON file can contain credentials created for -[workload identity federation](https://cloud.google.com/iam/docs/workload-identity-federation), -[workforce identity federation](https://cloud.google.com/iam/docs/workforce-identity-federation), or a -[service account key](https://cloud.google.com/docs/authentication/provide-credentials-adc#local-key). - -Note: Service account keys are a security risk if not managed correctly. You should -[choose a more secure alternative to service account keys](https://cloud.google.com/docs/authentication#auth-decision-tree) -whenever possible. - -To configure a credentials file for an individual client initialization: - -```ruby -require "google/cloud/retail/v2" - -client = ::Google::Cloud::Retail::V2::AnalyticsService::Client.new do |config| - config.credentials = "path/to/credentialfile.json" -end -``` - -To configure a credentials file globally for all clients: - -```ruby -require "google/cloud/retail/v2" - -::Google::Cloud::Retail::V2::AnalyticsService::Client.configure do |config| - config.credentials = "path/to/credentialfile.json" -end - -client = ::Google::Cloud::Retail::V2::AnalyticsService::Client.new -``` - -### Environment Variables - -You can also use an environment variable to provide a JSON credentials file. -The environment variable can contain a path to the credentials file or, for -environments such as Docker containers where writing files is not encouraged, -you can include the credentials file itself. - -The JSON file can contain credentials created for -[workload identity federation](https://cloud.google.com/iam/docs/workload-identity-federation), -[workforce identity federation](https://cloud.google.com/iam/docs/workforce-identity-federation), or a -[service account key](https://cloud.google.com/docs/authentication/provide-credentials-adc#local-key). - -Note: Service account keys are a security risk if not managed correctly. You should -[choose a more secure alternative to service account keys](https://cloud.google.com/docs/authentication#auth-decision-tree) -whenever possible. - -The environment variables that google-cloud-retail-v2 -checks for credentials are: - -* `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents -* `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file - -```ruby -require "google/cloud/retail/v2" - -ENV["GOOGLE_APPLICATION_CREDENTIALS"] = "path/to/credentialfile.json" - -client = ::Google::Cloud::Retail::V2::AnalyticsService::Client.new -``` - -### Local ADC file - -You can set up a local ADC file with your user credentials for authentication during -development. If credentials are not provided in code or in environment variables, -then the local ADC credentials are discovered. - -Follow the steps in [Quickstart](#quickstart) to set up a local ADC file. - -### Google Cloud Platform environments - -When running on Google Cloud Platform (GCP), including Google Compute Engine -(GCE), Google Kubernetes Engine (GKE), Google App Engine (GAE), Google Cloud -Functions (GCF) and Cloud Run, credentials are retrieved from the attached -service account automatically. Code should be written as if already authenticated. - -For more information, see -[Set up ADC for Google Cloud services](https://cloud.google.com/docs/authentication/provide-credentials-adc#attached-sa). diff --git a/owl-bot-staging/google-cloud-retail-v2/CHANGELOG.md b/owl-bot-staging/google-cloud-retail-v2/CHANGELOG.md deleted file mode 100644 index f88957a62ba2..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Release History - diff --git a/owl-bot-staging/google-cloud-retail-v2/Gemfile b/owl-bot-staging/google-cloud-retail-v2/Gemfile deleted file mode 100644 index 823c136ec3c0..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/Gemfile +++ /dev/null @@ -1,15 +0,0 @@ -source "https://rubygems.org" - -gemspec - -gem "google-style", "~> 1.32.0" -gem "irb", "~> 1.17" -gem "minitest", "~> 6.0.2" -gem "minitest-focus", "~> 1.4" -gem "minitest-mock", "~> 5.27" -gem "minitest-reporters", "~> 1.8.0", require: false -gem "minitest-rg", "~> 5.3" -gem "ostruct", "~> 0.5.5" -gem "rake", ">= 13.0" -gem "redcarpet", "~> 3.6" -gem "yard", "~> 0.9" diff --git a/owl-bot-staging/google-cloud-retail-v2/LICENSE.md b/owl-bot-staging/google-cloud-retail-v2/LICENSE.md deleted file mode 100644 index c261857ba6ad..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/LICENSE.md +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/owl-bot-staging/google-cloud-retail-v2/README.md b/owl-bot-staging/google-cloud-retail-v2/README.md deleted file mode 100644 index 43e25a86caf7..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/README.md +++ /dev/null @@ -1,154 +0,0 @@ -# Ruby Client for the Retail V2 API - -AI Commerce Search API is made up of Search, Browse and Recommendations. These discovery AI solutions help you implement personalized search, browse and recommendations, based on machine learning models, across your websites and mobile applications. - -Retail enables you to build an end-to-end personalized recommendation system based on state-of-the-art deep learning ML models, without a need for expertise in ML or recommendation systems. - -https://github.com/googleapis/google-cloud-ruby - -This gem is a _versioned_ client. It provides basic client classes for a -specific version of the Retail V2 API. Most users should consider using -the main client gem, -[google-cloud-retail](https://rubygems.org/gems/google-cloud-retail). -See the section below titled *Which client should I use?* for more information. - -## Installation - -``` -$ gem install google-cloud-retail-v2 -``` - -## Before You Begin - -In order to use this library, you first need to go through the following steps: - -1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project) -1. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project) -1. [Enable the API.](https://console.cloud.google.com/apis/library/retail.googleapis.com) -1. [Set up authentication.](AUTHENTICATION.md) - -## Quick Start - -```ruby -require "google/cloud/retail/v2" - -client = ::Google::Cloud::Retail::V2::AnalyticsService::Client.new -request = ::Google::Cloud::Retail::V2::ExportAnalyticsMetricsRequest.new # (request fields as keyword arguments...) -response = client.export_analytics_metrics request -``` - -View the [Client Library Documentation](https://cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest) -for class and method documentation. - -See also the [Product Documentation](https://cloud.google.com/retail/docs/apis) -for general usage information. - -## Debug Logging - -This library comes with opt-in Debug Logging that can help you troubleshoot -your application's integration with the API. When logging is activated, key -events such as requests and responses, along with data payloads and metadata -such as headers and client configuration, are logged to the standard error -stream. - -**WARNING:** Client Library Debug Logging includes your data payloads in -plaintext, which could include sensitive data such as PII for yourself or your -customers, private keys, or other security data that could be compromising if -leaked. Always practice good data hygiene with your application logs, and follow -the principle of least access. Google also recommends that Client Library Debug -Logging be enabled only temporarily during active debugging, and not used -permanently in production. - -To enable logging, set the environment variable `GOOGLE_SDK_RUBY_LOGGING_GEMS` -to the value `all`. Alternatively, you can set the value to a comma-delimited -list of client library gem names. This will select the default logging behavior, -which writes logs to the standard error stream. On a local workstation, this may -result in logs appearing on the console. When running on a Google Cloud hosting -service such as [Google Cloud Run](https://cloud.google.com/run), this generally -results in logs appearing alongside your application logs in the -[Google Cloud Logging](https://cloud.google.com/logging/) service. - -You can customize logging by modifying the `logger` configuration when -constructing a client object. For example: - -```ruby -require "google/cloud/retail/v2" -require "logger" - -client = ::Google::Cloud::Retail::V2::AnalyticsService::Client.new do |config| - config.logger = Logger.new "my-app.log" -end -``` - -## Google Cloud Samples - -To browse ready to use code samples check [Google Cloud Samples](https://cloud.google.com/docs/samples). - -## Supported Ruby Versions - -This library is supported on Ruby 3.2+. - -Google provides official support for Ruby versions that are actively supported -by Ruby Core—that is, Ruby versions that are either in normal maintenance or -in security maintenance, and not end of life. Older versions of Ruby _may_ -still work, but are unsupported and not recommended. See -https://www.ruby-lang.org/en/downloads/branches/ for details about the Ruby -support schedule. - -## Which client should I use? - -Most modern Ruby client libraries for Google APIs come in two flavors: the main -client library with a name such as `google-cloud-retail`, -and lower-level _versioned_ client libraries with names such as -`google-cloud-retail-v2`. -_In most cases, you should install the main client._ - -### What's the difference between the main client and a versioned client? - -A _versioned client_ provides a basic set of data types and client classes for -a _single version_ of a specific service. (That is, for a service with multiple -versions, there might be a separate versioned client for each service version.) -Most versioned clients are written and maintained by a code generator. - -The _main client_ is designed to provide you with the _recommended_ client -interfaces for the service. There will be only one main client for any given -service, even a service with multiple versions. The main client includes -factory methods for constructing the client objects we recommend for most -users. In some cases, those will be classes provided by an underlying versioned -client; in other cases, they will be handwritten higher-level client objects -with additional capabilities, convenience methods, or best practices built in. -Generally, the main client will default to a recommended service version, -although in some cases you can override this if you need to talk to a specific -service version. - -### Why would I want to use the main client? - -We recommend that most users install the main client gem for a service. You can -identify this gem as the one _without_ a version in its name, e.g. -`google-cloud-retail`. -The main client is recommended because it will embody the best practices for -accessing the service, and may also provide more convenient interfaces or -tighter integration into frameworks and third-party libraries. In addition, the -documentation and samples published by Google will generally demonstrate use of -the main client. - -### Why would I want to use a versioned client? - -You can use a versioned client if you are content with a possibly lower-level -class interface, you explicitly want to avoid features provided by the main -client, or you want to access a specific service version not be covered by the -main client. You can identify versioned client gems because the service version -is part of the name, e.g. `google-cloud-retail-v2`. - -### What about the google-apis- clients? - -Client library gems with names that begin with `google-apis-` are based on an -older code generation technology. They talk to a REST/JSON backend (whereas -most modern clients talk to a [gRPC](https://grpc.io/) backend) and they may -not offer the same performance, features, and ease of use provided by more -modern clients. - -The `google-apis-` clients have wide coverage across Google services, so you -might need to use one if there is no modern client available for the service. -However, if a modern client is available, we generally recommend it over the -older `google-apis-` clients. diff --git a/owl-bot-staging/google-cloud-retail-v2/Rakefile b/owl-bot-staging/google-cloud-retail-v2/Rakefile deleted file mode 100644 index b4e6091ef9cd..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/Rakefile +++ /dev/null @@ -1,169 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "bundler/setup" -require "bundler/gem_tasks" - -require "rubocop/rake_task" -RuboCop::RakeTask.new - -require "rake/testtask" -desc "Run tests." -Rake::TestTask.new do |t| - t.libs << "test" - t.test_files = FileList["test/**/*_test.rb"] - t.warning = false -end - -desc "Runs the smoke tests." -Rake::TestTask.new :smoke_test do |t| - t.test_files = FileList["acceptance/**/*smoke_test.rb"] - t.warning = false -end - -# Acceptance tests -desc "Run the google-cloud-retail-v2 acceptance tests." -task :acceptance, :project, :keyfile do |t, args| - project = args[:project] - project ||= - ENV["RETAIL_TEST_PROJECT"] || - ENV["GCLOUD_TEST_PROJECT"] - keyfile = args[:keyfile] - keyfile ||= - ENV["RETAIL_TEST_KEYFILE"] || - ENV["GCLOUD_TEST_KEYFILE"] - if keyfile - keyfile = File.read keyfile - else - keyfile ||= - ENV["RETAIL_TEST_KEYFILE_JSON"] || - ENV["GCLOUD_TEST_KEYFILE_JSON"] - end - if project.nil? || keyfile.nil? - fail "You must provide a project and keyfile. e.g. rake acceptance[test123, /path/to/keyfile.json] or RETAIL_TEST_PROJECT=test123 RETAIL_TEST_KEYFILE=/path/to/keyfile.json rake acceptance" - end - require "google/cloud/retail/v2/analytics_service/credentials" - ::Google::Cloud::Retail::V2::AnalyticsService::Credentials.env_vars.each do |path| - ENV[path] = nil - end - ENV["RETAIL_PROJECT"] = project - ENV["RETAIL_TEST_PROJECT"] = project - ENV["RETAIL_KEYFILE_JSON"] = keyfile - - Rake::Task["acceptance:run"].invoke -end - -namespace :acceptance do - task :run do - if File.directory? "acceptance" - Rake::Task[:smoke_test].invoke - else - puts "The google-cloud-retail-v2 gem has no acceptance tests." - end - end - - desc "Run acceptance cleanup." - task :cleanup do - end -end - -task :samples do - Rake::Task["samples:latest"].invoke -end - -namespace :samples do - task :latest do - if File.directory? "samples" - Dir.chdir "samples" do - Bundler.with_clean_env do - ENV["GOOGLE_CLOUD_SAMPLES_TEST"] = "not_master" - sh "bundle update" - sh "bundle exec rake test" - end - end - else - puts "The google-cloud-retail-v2 gem has no samples to test." - end - end - - task :master do - if File.directory? "samples" - Dir.chdir "samples" do - Bundler.with_clean_env do - ENV["GOOGLE_CLOUD_SAMPLES_TEST"] = "master" - sh "bundle update" - sh "bundle exec rake test" - end - end - else - puts "The google-cloud-retail-v2 gem has no samples to test." - end - end -end - -require "yard" -require "yard/rake/yardoc_task" -YARD::Rake::YardocTask.new do |y| - y.options << "--fail-on-warning" -end - -desc "Run yard-doctest example tests." -task :doctest do - puts "The google-cloud-retail-v2 gem does not have doctest tests." -end - -desc "Run the CI build" -task :ci do - header "BUILDING google-cloud-retail-v2" - header "google-cloud-retail-v2 rubocop", "*" - Rake::Task[:rubocop].invoke - header "google-cloud-retail-v2 yard", "*" - Rake::Task[:yard].invoke - header "google-cloud-retail-v2 test", "*" - Rake::Task[:test].invoke -end - -namespace :ci do - desc "Run the CI build, with smoke tests." - task :smoke_test do - Rake::Task[:ci].invoke - header "google-cloud-retail-v2 smoke_test", "*" - Rake::Task[:smoke_test].invoke - end - desc "Run the CI build, with acceptance tests." - task :acceptance do - Rake::Task[:ci].invoke - header "google-cloud-retail-v2 acceptance", "*" - Rake::Task[:acceptance].invoke - end - task :a do - # This is a handy shortcut to save typing - Rake::Task["ci:acceptance"].invoke - end -end - -task default: :test - -def header str, token = "#" - line_length = str.length + 8 - puts "" - puts token * line_length - puts "#{token * 3} #{str} #{token * 3}" - puts token * line_length - puts "" -end diff --git a/owl-bot-staging/google-cloud-retail-v2/gapic_metadata.json b/owl-bot-staging/google-cloud-retail-v2/gapic_metadata.json deleted file mode 100644 index d2b8ccdd6732..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/gapic_metadata.json +++ /dev/null @@ -1,412 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "ruby", - "protoPackage": "google.cloud.retail.v2", - "libraryPackage": "::Google::Cloud::Retail::V2", - "services": { - "AnalyticsService": { - "clients": { - "grpc": { - "libraryClient": "::Google::Cloud::Retail::V2::AnalyticsService::Client", - "rpcs": { - "ExportAnalyticsMetrics": { - "methods": [ - "export_analytics_metrics" - ] - } - } - } - } - }, - "CatalogService": { - "clients": { - "grpc": { - "libraryClient": "::Google::Cloud::Retail::V2::CatalogService::Client", - "rpcs": { - "ListCatalogs": { - "methods": [ - "list_catalogs" - ] - }, - "UpdateCatalog": { - "methods": [ - "update_catalog" - ] - }, - "SetDefaultBranch": { - "methods": [ - "set_default_branch" - ] - }, - "GetDefaultBranch": { - "methods": [ - "get_default_branch" - ] - }, - "GetCompletionConfig": { - "methods": [ - "get_completion_config" - ] - }, - "UpdateCompletionConfig": { - "methods": [ - "update_completion_config" - ] - }, - "GetAttributesConfig": { - "methods": [ - "get_attributes_config" - ] - }, - "UpdateAttributesConfig": { - "methods": [ - "update_attributes_config" - ] - }, - "AddCatalogAttribute": { - "methods": [ - "add_catalog_attribute" - ] - }, - "RemoveCatalogAttribute": { - "methods": [ - "remove_catalog_attribute" - ] - }, - "ReplaceCatalogAttribute": { - "methods": [ - "replace_catalog_attribute" - ] - } - } - } - } - }, - "CompletionService": { - "clients": { - "grpc": { - "libraryClient": "::Google::Cloud::Retail::V2::CompletionService::Client", - "rpcs": { - "CompleteQuery": { - "methods": [ - "complete_query" - ] - }, - "ImportCompletionData": { - "methods": [ - "import_completion_data" - ] - } - } - } - } - }, - "ControlService": { - "clients": { - "grpc": { - "libraryClient": "::Google::Cloud::Retail::V2::ControlService::Client", - "rpcs": { - "CreateControl": { - "methods": [ - "create_control" - ] - }, - "DeleteControl": { - "methods": [ - "delete_control" - ] - }, - "UpdateControl": { - "methods": [ - "update_control" - ] - }, - "GetControl": { - "methods": [ - "get_control" - ] - }, - "ListControls": { - "methods": [ - "list_controls" - ] - } - } - } - } - }, - "SearchService": { - "clients": { - "grpc": { - "libraryClient": "::Google::Cloud::Retail::V2::SearchService::Client", - "rpcs": { - "Search": { - "methods": [ - "search" - ] - } - } - } - } - }, - "ConversationalSearchService": { - "clients": { - "grpc": { - "libraryClient": "::Google::Cloud::Retail::V2::ConversationalSearchService::Client", - "rpcs": { - "ConversationalSearch": { - "methods": [ - "conversational_search" - ] - } - } - } - } - }, - "GenerativeQuestionService": { - "clients": { - "grpc": { - "libraryClient": "::Google::Cloud::Retail::V2::GenerativeQuestionService::Client", - "rpcs": { - "UpdateGenerativeQuestionsFeatureConfig": { - "methods": [ - "update_generative_questions_feature_config" - ] - }, - "GetGenerativeQuestionsFeatureConfig": { - "methods": [ - "get_generative_questions_feature_config" - ] - }, - "ListGenerativeQuestionConfigs": { - "methods": [ - "list_generative_question_configs" - ] - }, - "UpdateGenerativeQuestionConfig": { - "methods": [ - "update_generative_question_config" - ] - }, - "BatchUpdateGenerativeQuestionConfigs": { - "methods": [ - "batch_update_generative_question_configs" - ] - } - } - } - } - }, - "ModelService": { - "clients": { - "grpc": { - "libraryClient": "::Google::Cloud::Retail::V2::ModelService::Client", - "rpcs": { - "CreateModel": { - "methods": [ - "create_model" - ] - }, - "GetModel": { - "methods": [ - "get_model" - ] - }, - "PauseModel": { - "methods": [ - "pause_model" - ] - }, - "ResumeModel": { - "methods": [ - "resume_model" - ] - }, - "DeleteModel": { - "methods": [ - "delete_model" - ] - }, - "ListModels": { - "methods": [ - "list_models" - ] - }, - "UpdateModel": { - "methods": [ - "update_model" - ] - }, - "TuneModel": { - "methods": [ - "tune_model" - ] - } - } - } - } - }, - "PredictionService": { - "clients": { - "grpc": { - "libraryClient": "::Google::Cloud::Retail::V2::PredictionService::Client", - "rpcs": { - "Predict": { - "methods": [ - "predict" - ] - } - } - } - } - }, - "ProductService": { - "clients": { - "grpc": { - "libraryClient": "::Google::Cloud::Retail::V2::ProductService::Client", - "rpcs": { - "CreateProduct": { - "methods": [ - "create_product" - ] - }, - "GetProduct": { - "methods": [ - "get_product" - ] - }, - "ListProducts": { - "methods": [ - "list_products" - ] - }, - "UpdateProduct": { - "methods": [ - "update_product" - ] - }, - "DeleteProduct": { - "methods": [ - "delete_product" - ] - }, - "PurgeProducts": { - "methods": [ - "purge_products" - ] - }, - "ImportProducts": { - "methods": [ - "import_products" - ] - }, - "SetInventory": { - "methods": [ - "set_inventory" - ] - }, - "AddFulfillmentPlaces": { - "methods": [ - "add_fulfillment_places" - ] - }, - "RemoveFulfillmentPlaces": { - "methods": [ - "remove_fulfillment_places" - ] - }, - "AddLocalInventories": { - "methods": [ - "add_local_inventories" - ] - }, - "RemoveLocalInventories": { - "methods": [ - "remove_local_inventories" - ] - } - } - } - } - }, - "ServingConfigService": { - "clients": { - "grpc": { - "libraryClient": "::Google::Cloud::Retail::V2::ServingConfigService::Client", - "rpcs": { - "CreateServingConfig": { - "methods": [ - "create_serving_config" - ] - }, - "DeleteServingConfig": { - "methods": [ - "delete_serving_config" - ] - }, - "UpdateServingConfig": { - "methods": [ - "update_serving_config" - ] - }, - "GetServingConfig": { - "methods": [ - "get_serving_config" - ] - }, - "ListServingConfigs": { - "methods": [ - "list_serving_configs" - ] - }, - "AddControl": { - "methods": [ - "add_control" - ] - }, - "RemoveControl": { - "methods": [ - "remove_control" - ] - } - } - } - } - }, - "UserEventService": { - "clients": { - "grpc": { - "libraryClient": "::Google::Cloud::Retail::V2::UserEventService::Client", - "rpcs": { - "WriteUserEvent": { - "methods": [ - "write_user_event" - ] - }, - "CollectUserEvent": { - "methods": [ - "collect_user_event" - ] - }, - "PurgeUserEvents": { - "methods": [ - "purge_user_events" - ] - }, - "ImportUserEvents": { - "methods": [ - "import_user_events" - ] - }, - "RejoinUserEvents": { - "methods": [ - "rejoin_user_events" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-retail-v2/google-cloud-retail-v2.gemspec b/owl-bot-staging/google-cloud-retail-v2/google-cloud-retail-v2.gemspec deleted file mode 100644 index e93626b80550..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/google-cloud-retail-v2.gemspec +++ /dev/null @@ -1,29 +0,0 @@ -# -*- ruby -*- -# encoding: utf-8 - -require File.expand_path("lib/google/cloud/retail/v2/version", __dir__) - -Gem::Specification.new do |gem| - gem.name = "google-cloud-retail-v2" - gem.version = Google::Cloud::Retail::V2::VERSION - - gem.authors = ["Google LLC"] - gem.email = "googleapis-packages@google.com" - gem.description = "Retail enables you to build an end-to-end personalized recommendation system based on state-of-the-art deep learning ML models, without a need for expertise in ML or recommendation systems. Note that google-cloud-retail-v2 is a version-specific client library. For most uses, we recommend installing the main client library google-cloud-retail instead. See the readme for more details." - gem.summary = "AI Commerce Search API is made up of Search, Browse and Recommendations. These discovery AI solutions help you implement personalized search, browse and recommendations, based on machine learning models, across your websites and mobile applications." - gem.homepage = "https://github.com/googleapis/google-cloud-ruby" - gem.license = "Apache-2.0" - - gem.platform = Gem::Platform::RUBY - - gem.files = `git ls-files -- lib/*`.split("\n") + - `git ls-files -- proto_docs/*`.split("\n") + - ["README.md", "LICENSE.md", "AUTHENTICATION.md", ".yardopts"] - gem.require_paths = ["lib"] - - gem.required_ruby_version = ">= 3.2" - - gem.add_dependency "gapic-common", "~> 1.3" - gem.add_dependency "google-cloud-errors", "~> 1.0" - gem.add_dependency "google-cloud-location", "~> 1.0" -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google-cloud-retail-v2.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google-cloud-retail-v2.rb deleted file mode 100644 index 45db4898f66c..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google-cloud-retail-v2.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# This gem does not autoload during Bundler.require. To load this gem, -# issue explicit require statements for the packages desired, e.g.: -# require "google/cloud/retail/v2" diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2.rb deleted file mode 100644 index 4214f1307e58..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2.rb +++ /dev/null @@ -1,56 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "google/cloud/retail/v2/analytics_service" -require "google/cloud/retail/v2/catalog_service" -require "google/cloud/retail/v2/completion_service" -require "google/cloud/retail/v2/control_service" -require "google/cloud/retail/v2/search_service" -require "google/cloud/retail/v2/conversational_search_service" -require "google/cloud/retail/v2/generative_question_service" -require "google/cloud/retail/v2/model_service" -require "google/cloud/retail/v2/prediction_service" -require "google/cloud/retail/v2/product_service" -require "google/cloud/retail/v2/serving_config_service" -require "google/cloud/retail/v2/user_event_service" -require "google/cloud/retail/v2/version" - -module Google - module Cloud - module Retail - ## - # API client module. - # - # @example Load this package, including all its services, and instantiate a gRPC client - # - # require "google/cloud/retail/v2" - # client = ::Google::Cloud::Retail::V2::AnalyticsService::Client.new - # - # @example Load this package, including all its services, and instantiate a REST client - # - # require "google/cloud/retail/v2" - # client = ::Google::Cloud::Retail::V2::AnalyticsService::Rest::Client.new - # - module V2 - end - end - end -end - -helper_path = ::File.join __dir__, "v2", "_helpers.rb" -require "google/cloud/retail/v2/_helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service.rb deleted file mode 100644 index 3eb7f4cce88a..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service.rb +++ /dev/null @@ -1,56 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "gapic/common" -require "gapic/config" -require "gapic/config/method" - -require "google/cloud/retail/v2/version" - -require "google/cloud/retail/v2/analytics_service/credentials" -require "google/cloud/retail/v2/analytics_service/operations" -require "google/cloud/retail/v2/analytics_service/client" -require "google/cloud/retail/v2/analytics_service/rest" - -module Google - module Cloud - module Retail - module V2 - ## - # Service for managing & accessing retail search business metric. - # Retail recommendation business metric is currently not available. - # - # @example Load this service and instantiate a gRPC client - # - # require "google/cloud/retail/v2/analytics_service" - # client = ::Google::Cloud::Retail::V2::AnalyticsService::Client.new - # - # @example Load this service and instantiate a REST client - # - # require "google/cloud/retail/v2/analytics_service/rest" - # client = ::Google::Cloud::Retail::V2::AnalyticsService::Rest::Client.new - # - module AnalyticsService - end - end - end - end -end - -helper_path = ::File.join __dir__, "analytics_service", "helpers.rb" -require "google/cloud/retail/v2/analytics_service/helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/client.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/client.rb deleted file mode 100644 index 6bf39fd8fb1d..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/client.rb +++ /dev/null @@ -1,543 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "google/cloud/errors" -require "google/cloud/retail/v2/analytics_service_pb" -require "google/cloud/location" - -module Google - module Cloud - module Retail - module V2 - module AnalyticsService - ## - # Client for the AnalyticsService service. - # - # Service for managing & accessing retail search business metric. - # Retail recommendation business metric is currently not available. - # - class Client - # @private - API_VERSION = "" - - # @private - DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" - - # @private - attr_reader :analytics_service_stub - - ## - # Configure the AnalyticsService Client class. - # - # See {::Google::Cloud::Retail::V2::AnalyticsService::Client::Configuration} - # for a description of the configuration fields. - # - # @example - # - # # Modify the configuration for all AnalyticsService clients - # ::Google::Cloud::Retail::V2::AnalyticsService::Client.configure do |config| - # config.timeout = 10.0 - # end - # - # @yield [config] Configure the Client client. - # @yieldparam config [Client::Configuration] - # - # @return [Client::Configuration] - # - def self.configure - @configure ||= begin - namespace = ["Google", "Cloud", "Retail", "V2"] - parent_config = while namespace.any? - parent_name = namespace.join "::" - parent_const = const_get parent_name - break parent_const.configure if parent_const.respond_to? :configure - namespace.pop - end - default_config = Client::Configuration.new parent_config - - default_config.rpcs.export_analytics_metrics.timeout = 60.0 - default_config.rpcs.export_analytics_metrics.retry_policy = { - initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4] - } - - default_config - end - yield @configure if block_given? - @configure - end - - ## - # Configure the AnalyticsService Client instance. - # - # The configuration is set to the derived mode, meaning that values can be changed, - # but structural changes (adding new fields, etc.) are not allowed. Structural changes - # should be made on {Client.configure}. - # - # See {::Google::Cloud::Retail::V2::AnalyticsService::Client::Configuration} - # for a description of the configuration fields. - # - # @yield [config] Configure the Client client. - # @yieldparam config [Client::Configuration] - # - # @return [Client::Configuration] - # - def configure - yield @config if block_given? - @config - end - - ## - # The effective universe domain - # - # @return [String] - # - def universe_domain - @analytics_service_stub.universe_domain - end - - ## - # Create a new AnalyticsService client object. - # - # @example - # - # # Create a client using the default configuration - # client = ::Google::Cloud::Retail::V2::AnalyticsService::Client.new - # - # # Create a client using a custom configuration - # client = ::Google::Cloud::Retail::V2::AnalyticsService::Client.new do |config| - # config.timeout = 10.0 - # end - # - # @yield [config] Configure the AnalyticsService client. - # @yieldparam config [Client::Configuration] - # - def initialize - # These require statements are intentionally placed here to initialize - # the gRPC module only when it's required. - # See https://github.com/googleapis/toolkit/issues/446 - require "gapic/grpc" - require "google/cloud/retail/v2/analytics_service_services_pb" - - # Create the configuration object - @config = Configuration.new Client.configure - - # Yield the configuration if needed - yield @config if block_given? - - # Create credentials - credentials = @config.credentials - # Use self-signed JWT if the endpoint is unchanged from default, - # but only if the default endpoint does not have a region prefix. - enable_self_signed_jwt = @config.endpoint.nil? || - (@config.endpoint == Configuration::DEFAULT_ENDPOINT && - !@config.endpoint.split(".").first.include?("-")) - credentials ||= Credentials.default scope: @config.scope, - enable_self_signed_jwt: enable_self_signed_jwt - if credentials.is_a?(::String) || credentials.is_a?(::Hash) - credentials = Credentials.new credentials, scope: @config.scope - end - @quota_project_id = @config.quota_project - @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id - - @operations_client = Operations.new do |config| - config.credentials = credentials - config.quota_project = @quota_project_id - config.endpoint = @config.endpoint - config.universe_domain = @config.universe_domain - end - - @analytics_service_stub = ::Gapic::ServiceStub.new( - ::Google::Cloud::Retail::V2::AnalyticsService::Stub, - credentials: credentials, - endpoint: @config.endpoint, - endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, - universe_domain: @config.universe_domain, - channel_args: @config.channel_args, - interceptors: @config.interceptors, - channel_pool_config: @config.channel_pool, - logger: @config.logger - ) - - @analytics_service_stub.stub_logger&.info do |entry| - entry.set_system_name - entry.set_service - entry.message = "Created client for #{entry.service}" - entry.set_credentials_fields credentials - entry.set "customEndpoint", @config.endpoint if @config.endpoint - entry.set "defaultTimeout", @config.timeout if @config.timeout - entry.set "quotaProject", @quota_project_id if @quota_project_id - end - - @location_client = Google::Cloud::Location::Locations::Client.new do |config| - config.credentials = credentials - config.quota_project = @quota_project_id - config.endpoint = @analytics_service_stub.endpoint - config.universe_domain = @analytics_service_stub.universe_domain - config.logger = @analytics_service_stub.logger if config.respond_to? :logger= - end - end - - ## - # Get the associated client for long-running operations. - # - # @return [::Google::Cloud::Retail::V2::AnalyticsService::Operations] - # - attr_reader :operations_client - - ## - # Get the associated client for mix-in of the Locations. - # - # @return [Google::Cloud::Location::Locations::Client] - # - attr_reader :location_client - - ## - # The logger used for request/response debug logging. - # - # @return [Logger] - # - def logger - @analytics_service_stub.logger - end - - # Service calls - - ## - # Exports analytics metrics. - # - # `Operation.response` is of type `ExportAnalyticsMetricsResponse`. - # `Operation.metadata` is of type `ExportMetadata`. - # - # @overload export_analytics_metrics(request, options = nil) - # Pass arguments to `export_analytics_metrics` via a request object, either of type - # {::Google::Cloud::Retail::V2::ExportAnalyticsMetricsRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::ExportAnalyticsMetricsRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload export_analytics_metrics(catalog: nil, output_config: nil, filter: nil) - # Pass arguments to `export_analytics_metrics` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param catalog [::String] - # Required. Full resource name of the parent catalog. - # Expected format: `projects/*/locations/*/catalogs/*` - # @param output_config [::Google::Cloud::Retail::V2::OutputConfig, ::Hash] - # Required. The output location of the data. - # @param filter [::String] - # A filtering expression to specify restrictions on returned metrics. - # The expression is a sequence of terms. Each term applies a restriction to - # the returned metrics. Use this expression to restrict results to a - # specific time range. - # - # Currently we expect only one types of fields: - # - # * `timestamp`: This can be specified twice, once with a - # less than operator and once with a greater than operator. The - # `timestamp` restriction should result in one, contiguous, valid, - # `timestamp` range. - # - # Some examples of valid filters expressions: - # - # * Example 1: `timestamp > "2012-04-23T18:25:43.511Z" - # timestamp < "2012-04-23T18:30:43.511Z"` - # * Example 2: `timestamp > "2012-04-23T18:25:43.511Z"` - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::Operation] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::AnalyticsService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::ExportAnalyticsMetricsRequest.new - # - # # Call the export_analytics_metrics method. - # result = client.export_analytics_metrics request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def export_analytics_metrics request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ExportAnalyticsMetricsRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.export_analytics_metrics.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.catalog - header_params["catalog"] = request.catalog - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.export_analytics_metrics.timeout, - metadata: metadata, - retry_policy: @config.rpcs.export_analytics_metrics.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @analytics_service_stub.call_rpc :export_analytics_metrics, request, options: options do |response, operation| - response = ::Gapic::Operation.new response, @operations_client, options: options - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Configuration class for the AnalyticsService API. - # - # This class represents the configuration for AnalyticsService, - # providing control over timeouts, retry behavior, logging, transport - # parameters, and other low-level controls. Certain parameters can also be - # applied individually to specific RPCs. See - # {::Google::Cloud::Retail::V2::AnalyticsService::Client::Configuration::Rpcs} - # for a list of RPCs that can be configured independently. - # - # Configuration can be applied globally to all clients, or to a single client - # on construction. - # - # @example - # - # # Modify the global config, setting the timeout for - # # export_analytics_metrics to 20 seconds, - # # and all remaining timeouts to 10 seconds. - # ::Google::Cloud::Retail::V2::AnalyticsService::Client.configure do |config| - # config.timeout = 10.0 - # config.rpcs.export_analytics_metrics.timeout = 20.0 - # end - # - # # Apply the above configuration only to a new client. - # client = ::Google::Cloud::Retail::V2::AnalyticsService::Client.new do |config| - # config.timeout = 10.0 - # config.rpcs.export_analytics_metrics.timeout = 20.0 - # end - # - # @!attribute [rw] endpoint - # A custom service endpoint, as a hostname or hostname:port. The default is - # nil, indicating to use the default endpoint in the current universe domain. - # @return [::String,nil] - # @!attribute [rw] credentials - # Credentials to send with calls. You may provide any of the following types: - # * (`Google::Auth::Credentials`) A googleauth credentials object - # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) - # * (`Signet::OAuth2::Client`) A signet oauth2 client object - # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) - # * (`GRPC::Core::Channel`) a gRPC channel with included credentials - # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object - # * (`nil`) indicating no credentials - # - # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials - # is deprecated. Providing an unvalidated credential configuration to - # Google APIs can compromise the security of your systems and data. - # - # @example - # - # # The recommended way to provide credentials is to use the `make_creds` method - # # on the appropriate credentials class for your environment. - # - # require "googleauth" - # - # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds( - # json_key_io: ::File.open("/path/to/keyfile.json") - # ) - # - # client = ::Google::Cloud::Retail::V2::AnalyticsService::Client.new do |config| - # config.credentials = credentials - # end - # - # @note Warning: If you accept a credential configuration (JSON file or Hash) from an - # external source for authentication to Google Cloud, you must validate it before - # providing it to a Google API client library. Providing an unvalidated credential - # configuration to Google APIs can compromise the security of your systems and data. - # For more information, refer to [Validate credential configurations from external - # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). - # @return [::Object] - # @!attribute [rw] scope - # The OAuth scopes - # @return [::Array<::String>] - # @!attribute [rw] lib_name - # The library name as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] lib_version - # The library version as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] channel_args - # Extra parameters passed to the gRPC channel. Note: this is ignored if a - # `GRPC::Core::Channel` object is provided as the credential. - # @return [::Hash] - # @!attribute [rw] interceptors - # An array of interceptors that are run before calls are executed. - # @return [::Array<::GRPC::ClientInterceptor>] - # @!attribute [rw] timeout - # The call timeout in seconds. - # @return [::Numeric] - # @!attribute [rw] metadata - # Additional gRPC headers to be sent with the call. - # @return [::Hash{::Symbol=>::String}] - # @!attribute [rw] retry_policy - # The retry policy. The value is a hash with the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # @return [::Hash] - # @!attribute [rw] quota_project - # A separate project against which to charge quota. - # @return [::String] - # @!attribute [rw] universe_domain - # The universe domain within which to make requests. This determines the - # default endpoint URL. The default value of nil uses the environment - # universe (usually the default "googleapis.com" universe). - # @return [::String,nil] - # @!attribute [rw] logger - # A custom logger to use for request/response debug logging, or the value - # `:default` (the default) to construct a default logger, or `nil` to - # explicitly disable logging. - # @return [::Logger,:default,nil] - # - class Configuration - extend ::Gapic::Config - - # @private - # The endpoint specific to the default "googleapis.com" universe. Deprecated. - DEFAULT_ENDPOINT = "retail.googleapis.com" - - config_attr :endpoint, nil, ::String, nil - config_attr :credentials, nil do |value| - allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] - allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel - allowed.any? { |klass| klass === value } - end - config_attr :scope, nil, ::String, ::Array, nil - config_attr :lib_name, nil, ::String, nil - config_attr :lib_version, nil, ::String, nil - config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) - config_attr :interceptors, nil, ::Array, nil - config_attr :timeout, nil, ::Numeric, nil - config_attr :metadata, nil, ::Hash, nil - config_attr :retry_policy, nil, ::Hash, ::Proc, nil - config_attr :quota_project, nil, ::String, nil - config_attr :universe_domain, nil, ::String, nil - config_attr :logger, :default, ::Logger, nil, :default - - # @private - def initialize parent_config = nil - @parent_config = parent_config unless parent_config.nil? - - yield self if block_given? - end - - ## - # Configurations for individual RPCs - # @return [Rpcs] - # - def rpcs - @rpcs ||= begin - parent_rpcs = nil - parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) - Rpcs.new parent_rpcs - end - end - - ## - # Configuration for the channel pool - # @return [::Gapic::ServiceStub::ChannelPool::Configuration] - # - def channel_pool - @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new - end - - ## - # Configuration RPC class for the AnalyticsService API. - # - # Includes fields providing the configuration for each RPC in this service. - # Each configuration object is of type `Gapic::Config::Method` and includes - # the following configuration fields: - # - # * `timeout` (*type:* `Numeric`) - The call timeout in seconds - # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers - # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields - # include the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # - class Rpcs - ## - # RPC-specific configuration for `export_analytics_metrics` - # @return [::Gapic::Config::Method] - # - attr_reader :export_analytics_metrics - - # @private - def initialize parent_rpcs = nil - export_analytics_metrics_config = parent_rpcs.export_analytics_metrics if parent_rpcs.respond_to? :export_analytics_metrics - @export_analytics_metrics = ::Gapic::Config::Method.new export_analytics_metrics_config - - yield self if block_given? - end - end - end - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/credentials.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/credentials.rb deleted file mode 100644 index 89a3470cd910..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/credentials.rb +++ /dev/null @@ -1,51 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "googleauth" - -module Google - module Cloud - module Retail - module V2 - module AnalyticsService - # Credentials for the AnalyticsService API. - class Credentials < ::Google::Auth::Credentials - self.scope = [ - "https://www.googleapis.com/auth/cloud-platform" - ] - self.env_vars = [ - "RETAIL_CREDENTIALS", - "RETAIL_KEYFILE", - "GOOGLE_CLOUD_CREDENTIALS", - "GOOGLE_CLOUD_KEYFILE", - "GCLOUD_KEYFILE", - "RETAIL_CREDENTIALS_JSON", - "RETAIL_KEYFILE_JSON", - "GOOGLE_CLOUD_CREDENTIALS_JSON", - "GOOGLE_CLOUD_KEYFILE_JSON", - "GCLOUD_KEYFILE_JSON" - ] - self.paths = [ - "~/.config/google_cloud/application_default_credentials.json" - ] - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/operations.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/operations.rb deleted file mode 100644 index a95ff44ed70d..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/operations.rb +++ /dev/null @@ -1,843 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "gapic/operation" -require "google/longrunning/operations_pb" - -module Google - module Cloud - module Retail - module V2 - module AnalyticsService - # Service that implements Longrunning Operations API. - class Operations - # @private - API_VERSION = "" - - # @private - DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" - - # @private - attr_reader :operations_stub - - ## - # Configuration for the AnalyticsService Operations API. - # - # @yield [config] Configure the Operations client. - # @yieldparam config [Operations::Configuration] - # - # @return [Operations::Configuration] - # - def self.configure - @configure ||= Operations::Configuration.new - yield @configure if block_given? - @configure - end - - ## - # Configure the AnalyticsService Operations instance. - # - # The configuration is set to the derived mode, meaning that values can be changed, - # but structural changes (adding new fields, etc.) are not allowed. Structural changes - # should be made on {Operations.configure}. - # - # @yield [config] Configure the Operations client. - # @yieldparam config [Operations::Configuration] - # - # @return [Operations::Configuration] - # - def configure - yield @config if block_given? - @config - end - - ## - # The effective universe domain - # - # @return [String] - # - def universe_domain - @operations_stub.universe_domain - end - - ## - # Create a new Operations client object. - # - # @yield [config] Configure the Client client. - # @yieldparam config [Operations::Configuration] - # - def initialize - # These require statements are intentionally placed here to initialize - # the gRPC module only when it's required. - # See https://github.com/googleapis/toolkit/issues/446 - require "gapic/grpc" - require "google/longrunning/operations_services_pb" - - # Create the configuration object - @config = Configuration.new Operations.configure - - # Yield the configuration if needed - yield @config if block_given? - - # Create credentials - credentials = @config.credentials - credentials ||= Credentials.default scope: @config.scope - if credentials.is_a?(::String) || credentials.is_a?(::Hash) - credentials = Credentials.new credentials, scope: @config.scope - end - @quota_project_id = @config.quota_project - @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id - - @operations_stub = ::Gapic::ServiceStub.new( - ::Google::Longrunning::Operations::Stub, - credentials: credentials, - endpoint: @config.endpoint, - endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, - universe_domain: @config.universe_domain, - channel_args: @config.channel_args, - interceptors: @config.interceptors, - channel_pool_config: @config.channel_pool - ) - - # Used by an LRO wrapper for some methods of this service - @operations_client = self - end - - # Service calls - - ## - # Lists operations that match the specified filter in the request. If the - # server doesn't support this method, it returns `UNIMPLEMENTED`. - # - # @overload list_operations(request, options = nil) - # Pass arguments to `list_operations` via a request object, either of type - # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::ListOperationsRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload list_operations(name: nil, filter: nil, page_size: nil, page_token: nil, return_partial_success: nil) - # Pass arguments to `list_operations` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation's parent resource. - # @param filter [::String] - # The standard list filter. - # @param page_size [::Integer] - # The standard list page size. - # @param page_token [::String] - # The standard list page token. - # @param return_partial_success [::Boolean] - # When set to `true`, operations that are reachable are returned as normal, - # and those that are unreachable are returned in the - # [ListOperationsResponse.unreachable] field. - # - # This can only be `true` when reading across collections e.g. when `parent` - # is set to `"projects/example/locations/-"`. - # - # This field is not by default supported and will result in an - # `UNIMPLEMENTED` error if set unless explicitly documented otherwise in - # service or product specific documentation. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::PagedEnumerable<::Gapic::Operation>] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::PagedEnumerable<::Gapic::Operation>] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::ListOperationsRequest.new - # - # # Call the list_operations method. - # result = client.list_operations request - # - # # The returned object is of type Gapic::PagedEnumerable. You can iterate - # # over elements, and API calls will be issued to fetch pages as needed. - # result.each do |item| - # # Each element is of type ::Google::Longrunning::Operation. - # p item - # end - # - def list_operations request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::ListOperationsRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.list_operations.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.name - header_params["name"] = request.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.list_operations.timeout, - metadata: metadata, - retry_policy: @config.rpcs.list_operations.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.call_rpc :list_operations, request, options: options do |response, operation| - wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client } - response = ::Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Gets the latest state of a long-running operation. Clients can use this - # method to poll the operation result at intervals as recommended by the API - # service. - # - # @overload get_operation(request, options = nil) - # Pass arguments to `get_operation` via a request object, either of type - # {::Google::Longrunning::GetOperationRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::GetOperationRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload get_operation(name: nil) - # Pass arguments to `get_operation` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation resource. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::Operation] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::GetOperationRequest.new - # - # # Call the get_operation method. - # result = client.get_operation request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def get_operation request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::GetOperationRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.get_operation.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.name - header_params["name"] = request.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.get_operation.timeout, - metadata: metadata, - retry_policy: @config.rpcs.get_operation.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.call_rpc :get_operation, request, options: options do |response, operation| - response = ::Gapic::Operation.new response, @operations_client, options: options - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Deletes a long-running operation. This method indicates that the client is - # no longer interested in the operation result. It does not cancel the - # operation. If the server doesn't support this method, it returns - # `google.rpc.Code.UNIMPLEMENTED`. - # - # @overload delete_operation(request, options = nil) - # Pass arguments to `delete_operation` via a request object, either of type - # {::Google::Longrunning::DeleteOperationRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::DeleteOperationRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload delete_operation(name: nil) - # Pass arguments to `delete_operation` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation resource to be deleted. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Protobuf::Empty] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Protobuf::Empty] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::DeleteOperationRequest.new - # - # # Call the delete_operation method. - # result = client.delete_operation request - # - # # The returned object is of type Google::Protobuf::Empty. - # p result - # - def delete_operation request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::DeleteOperationRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.delete_operation.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.name - header_params["name"] = request.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.delete_operation.timeout, - metadata: metadata, - retry_policy: @config.rpcs.delete_operation.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.call_rpc :delete_operation, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Starts asynchronous cancellation on a long-running operation. The server - # makes a best effort to cancel the operation, but success is not - # guaranteed. If the server doesn't support this method, it returns - # `google.rpc.Code.UNIMPLEMENTED`. Clients can use - # Operations.GetOperation or - # other methods to check whether the cancellation succeeded or whether the - # operation completed despite cancellation. On successful cancellation, - # the operation is not deleted; instead, it becomes an operation with - # an {::Google::Longrunning::Operation#error Operation.error} value with a - # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to - # `Code.CANCELLED`. - # - # @overload cancel_operation(request, options = nil) - # Pass arguments to `cancel_operation` via a request object, either of type - # {::Google::Longrunning::CancelOperationRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::CancelOperationRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload cancel_operation(name: nil) - # Pass arguments to `cancel_operation` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation resource to be cancelled. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Protobuf::Empty] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Protobuf::Empty] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::CancelOperationRequest.new - # - # # Call the cancel_operation method. - # result = client.cancel_operation request - # - # # The returned object is of type Google::Protobuf::Empty. - # p result - # - def cancel_operation request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::CancelOperationRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.cancel_operation.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.name - header_params["name"] = request.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.cancel_operation.timeout, - metadata: metadata, - retry_policy: @config.rpcs.cancel_operation.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Waits until the specified long-running operation is done or reaches at most - # a specified timeout, returning the latest state. If the operation is - # already done, the latest state is immediately returned. If the timeout - # specified is greater than the default HTTP/RPC timeout, the HTTP/RPC - # timeout is used. If the server does not support this method, it returns - # `google.rpc.Code.UNIMPLEMENTED`. - # Note that this method is on a best-effort basis. It may return the latest - # state before the specified timeout (including immediately), meaning even an - # immediate response is no guarantee that the operation is done. - # - # @overload wait_operation(request, options = nil) - # Pass arguments to `wait_operation` via a request object, either of type - # {::Google::Longrunning::WaitOperationRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::WaitOperationRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload wait_operation(name: nil, timeout: nil) - # Pass arguments to `wait_operation` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation resource to wait on. - # @param timeout [::Google::Protobuf::Duration, ::Hash] - # The maximum duration to wait before timing out. If left blank, the wait - # will be at most the time permitted by the underlying HTTP/RPC protocol. - # If RPC context deadline is also specified, the shorter one will be used. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::Operation] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::WaitOperationRequest.new - # - # # Call the wait_operation method. - # result = client.wait_operation request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def wait_operation request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::WaitOperationRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.wait_operation.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.wait_operation.timeout, - metadata: metadata, - retry_policy: @config.rpcs.wait_operation.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation| - response = ::Gapic::Operation.new response, @operations_client, options: options - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Configuration class for the Operations API. - # - # This class represents the configuration for Operations, - # providing control over timeouts, retry behavior, logging, transport - # parameters, and other low-level controls. Certain parameters can also be - # applied individually to specific RPCs. See - # {::Google::Longrunning::Operations::Client::Configuration::Rpcs} - # for a list of RPCs that can be configured independently. - # - # Configuration can be applied globally to all clients, or to a single client - # on construction. - # - # @example - # - # # Modify the global config, setting the timeout for - # # list_operations to 20 seconds, - # # and all remaining timeouts to 10 seconds. - # ::Google::Longrunning::Operations::Client.configure do |config| - # config.timeout = 10.0 - # config.rpcs.list_operations.timeout = 20.0 - # end - # - # # Apply the above configuration only to a new client. - # client = ::Google::Longrunning::Operations::Client.new do |config| - # config.timeout = 10.0 - # config.rpcs.list_operations.timeout = 20.0 - # end - # - # @!attribute [rw] endpoint - # A custom service endpoint, as a hostname or hostname:port. The default is - # nil, indicating to use the default endpoint in the current universe domain. - # @return [::String,nil] - # @!attribute [rw] credentials - # Credentials to send with calls. You may provide any of the following types: - # * (`Google::Auth::Credentials`) A googleauth credentials object - # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) - # * (`Signet::OAuth2::Client`) A signet oauth2 client object - # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) - # * (`GRPC::Core::Channel`) a gRPC channel with included credentials - # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object - # * (`nil`) indicating no credentials - # - # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials - # is deprecated. Providing an unvalidated credential configuration to - # Google APIs can compromise the security of your systems and data. - # - # @example - # - # # The recommended way to provide credentials is to use the `make_creds` method - # # on the appropriate credentials class for your environment. - # - # require "googleauth" - # - # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds( - # json_key_io: ::File.open("/path/to/keyfile.json") - # ) - # - # client = ::Google::Longrunning::Operations::Client.new do |config| - # config.credentials = credentials - # end - # - # @note Warning: If you accept a credential configuration (JSON file or Hash) from an - # external source for authentication to Google Cloud, you must validate it before - # providing it to a Google API client library. Providing an unvalidated credential - # configuration to Google APIs can compromise the security of your systems and data. - # For more information, refer to [Validate credential configurations from external - # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). - # @return [::Object] - # @!attribute [rw] scope - # The OAuth scopes - # @return [::Array<::String>] - # @!attribute [rw] lib_name - # The library name as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] lib_version - # The library version as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] channel_args - # Extra parameters passed to the gRPC channel. Note: this is ignored if a - # `GRPC::Core::Channel` object is provided as the credential. - # @return [::Hash] - # @!attribute [rw] interceptors - # An array of interceptors that are run before calls are executed. - # @return [::Array<::GRPC::ClientInterceptor>] - # @!attribute [rw] timeout - # The call timeout in seconds. - # @return [::Numeric] - # @!attribute [rw] metadata - # Additional gRPC headers to be sent with the call. - # @return [::Hash{::Symbol=>::String}] - # @!attribute [rw] retry_policy - # The retry policy. The value is a hash with the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # @return [::Hash] - # @!attribute [rw] quota_project - # A separate project against which to charge quota. - # @return [::String] - # @!attribute [rw] universe_domain - # The universe domain within which to make requests. This determines the - # default endpoint URL. The default value of nil uses the environment - # universe (usually the default "googleapis.com" universe). - # @return [::String,nil] - # @!attribute [rw] logger - # A custom logger to use for request/response debug logging, or the value - # `:default` (the default) to construct a default logger, or `nil` to - # explicitly disable logging. - # @return [::Logger,:default,nil] - # - class Configuration - extend ::Gapic::Config - - # @private - # The endpoint specific to the default "googleapis.com" universe. Deprecated. - DEFAULT_ENDPOINT = "retail.googleapis.com" - - config_attr :endpoint, nil, ::String, nil - config_attr :credentials, nil do |value| - allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] - allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel - allowed.any? { |klass| klass === value } - end - config_attr :scope, nil, ::String, ::Array, nil - config_attr :lib_name, nil, ::String, nil - config_attr :lib_version, nil, ::String, nil - config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) - config_attr :interceptors, nil, ::Array, nil - config_attr :timeout, nil, ::Numeric, nil - config_attr :metadata, nil, ::Hash, nil - config_attr :retry_policy, nil, ::Hash, ::Proc, nil - config_attr :quota_project, nil, ::String, nil - config_attr :universe_domain, nil, ::String, nil - config_attr :logger, :default, ::Logger, nil, :default - - # @private - def initialize parent_config = nil - @parent_config = parent_config unless parent_config.nil? - - yield self if block_given? - end - - ## - # Configurations for individual RPCs - # @return [Rpcs] - # - def rpcs - @rpcs ||= begin - parent_rpcs = nil - parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) - Rpcs.new parent_rpcs - end - end - - ## - # Configuration for the channel pool - # @return [::Gapic::ServiceStub::ChannelPool::Configuration] - # - def channel_pool - @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new - end - - ## - # Configuration RPC class for the Operations API. - # - # Includes fields providing the configuration for each RPC in this service. - # Each configuration object is of type `Gapic::Config::Method` and includes - # the following configuration fields: - # - # * `timeout` (*type:* `Numeric`) - The call timeout in seconds - # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers - # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields - # include the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # - class Rpcs - ## - # RPC-specific configuration for `list_operations` - # @return [::Gapic::Config::Method] - # - attr_reader :list_operations - ## - # RPC-specific configuration for `get_operation` - # @return [::Gapic::Config::Method] - # - attr_reader :get_operation - ## - # RPC-specific configuration for `delete_operation` - # @return [::Gapic::Config::Method] - # - attr_reader :delete_operation - ## - # RPC-specific configuration for `cancel_operation` - # @return [::Gapic::Config::Method] - # - attr_reader :cancel_operation - ## - # RPC-specific configuration for `wait_operation` - # @return [::Gapic::Config::Method] - # - attr_reader :wait_operation - - # @private - def initialize parent_rpcs = nil - list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations - @list_operations = ::Gapic::Config::Method.new list_operations_config - get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation - @get_operation = ::Gapic::Config::Method.new get_operation_config - delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation - @delete_operation = ::Gapic::Config::Method.new delete_operation_config - cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation - @cancel_operation = ::Gapic::Config::Method.new cancel_operation_config - wait_operation_config = parent_rpcs.wait_operation if parent_rpcs.respond_to? :wait_operation - @wait_operation = ::Gapic::Config::Method.new wait_operation_config - - yield self if block_given? - end - end - end - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/rest.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/rest.rb deleted file mode 100644 index df3ab00fece5..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/rest.rb +++ /dev/null @@ -1,53 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "gapic/rest" -require "gapic/config" -require "gapic/config/method" - -require "google/cloud/retail/v2/version" - -require "google/cloud/retail/v2/analytics_service/credentials" -require "google/cloud/retail/v2/analytics_service/rest/operations" -require "google/cloud/retail/v2/analytics_service/rest/client" - -module Google - module Cloud - module Retail - module V2 - ## - # Service for managing & accessing retail search business metric. - # Retail recommendation business metric is currently not available. - # - # To load this service and instantiate a REST client: - # - # require "google/cloud/retail/v2/analytics_service/rest" - # client = ::Google::Cloud::Retail::V2::AnalyticsService::Rest::Client.new - # - module AnalyticsService - # Client for the REST transport - module Rest - end - end - end - end - end -end - -helper_path = ::File.join __dir__, "rest", "helpers.rb" -require "google/cloud/retail/v2/analytics_service/rest/helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/rest/client.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/rest/client.rb deleted file mode 100644 index f8af9a9f4f30..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/rest/client.rb +++ /dev/null @@ -1,493 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "google/cloud/errors" -require "google/cloud/retail/v2/analytics_service_pb" -require "google/cloud/retail/v2/analytics_service/rest/service_stub" -require "google/cloud/location/rest" - -module Google - module Cloud - module Retail - module V2 - module AnalyticsService - module Rest - ## - # REST client for the AnalyticsService service. - # - # Service for managing & accessing retail search business metric. - # Retail recommendation business metric is currently not available. - # - class Client - # @private - API_VERSION = "" - - # @private - DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" - - # @private - attr_reader :analytics_service_stub - - ## - # Configure the AnalyticsService Client class. - # - # See {::Google::Cloud::Retail::V2::AnalyticsService::Rest::Client::Configuration} - # for a description of the configuration fields. - # - # @example - # - # # Modify the configuration for all AnalyticsService clients - # ::Google::Cloud::Retail::V2::AnalyticsService::Rest::Client.configure do |config| - # config.timeout = 10.0 - # end - # - # @yield [config] Configure the Client client. - # @yieldparam config [Client::Configuration] - # - # @return [Client::Configuration] - # - def self.configure - @configure ||= begin - namespace = ["Google", "Cloud", "Retail", "V2"] - parent_config = while namespace.any? - parent_name = namespace.join "::" - parent_const = const_get parent_name - break parent_const.configure if parent_const.respond_to? :configure - namespace.pop - end - default_config = Client::Configuration.new parent_config - - default_config.rpcs.export_analytics_metrics.timeout = 60.0 - default_config.rpcs.export_analytics_metrics.retry_policy = { - initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4] - } - - default_config - end - yield @configure if block_given? - @configure - end - - ## - # Configure the AnalyticsService Client instance. - # - # The configuration is set to the derived mode, meaning that values can be changed, - # but structural changes (adding new fields, etc.) are not allowed. Structural changes - # should be made on {Client.configure}. - # - # See {::Google::Cloud::Retail::V2::AnalyticsService::Rest::Client::Configuration} - # for a description of the configuration fields. - # - # @yield [config] Configure the Client client. - # @yieldparam config [Client::Configuration] - # - # @return [Client::Configuration] - # - def configure - yield @config if block_given? - @config - end - - ## - # The effective universe domain - # - # @return [String] - # - def universe_domain - @analytics_service_stub.universe_domain - end - - ## - # Create a new AnalyticsService REST client object. - # - # @example - # - # # Create a client using the default configuration - # client = ::Google::Cloud::Retail::V2::AnalyticsService::Rest::Client.new - # - # # Create a client using a custom configuration - # client = ::Google::Cloud::Retail::V2::AnalyticsService::Rest::Client.new do |config| - # config.timeout = 10.0 - # end - # - # @yield [config] Configure the AnalyticsService client. - # @yieldparam config [Client::Configuration] - # - def initialize - # Create the configuration object - @config = Configuration.new Client.configure - - # Yield the configuration if needed - yield @config if block_given? - - # Create credentials - credentials = @config.credentials - # Use self-signed JWT if the endpoint is unchanged from default, - # but only if the default endpoint does not have a region prefix. - enable_self_signed_jwt = @config.endpoint.nil? || - (@config.endpoint == Configuration::DEFAULT_ENDPOINT && - !@config.endpoint.split(".").first.include?("-")) - credentials ||= Credentials.default scope: @config.scope, - enable_self_signed_jwt: enable_self_signed_jwt - if credentials.is_a?(::String) || credentials.is_a?(::Hash) - credentials = Credentials.new credentials, scope: @config.scope - end - - @quota_project_id = @config.quota_project - @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id - - @operations_client = ::Google::Cloud::Retail::V2::AnalyticsService::Rest::Operations.new do |config| - config.credentials = credentials - config.quota_project = @quota_project_id - config.endpoint = @config.endpoint - config.universe_domain = @config.universe_domain - end - - @analytics_service_stub = ::Google::Cloud::Retail::V2::AnalyticsService::Rest::ServiceStub.new( - endpoint: @config.endpoint, - endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, - universe_domain: @config.universe_domain, - credentials: credentials, - logger: @config.logger - ) - - @analytics_service_stub.logger(stub: true)&.info do |entry| - entry.set_system_name - entry.set_service - entry.message = "Created client for #{entry.service}" - entry.set_credentials_fields credentials - entry.set "customEndpoint", @config.endpoint if @config.endpoint - entry.set "defaultTimeout", @config.timeout if @config.timeout - entry.set "quotaProject", @quota_project_id if @quota_project_id - end - - @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config| - config.credentials = credentials - config.quota_project = @quota_project_id - config.endpoint = @analytics_service_stub.endpoint - config.universe_domain = @analytics_service_stub.universe_domain - config.logger = @analytics_service_stub.logger if config.respond_to? :logger= - end - end - - ## - # Get the associated client for long-running operations. - # - # @return [::Google::Cloud::Retail::V2::AnalyticsService::Rest::Operations] - # - attr_reader :operations_client - - ## - # Get the associated client for mix-in of the Locations. - # - # @return [Google::Cloud::Location::Locations::Rest::Client] - # - attr_reader :location_client - - ## - # The logger used for request/response debug logging. - # - # @return [Logger] - # - def logger - @analytics_service_stub.logger - end - - # Service calls - - ## - # Exports analytics metrics. - # - # `Operation.response` is of type `ExportAnalyticsMetricsResponse`. - # `Operation.metadata` is of type `ExportMetadata`. - # - # @overload export_analytics_metrics(request, options = nil) - # Pass arguments to `export_analytics_metrics` via a request object, either of type - # {::Google::Cloud::Retail::V2::ExportAnalyticsMetricsRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::ExportAnalyticsMetricsRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload export_analytics_metrics(catalog: nil, output_config: nil, filter: nil) - # Pass arguments to `export_analytics_metrics` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param catalog [::String] - # Required. Full resource name of the parent catalog. - # Expected format: `projects/*/locations/*/catalogs/*` - # @param output_config [::Google::Cloud::Retail::V2::OutputConfig, ::Hash] - # Required. The output location of the data. - # @param filter [::String] - # A filtering expression to specify restrictions on returned metrics. - # The expression is a sequence of terms. Each term applies a restriction to - # the returned metrics. Use this expression to restrict results to a - # specific time range. - # - # Currently we expect only one types of fields: - # - # * `timestamp`: This can be specified twice, once with a - # less than operator and once with a greater than operator. The - # `timestamp` restriction should result in one, contiguous, valid, - # `timestamp` range. - # - # Some examples of valid filters expressions: - # - # * Example 1: `timestamp > "2012-04-23T18:25:43.511Z" - # timestamp < "2012-04-23T18:30:43.511Z"` - # * Example 2: `timestamp > "2012-04-23T18:25:43.511Z"` - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Gapic::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::AnalyticsService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::ExportAnalyticsMetricsRequest.new - # - # # Call the export_analytics_metrics method. - # result = client.export_analytics_metrics request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def export_analytics_metrics request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ExportAnalyticsMetricsRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.export_analytics_metrics.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.export_analytics_metrics.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.export_analytics_metrics.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @analytics_service_stub.export_analytics_metrics request, options do |result, operation| - result = ::Gapic::Operation.new result, @operations_client, options: options - yield result, operation if block_given? - throw :response, result - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Configuration class for the AnalyticsService REST API. - # - # This class represents the configuration for AnalyticsService REST, - # providing control over timeouts, retry behavior, logging, transport - # parameters, and other low-level controls. Certain parameters can also be - # applied individually to specific RPCs. See - # {::Google::Cloud::Retail::V2::AnalyticsService::Rest::Client::Configuration::Rpcs} - # for a list of RPCs that can be configured independently. - # - # Configuration can be applied globally to all clients, or to a single client - # on construction. - # - # @example - # - # # Modify the global config, setting the timeout for - # # export_analytics_metrics to 20 seconds, - # # and all remaining timeouts to 10 seconds. - # ::Google::Cloud::Retail::V2::AnalyticsService::Rest::Client.configure do |config| - # config.timeout = 10.0 - # config.rpcs.export_analytics_metrics.timeout = 20.0 - # end - # - # # Apply the above configuration only to a new client. - # client = ::Google::Cloud::Retail::V2::AnalyticsService::Rest::Client.new do |config| - # config.timeout = 10.0 - # config.rpcs.export_analytics_metrics.timeout = 20.0 - # end - # - # @!attribute [rw] endpoint - # A custom service endpoint, as a hostname or hostname:port. The default is - # nil, indicating to use the default endpoint in the current universe domain. - # @return [::String,nil] - # @!attribute [rw] credentials - # Credentials to send with calls. You may provide any of the following types: - # * (`String`) The path to a service account key file in JSON format - # * (`Hash`) A service account key as a Hash - # * (`Google::Auth::Credentials`) A googleauth credentials object - # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) - # * (`Signet::OAuth2::Client`) A signet oauth2 client object - # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) - # * (`nil`) indicating no credentials - # - # Warning: If you accept a credential configuration (JSON file or Hash) from an - # external source for authentication to Google Cloud, you must validate it before - # providing it to a Google API client library. Providing an unvalidated credential - # configuration to Google APIs can compromise the security of your systems and data. - # For more information, refer to [Validate credential configurations from external - # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). - # @return [::Object] - # @!attribute [rw] scope - # The OAuth scopes - # @return [::Array<::String>] - # @!attribute [rw] lib_name - # The library name as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] lib_version - # The library version as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] timeout - # The call timeout in seconds. - # @return [::Numeric] - # @!attribute [rw] metadata - # Additional headers to be sent with the call. - # @return [::Hash{::Symbol=>::String}] - # @!attribute [rw] retry_policy - # The retry policy. The value is a hash with the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # @return [::Hash] - # @!attribute [rw] quota_project - # A separate project against which to charge quota. - # @return [::String] - # @!attribute [rw] universe_domain - # The universe domain within which to make requests. This determines the - # default endpoint URL. The default value of nil uses the environment - # universe (usually the default "googleapis.com" universe). - # @return [::String,nil] - # @!attribute [rw] logger - # A custom logger to use for request/response debug logging, or the value - # `:default` (the default) to construct a default logger, or `nil` to - # explicitly disable logging. - # @return [::Logger,:default,nil] - # - class Configuration - extend ::Gapic::Config - - # @private - # The endpoint specific to the default "googleapis.com" universe. Deprecated. - DEFAULT_ENDPOINT = "retail.googleapis.com" - - config_attr :endpoint, nil, ::String, nil - config_attr :credentials, nil do |value| - allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] - allowed.any? { |klass| klass === value } - end - config_attr :scope, nil, ::String, ::Array, nil - config_attr :lib_name, nil, ::String, nil - config_attr :lib_version, nil, ::String, nil - config_attr :timeout, nil, ::Numeric, nil - config_attr :metadata, nil, ::Hash, nil - config_attr :retry_policy, nil, ::Hash, ::Proc, nil - config_attr :quota_project, nil, ::String, nil - config_attr :universe_domain, nil, ::String, nil - config_attr :logger, :default, ::Logger, nil, :default - - # @private - def initialize parent_config = nil - @parent_config = parent_config unless parent_config.nil? - - yield self if block_given? - end - - ## - # Configurations for individual RPCs - # @return [Rpcs] - # - def rpcs - @rpcs ||= begin - parent_rpcs = nil - parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) - Rpcs.new parent_rpcs - end - end - - ## - # Configuration RPC class for the AnalyticsService API. - # - # Includes fields providing the configuration for each RPC in this service. - # Each configuration object is of type `Gapic::Config::Method` and includes - # the following configuration fields: - # - # * `timeout` (*type:* `Numeric`) - The call timeout in seconds - # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers - # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields - # include the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # - class Rpcs - ## - # RPC-specific configuration for `export_analytics_metrics` - # @return [::Gapic::Config::Method] - # - attr_reader :export_analytics_metrics - - # @private - def initialize parent_rpcs = nil - export_analytics_metrics_config = parent_rpcs.export_analytics_metrics if parent_rpcs.respond_to? :export_analytics_metrics - @export_analytics_metrics = ::Gapic::Config::Method.new export_analytics_metrics_config - - yield self if block_given? - end - end - end - end - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/rest/operations.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/rest/operations.rb deleted file mode 100644 index 637809c95842..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/rest/operations.rb +++ /dev/null @@ -1,962 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "gapic/operation" - -module Google - module Cloud - module Retail - module V2 - module AnalyticsService - module Rest - # Service that implements Longrunning Operations API. - class Operations - # @private - API_VERSION = "" - - # @private - DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" - - # @private - attr_reader :operations_stub - - ## - # Configuration for the AnalyticsService Operations API. - # - # @yield [config] Configure the Operations client. - # @yieldparam config [Operations::Configuration] - # - # @return [Operations::Configuration] - # - def self.configure - @configure ||= Operations::Configuration.new - yield @configure if block_given? - @configure - end - - ## - # Configure the AnalyticsService Operations instance. - # - # The configuration is set to the derived mode, meaning that values can be changed, - # but structural changes (adding new fields, etc.) are not allowed. Structural changes - # should be made on {Operations.configure}. - # - # @yield [config] Configure the Operations client. - # @yieldparam config [Operations::Configuration] - # - # @return [Operations::Configuration] - # - def configure - yield @config if block_given? - @config - end - - ## - # The effective universe domain - # - # @return [String] - # - def universe_domain - @operations_stub.universe_domain - end - - ## - # Create a new Operations client object. - # - # @yield [config] Configure the Client client. - # @yieldparam config [Operations::Configuration] - # - def initialize - # Create the configuration object - @config = Configuration.new Operations.configure - - # Yield the configuration if needed - yield @config if block_given? - - # Create credentials - credentials = @config.credentials - credentials ||= Credentials.default scope: @config.scope - if credentials.is_a?(::String) || credentials.is_a?(::Hash) - credentials = Credentials.new credentials, scope: @config.scope - end - - @quota_project_id = @config.quota_project - @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id - - @operations_stub = OperationsServiceStub.new( - endpoint: @config.endpoint, - endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, - universe_domain: @config.universe_domain, - credentials: credentials - ) - - # Used by an LRO wrapper for some methods of this service - @operations_client = self - end - - # Service calls - - ## - # Lists operations that match the specified filter in the request. If the - # server doesn't support this method, it returns `UNIMPLEMENTED`. - # - # @overload list_operations(request, options = nil) - # Pass arguments to `list_operations` via a request object, either of type - # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::ListOperationsRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload list_operations(name: nil, filter: nil, page_size: nil, page_token: nil, return_partial_success: nil) - # Pass arguments to `list_operations` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation's parent resource. - # @param filter [::String] - # The standard list filter. - # @param page_size [::Integer] - # The standard list page size. - # @param page_token [::String] - # The standard list page token. - # @param return_partial_success [::Boolean] - # When set to `true`, operations that are reachable are returned as normal, - # and those that are unreachable are returned in the - # [ListOperationsResponse.unreachable] field. - # - # This can only be `true` when reading across collections e.g. when `parent` - # is set to `"projects/example/locations/-"`. - # - # This field is not by default supported and will result in an - # `UNIMPLEMENTED` error if set unless explicitly documented otherwise in - # service or product specific documentation. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Gapic::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::ListOperationsRequest.new - # - # # Call the list_operations method. - # result = client.list_operations request - # - # # The returned object is of type Gapic::PagedEnumerable. You can iterate - # # over elements, and API calls will be issued to fetch pages as needed. - # result.each do |item| - # # Each element is of type ::Google::Longrunning::Operation. - # p item - # end - # - def list_operations request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::ListOperationsRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.list_operations.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.list_operations.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.list_operations.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.list_operations request, options do |result, operation| - result = ::Gapic::Rest::PagedEnumerable.new @operations_stub, :list_operations, "operations", request, result, options - yield result, operation if block_given? - throw :response, result - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Gets the latest state of a long-running operation. Clients can use this - # method to poll the operation result at intervals as recommended by the API - # service. - # - # @overload get_operation(request, options = nil) - # Pass arguments to `get_operation` via a request object, either of type - # {::Google::Longrunning::GetOperationRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::GetOperationRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload get_operation(name: nil) - # Pass arguments to `get_operation` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation resource. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Gapic::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::GetOperationRequest.new - # - # # Call the get_operation method. - # result = client.get_operation request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def get_operation request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::GetOperationRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.get_operation.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.get_operation.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.get_operation.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.get_operation request, options do |result, operation| - result = ::Gapic::Operation.new result, @operations_client, options: options - yield result, operation if block_given? - throw :response, result - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Deletes a long-running operation. This method indicates that the client is - # no longer interested in the operation result. It does not cancel the - # operation. If the server doesn't support this method, it returns - # `google.rpc.Code.UNIMPLEMENTED`. - # - # @overload delete_operation(request, options = nil) - # Pass arguments to `delete_operation` via a request object, either of type - # {::Google::Longrunning::DeleteOperationRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::DeleteOperationRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload delete_operation(name: nil) - # Pass arguments to `delete_operation` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation resource to be deleted. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Protobuf::Empty] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Protobuf::Empty] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::DeleteOperationRequest.new - # - # # Call the delete_operation method. - # result = client.delete_operation request - # - # # The returned object is of type Google::Protobuf::Empty. - # p result - # - def delete_operation request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::DeleteOperationRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.delete_operation.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.delete_operation.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.delete_operation.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.delete_operation request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Starts asynchronous cancellation on a long-running operation. The server - # makes a best effort to cancel the operation, but success is not - # guaranteed. If the server doesn't support this method, it returns - # `google.rpc.Code.UNIMPLEMENTED`. Clients can use - # Operations.GetOperation or - # other methods to check whether the cancellation succeeded or whether the - # operation completed despite cancellation. On successful cancellation, - # the operation is not deleted; instead, it becomes an operation with - # an {::Google::Longrunning::Operation#error Operation.error} value with a - # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to - # `Code.CANCELLED`. - # - # @overload cancel_operation(request, options = nil) - # Pass arguments to `cancel_operation` via a request object, either of type - # {::Google::Longrunning::CancelOperationRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::CancelOperationRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload cancel_operation(name: nil) - # Pass arguments to `cancel_operation` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation resource to be cancelled. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Protobuf::Empty] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Protobuf::Empty] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::CancelOperationRequest.new - # - # # Call the cancel_operation method. - # result = client.cancel_operation request - # - # # The returned object is of type Google::Protobuf::Empty. - # p result - # - def cancel_operation request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::CancelOperationRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.cancel_operation.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.cancel_operation.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.cancel_operation.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.cancel_operation request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Configuration class for the Operations REST API. - # - # This class represents the configuration for Operations REST, - # providing control over timeouts, retry behavior, logging, transport - # parameters, and other low-level controls. Certain parameters can also be - # applied individually to specific RPCs. See - # {::Google::Longrunning::Operations::Rest::Client::Configuration::Rpcs} - # for a list of RPCs that can be configured independently. - # - # Configuration can be applied globally to all clients, or to a single client - # on construction. - # - # @example - # - # # Modify the global config, setting the timeout for - # # list_operations to 20 seconds, - # # and all remaining timeouts to 10 seconds. - # ::Google::Longrunning::Operations::Rest::Client.configure do |config| - # config.timeout = 10.0 - # config.rpcs.list_operations.timeout = 20.0 - # end - # - # # Apply the above configuration only to a new client. - # client = ::Google::Longrunning::Operations::Rest::Client.new do |config| - # config.timeout = 10.0 - # config.rpcs.list_operations.timeout = 20.0 - # end - # - # @!attribute [rw] endpoint - # A custom service endpoint, as a hostname or hostname:port. The default is - # nil, indicating to use the default endpoint in the current universe domain. - # @return [::String,nil] - # @!attribute [rw] credentials - # Credentials to send with calls. You may provide any of the following types: - # * (`String`) The path to a service account key file in JSON format - # * (`Hash`) A service account key as a Hash - # * (`Google::Auth::Credentials`) A googleauth credentials object - # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) - # * (`Signet::OAuth2::Client`) A signet oauth2 client object - # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) - # * (`nil`) indicating no credentials - # - # Warning: If you accept a credential configuration (JSON file or Hash) from an - # external source for authentication to Google Cloud, you must validate it before - # providing it to a Google API client library. Providing an unvalidated credential - # configuration to Google APIs can compromise the security of your systems and data. - # For more information, refer to [Validate credential configurations from external - # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). - # @return [::Object] - # @!attribute [rw] scope - # The OAuth scopes - # @return [::Array<::String>] - # @!attribute [rw] lib_name - # The library name as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] lib_version - # The library version as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] timeout - # The call timeout in seconds. - # @return [::Numeric] - # @!attribute [rw] metadata - # Additional headers to be sent with the call. - # @return [::Hash{::Symbol=>::String}] - # @!attribute [rw] retry_policy - # The retry policy. The value is a hash with the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # @return [::Hash] - # @!attribute [rw] quota_project - # A separate project against which to charge quota. - # @return [::String] - # @!attribute [rw] universe_domain - # The universe domain within which to make requests. This determines the - # default endpoint URL. The default value of nil uses the environment - # universe (usually the default "googleapis.com" universe). - # @return [::String,nil] - # @!attribute [rw] logger - # A custom logger to use for request/response debug logging, or the value - # `:default` (the default) to construct a default logger, or `nil` to - # explicitly disable logging. - # @return [::Logger,:default,nil] - # - class Configuration - extend ::Gapic::Config - - # @private - # The endpoint specific to the default "googleapis.com" universe. Deprecated. - DEFAULT_ENDPOINT = "retail.googleapis.com" - - config_attr :endpoint, nil, ::String, nil - config_attr :credentials, nil do |value| - allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] - allowed.any? { |klass| klass === value } - end - config_attr :scope, nil, ::String, ::Array, nil - config_attr :lib_name, nil, ::String, nil - config_attr :lib_version, nil, ::String, nil - config_attr :timeout, nil, ::Numeric, nil - config_attr :metadata, nil, ::Hash, nil - config_attr :retry_policy, nil, ::Hash, ::Proc, nil - config_attr :quota_project, nil, ::String, nil - config_attr :universe_domain, nil, ::String, nil - config_attr :logger, :default, ::Logger, nil, :default - - # @private - def initialize parent_config = nil - @parent_config = parent_config unless parent_config.nil? - - yield self if block_given? - end - - ## - # Configurations for individual RPCs - # @return [Rpcs] - # - def rpcs - @rpcs ||= begin - parent_rpcs = nil - parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) - Rpcs.new parent_rpcs - end - end - - ## - # Configuration RPC class for the Operations API. - # - # Includes fields providing the configuration for each RPC in this service. - # Each configuration object is of type `Gapic::Config::Method` and includes - # the following configuration fields: - # - # * `timeout` (*type:* `Numeric`) - The call timeout in seconds - # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers - # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields - # include the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # - class Rpcs - ## - # RPC-specific configuration for `list_operations` - # @return [::Gapic::Config::Method] - # - attr_reader :list_operations - ## - # RPC-specific configuration for `get_operation` - # @return [::Gapic::Config::Method] - # - attr_reader :get_operation - ## - # RPC-specific configuration for `delete_operation` - # @return [::Gapic::Config::Method] - # - attr_reader :delete_operation - ## - # RPC-specific configuration for `cancel_operation` - # @return [::Gapic::Config::Method] - # - attr_reader :cancel_operation - - # @private - def initialize parent_rpcs = nil - list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations - @list_operations = ::Gapic::Config::Method.new list_operations_config - get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation - @get_operation = ::Gapic::Config::Method.new get_operation_config - delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation - @delete_operation = ::Gapic::Config::Method.new delete_operation_config - cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation - @cancel_operation = ::Gapic::Config::Method.new cancel_operation_config - - yield self if block_given? - end - end - end - end - - ## - # @private - # REST service stub for the Longrunning Operations API. - # Service stub contains baseline method implementations - # including transcoding, making the REST call, and deserialing the response. - class OperationsServiceStub - def initialize endpoint:, endpoint_template:, universe_domain:, credentials: - # These require statements are intentionally placed here to initialize - # the REST modules only when it's required. - require "gapic/rest" - - @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, - endpoint_template: endpoint_template, - universe_domain: universe_domain, - credentials: credentials - end - - ## - # Baseline implementation for the list_operations REST call - # - # @param request_pb [::Google::Longrunning::ListOperationsRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Longrunning::ListOperationsResponse] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Longrunning::ListOperationsResponse] - # A result object deserialized from the server's reply - def list_operations request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = OperationsServiceStub.transcode_list_operations_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "list_operations", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Longrunning::ListOperationsResponse.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the get_operation REST call - # - # @param request_pb [::Google::Longrunning::GetOperationRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Longrunning::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Longrunning::Operation] - # A result object deserialized from the server's reply - def get_operation request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = OperationsServiceStub.transcode_get_operation_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "get_operation", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the delete_operation REST call - # - # @param request_pb [::Google::Longrunning::DeleteOperationRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Protobuf::Empty] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Protobuf::Empty] - # A result object deserialized from the server's reply - def delete_operation request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = OperationsServiceStub.transcode_delete_operation_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "delete_operation", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the cancel_operation REST call - # - # @param request_pb [::Google::Longrunning::CancelOperationRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Protobuf::Empty] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Protobuf::Empty] - # A result object deserialized from the server's reply - def cancel_operation request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = OperationsServiceStub.transcode_cancel_operation_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "cancel_operation", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # @private - # - # GRPC transcoding helper method for the list_operations REST call - # - # @param request_pb [::Google::Longrunning::ListOperationsRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_list_operations_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :get, - uri_template: "/v2/{name}/operations", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/?$}, false] - ] - ) - .with_bindings( - uri_method: :get, - uri_template: "/v2/{name}/operations", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] - ] - ) - .with_bindings( - uri_method: :get, - uri_template: "/v2/{name}/operations", - matches: [ - ["name", %r{^projects/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the get_operation REST call - # - # @param request_pb [::Google::Longrunning::GetOperationRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_get_operation_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :get, - uri_template: "/v2/{name}", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/operations/[^/]+/?$}, false] - ] - ) - .with_bindings( - uri_method: :get, - uri_template: "/v2/{name}", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/branches/[^/]+/operations/[^/]+/?$}, false] - ] - ) - .with_bindings( - uri_method: :get, - uri_template: "/v2/{name}", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/operations/[^/]+/?$}, false] - ] - ) - .with_bindings( - uri_method: :get, - uri_template: "/v2/{name}", - matches: [ - ["name", %r{^projects/[^/]+/operations/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the delete_operation REST call - # - # @param request_pb [::Google::Longrunning::DeleteOperationRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_delete_operation_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :delete, - uri_template: "/v1/{name}", - matches: [ - ["name", %r{^operations(?:/(?<__wildcard__>.*))?$}, true] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the cancel_operation REST call - # - # @param request_pb [::Google::Longrunning::CancelOperationRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_cancel_operation_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :post, - uri_template: "/v1/{name}:cancel", - body: "*", - matches: [ - ["name", %r{^operations(?:/(?<__wildcard__>.*))?$}, true] - ] - ) - transcoder.transcode request_pb - end - end - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/rest/service_stub.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/rest/service_stub.rb deleted file mode 100644 index b35aff3ed4cc..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service/rest/service_stub.rb +++ /dev/null @@ -1,143 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "google/cloud/retail/v2/analytics_service_pb" - -module Google - module Cloud - module Retail - module V2 - module AnalyticsService - module Rest - ## - # REST service stub for the AnalyticsService service. - # Service stub contains baseline method implementations - # including transcoding, making the REST call, and deserialing the response. - # - class ServiceStub - # @private - def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger: - # These require statements are intentionally placed here to initialize - # the REST modules only when it's required. - require "gapic/rest" - - @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, - endpoint_template: endpoint_template, - universe_domain: universe_domain, - credentials: credentials, - numeric_enums: true, - service_name: self.class, - raise_faraday_errors: false, - logger: logger - end - - ## - # The effective universe domain - # - # @return [String] - # - def universe_domain - @client_stub.universe_domain - end - - ## - # The effective endpoint - # - # @return [String] - # - def endpoint - @client_stub.endpoint - end - - ## - # The logger used for request/response debug logging. - # - # @return [Logger] - # - def logger stub: false - stub ? @client_stub.stub_logger : @client_stub.logger - end - - ## - # Baseline implementation for the export_analytics_metrics REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::ExportAnalyticsMetricsRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Longrunning::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Longrunning::Operation] - # A result object deserialized from the server's reply - def export_analytics_metrics request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_export_analytics_metrics_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "export_analytics_metrics", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # @private - # - # GRPC transcoding helper method for the export_analytics_metrics REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::ExportAnalyticsMetricsRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_export_analytics_metrics_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :post, - uri_template: "/v2/{catalog}:exportAnalyticsMetrics", - body: "*", - matches: [ - ["catalog", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - end - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service_pb.rb deleted file mode 100644 index 8ce3ddaf6f69..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service_pb.rb +++ /dev/null @@ -1,27 +0,0 @@ -# frozen_string_literal: true -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/retail/v2/analytics_service.proto - -require 'google/protobuf' - -require 'google/api/annotations_pb' -require 'google/api/client_pb' -require 'google/api/field_behavior_pb' -require 'google/api/resource_pb' -require 'google/cloud/retail/v2/export_config_pb' -require 'google/longrunning/operations_pb' - - -descriptor_data = "\n.google/cloud/retail/v2/analytics_service.proto\x12\x16google.cloud.retail.v2\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a*google/cloud/retail/v2/export_config.proto\x1a#google/longrunning/operations.proto2\x83\x03\n\x10\x41nalyticsService\x12\xa3\x02\n\x16\x45xportAnalyticsMetrics\x12\x35.google.cloud.retail.v2.ExportAnalyticsMetricsRequest\x1a\x1d.google.longrunning.Operation\"\xb2\x01\xca\x41^\n5google.cloud.retail.v2.ExportAnalyticsMetricsResponse\x12%google.cloud.retail.v2.ExportMetadata\x82\xd3\xe4\x93\x02K\"F/v2/{catalog=projects/*/locations/*/catalogs/*}:exportAnalyticsMetrics:\x01*\x1aI\xca\x41\x15retail.googleapis.com\xd2\x41.https://www.googleapis.com/auth/cloud-platformB\xc0\x01\n\x1a\x63om.google.cloud.retail.v2B\x15\x41nalyticsServiceProtoP\x01Z2cloud.google.com/go/retail/apiv2/retailpb;retailpb\xa2\x02\x06RETAIL\xaa\x02\x16Google.Cloud.Retail.V2\xca\x02\x16Google\\Cloud\\Retail\\V2\xea\x02\x19Google::Cloud::Retail::V2b\x06proto3" - -pool = ::Google::Protobuf::DescriptorPool.generated_pool -pool.add_serialized_file(descriptor_data) - -module Google - module Cloud - module Retail - module V2 - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service_services_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service_services_pb.rb deleted file mode 100644 index b9425168a3f7..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/analytics_service_services_pb.rb +++ /dev/null @@ -1,49 +0,0 @@ -# Generated by the protocol buffer compiler. DO NOT EDIT! -# Source: google/cloud/retail/v2/analytics_service.proto for package 'Google.Cloud.Retail.V2' -# Original file comments: -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -require 'grpc' -require 'google/cloud/retail/v2/analytics_service_pb' - -module Google - module Cloud - module Retail - module V2 - module AnalyticsService - # Service for managing & accessing retail search business metric. - # Retail recommendation business metric is currently not available. - class Service - - include ::GRPC::GenericService - - self.marshal_class_method = :encode - self.unmarshal_class_method = :decode - self.service_name = 'google.cloud.retail.v2.AnalyticsService' - - # Exports analytics metrics. - # - # `Operation.response` is of type `ExportAnalyticsMetricsResponse`. - # `Operation.metadata` is of type `ExportMetadata`. - rpc :ExportAnalyticsMetrics, ::Google::Cloud::Retail::V2::ExportAnalyticsMetricsRequest, ::Google::Longrunning::Operation - end - - Stub = Service.rpc_stub_class - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_pb.rb deleted file mode 100644 index 251f19b9f439..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_pb.rb +++ /dev/null @@ -1,42 +0,0 @@ -# frozen_string_literal: true -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/retail/v2/catalog.proto - -require 'google/protobuf' - -require 'google/api/field_behavior_pb' -require 'google/api/resource_pb' -require 'google/cloud/retail/v2/common_pb' -require 'google/cloud/retail/v2/import_config_pb' -require 'google/protobuf/timestamp_pb' - - -descriptor_data = "\n$google/cloud/retail/v2/catalog.proto\x12\x16google.cloud.retail.v2\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a#google/cloud/retail/v2/common.proto\x1a*google/cloud/retail/v2/import_config.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"^\n\x12ProductLevelConfig\x12\x1e\n\x16ingestion_product_type\x18\x01 \x01(\t\x12(\n merchant_center_product_id_field\x18\x02 \x01(\t\"\xf7\x0f\n\x10\x43\x61talogAttribute\x12\x10\n\x03key\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x13\n\x06in_use\x18\t \x01(\x08\x42\x03\xe0\x41\x03\x12I\n\x04type\x18\n \x01(\x0e\x32\x36.google.cloud.retail.v2.CatalogAttribute.AttributeTypeB\x03\xe0\x41\x03\x12R\n\x10indexable_option\x18\x05 \x01(\x0e\x32\x38.google.cloud.retail.v2.CatalogAttribute.IndexableOption\x12\x61\n\x18\x64ynamic_facetable_option\x18\x06 \x01(\x0e\x32?.google.cloud.retail.v2.CatalogAttribute.DynamicFacetableOption\x12T\n\x11searchable_option\x18\x07 \x01(\x0e\x32\x39.google.cloud.retail.v2.CatalogAttribute.SearchableOption\x12_\n\x17\x65xact_searchable_option\x18\x0b \x01(\x0e\x32>.google.cloud.retail.v2.CatalogAttribute.ExactSearchableOption\x12V\n\x12retrievable_option\x18\x0c \x01(\x0e\x32:.google.cloud.retail.v2.CatalogAttribute.RetrievableOption\x12J\n\x0c\x66\x61\x63\x65t_config\x18\r \x01(\x0b\x32\x34.google.cloud.retail.v2.CatalogAttribute.FacetConfig\x1a\xe9\x05\n\x0b\x46\x61\x63\x65tConfig\x12\x39\n\x0f\x66\x61\x63\x65t_intervals\x18\x01 \x03(\x0b\x32 .google.cloud.retail.v2.Interval\x12\x65\n\x14ignored_facet_values\x18\x02 \x03(\x0b\x32G.google.cloud.retail.v2.CatalogAttribute.FacetConfig.IgnoredFacetValues\x12\x62\n\x13merged_facet_values\x18\x03 \x03(\x0b\x32\x45.google.cloud.retail.v2.CatalogAttribute.FacetConfig.MergedFacetValue\x12V\n\x0cmerged_facet\x18\x04 \x01(\x0b\x32@.google.cloud.retail.v2.CatalogAttribute.FacetConfig.MergedFacet\x12X\n\rrerank_config\x18\x05 \x01(\x0b\x32\x41.google.cloud.retail.v2.CatalogAttribute.FacetConfig.RerankConfig\x1a\x82\x01\n\x12IgnoredFacetValues\x12\x0e\n\x06values\x18\x01 \x03(\t\x12.\n\nstart_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12,\n\x08\x65nd_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x1a\x38\n\x10MergedFacetValue\x12\x0e\n\x06values\x18\x01 \x03(\t\x12\x14\n\x0cmerged_value\x18\x02 \x01(\t\x1a\'\n\x0bMergedFacet\x12\x18\n\x10merged_facet_key\x18\x01 \x01(\t\x1a:\n\x0cRerankConfig\x12\x14\n\x0crerank_facet\x18\x01 \x01(\x08\x12\x14\n\x0c\x66\x61\x63\x65t_values\x18\x02 \x03(\t\"8\n\rAttributeType\x12\x0b\n\x07UNKNOWN\x10\x00\x12\x0b\n\x07TEXTUAL\x10\x01\x12\r\n\tNUMERICAL\x10\x02\"b\n\x0fIndexableOption\x12 \n\x1cINDEXABLE_OPTION_UNSPECIFIED\x10\x00\x12\x15\n\x11INDEXABLE_ENABLED\x10\x01\x12\x16\n\x12INDEXABLE_DISABLED\x10\x02\"\x81\x01\n\x16\x44ynamicFacetableOption\x12(\n$DYNAMIC_FACETABLE_OPTION_UNSPECIFIED\x10\x00\x12\x1d\n\x19\x44YNAMIC_FACETABLE_ENABLED\x10\x01\x12\x1e\n\x1a\x44YNAMIC_FACETABLE_DISABLED\x10\x02\"f\n\x10SearchableOption\x12!\n\x1dSEARCHABLE_OPTION_UNSPECIFIED\x10\x00\x12\x16\n\x12SEARCHABLE_ENABLED\x10\x01\x12\x17\n\x13SEARCHABLE_DISABLED\x10\x02\"}\n\x15\x45xactSearchableOption\x12\'\n#EXACT_SEARCHABLE_OPTION_UNSPECIFIED\x10\x00\x12\x1c\n\x18\x45XACT_SEARCHABLE_ENABLED\x10\x01\x12\x1d\n\x19\x45XACT_SEARCHABLE_DISABLED\x10\x02\"j\n\x11RetrievableOption\x12\"\n\x1eRETRIEVABLE_OPTION_UNSPECIFIED\x10\x00\x12\x17\n\x13RETRIEVABLE_ENABLED\x10\x01\x12\x18\n\x14RETRIEVABLE_DISABLED\x10\x02\"\xb6\x03\n\x10\x41ttributesConfig\x12\x14\n\x04name\x18\x01 \x01(\tB\x06\xe0\x41\x02\xe0\x41\x05\x12[\n\x12\x63\x61talog_attributes\x18\x02 \x03(\x0b\x32?.google.cloud.retail.v2.AttributesConfig.CatalogAttributesEntry\x12Q\n\x16\x61ttribute_config_level\x18\x03 \x01(\x0e\x32,.google.cloud.retail.v2.AttributeConfigLevelB\x03\xe0\x41\x03\x1a\x62\n\x16\x43\x61talogAttributesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x37\n\x05value\x18\x02 \x01(\x0b\x32(.google.cloud.retail.v2.CatalogAttribute:\x02\x38\x01:x\xea\x41u\n&retail.googleapis.com/AttributesConfig\x12Kprojects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig\"\x99\x05\n\x10\x43ompletionConfig\x12\x14\n\x04name\x18\x01 \x01(\tB\x06\xe0\x41\x02\xe0\x41\x05\x12\x16\n\x0ematching_order\x18\x02 \x01(\t\x12\x17\n\x0fmax_suggestions\x18\x03 \x01(\x05\x12\x19\n\x11min_prefix_length\x18\x04 \x01(\x05\x12\x15\n\rauto_learning\x18\x0b \x01(\x08\x12X\n\x18suggestions_input_config\x18\x05 \x01(\x0b\x32\x31.google.cloud.retail.v2.CompletionDataInputConfigB\x03\xe0\x41\x03\x12.\n!last_suggestions_import_operation\x18\x06 \x01(\tB\x03\xe0\x41\x03\x12U\n\x15\x64\x65nylist_input_config\x18\x07 \x01(\x0b\x32\x31.google.cloud.retail.v2.CompletionDataInputConfigB\x03\xe0\x41\x03\x12+\n\x1elast_denylist_import_operation\x18\x08 \x01(\tB\x03\xe0\x41\x03\x12V\n\x16\x61llowlist_input_config\x18\t \x01(\x0b\x32\x31.google.cloud.retail.v2.CompletionDataInputConfigB\x03\xe0\x41\x03\x12,\n\x1flast_allowlist_import_operation\x18\n \x01(\tB\x03\xe0\x41\x03:x\xea\x41u\n&retail.googleapis.com/CompletionConfig\x12Kprojects/{project}/locations/{location}/catalogs/{catalog}/completionConfig\"\xec\x01\n\x07\x43\x61talog\x12\x14\n\x04name\x18\x01 \x01(\tB\x06\xe0\x41\x02\xe0\x41\x05\x12\x1c\n\x0c\x64isplay_name\x18\x02 \x01(\tB\x06\xe0\x41\x02\xe0\x41\x05\x12M\n\x14product_level_config\x18\x04 \x01(\x0b\x32*.google.cloud.retail.v2.ProductLevelConfigB\x03\xe0\x41\x02:^\xea\x41[\n\x1dretail.googleapis.com/Catalog\x12:projects/{project}/locations/{location}/catalogs/{catalog}B\xb7\x01\n\x1a\x63om.google.cloud.retail.v2B\x0c\x43\x61talogProtoP\x01Z2cloud.google.com/go/retail/apiv2/retailpb;retailpb\xa2\x02\x06RETAIL\xaa\x02\x16Google.Cloud.Retail.V2\xca\x02\x16Google\\Cloud\\Retail\\V2\xea\x02\x19Google::Cloud::Retail::V2b\x06proto3" - -pool = ::Google::Protobuf::DescriptorPool.generated_pool -pool.add_serialized_file(descriptor_data) - -module Google - module Cloud - module Retail - module V2 - ProductLevelConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ProductLevelConfig").msgclass - CatalogAttribute = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CatalogAttribute").msgclass - CatalogAttribute::FacetConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CatalogAttribute.FacetConfig").msgclass - CatalogAttribute::FacetConfig::IgnoredFacetValues = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CatalogAttribute.FacetConfig.IgnoredFacetValues").msgclass - CatalogAttribute::FacetConfig::MergedFacetValue = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CatalogAttribute.FacetConfig.MergedFacetValue").msgclass - CatalogAttribute::FacetConfig::MergedFacet = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CatalogAttribute.FacetConfig.MergedFacet").msgclass - CatalogAttribute::FacetConfig::RerankConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CatalogAttribute.FacetConfig.RerankConfig").msgclass - CatalogAttribute::AttributeType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CatalogAttribute.AttributeType").enummodule - CatalogAttribute::IndexableOption = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CatalogAttribute.IndexableOption").enummodule - CatalogAttribute::DynamicFacetableOption = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CatalogAttribute.DynamicFacetableOption").enummodule - CatalogAttribute::SearchableOption = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CatalogAttribute.SearchableOption").enummodule - CatalogAttribute::ExactSearchableOption = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CatalogAttribute.ExactSearchableOption").enummodule - CatalogAttribute::RetrievableOption = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CatalogAttribute.RetrievableOption").enummodule - AttributesConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.AttributesConfig").msgclass - CompletionConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CompletionConfig").msgclass - Catalog = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Catalog").msgclass - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service.rb deleted file mode 100644 index a11f97aecb81..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service.rb +++ /dev/null @@ -1,55 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "gapic/common" -require "gapic/config" -require "gapic/config/method" - -require "google/cloud/retail/v2/version" - -require "google/cloud/retail/v2/catalog_service/credentials" -require "google/cloud/retail/v2/catalog_service/paths" -require "google/cloud/retail/v2/catalog_service/client" -require "google/cloud/retail/v2/catalog_service/rest" - -module Google - module Cloud - module Retail - module V2 - ## - # Service for managing catalog configuration. - # - # @example Load this service and instantiate a gRPC client - # - # require "google/cloud/retail/v2/catalog_service" - # client = ::Google::Cloud::Retail::V2::CatalogService::Client.new - # - # @example Load this service and instantiate a REST client - # - # require "google/cloud/retail/v2/catalog_service/rest" - # client = ::Google::Cloud::Retail::V2::CatalogService::Rest::Client.new - # - module CatalogService - end - end - end - end -end - -helper_path = ::File.join __dir__, "catalog_service", "helpers.rb" -require "google/cloud/retail/v2/catalog_service/helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/client.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/client.rb deleted file mode 100644 index 47fce9e01293..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/client.rb +++ /dev/null @@ -1,1590 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "google/cloud/errors" -require "google/cloud/retail/v2/catalog_service_pb" -require "google/cloud/location" - -module Google - module Cloud - module Retail - module V2 - module CatalogService - ## - # Client for the CatalogService service. - # - # Service for managing catalog configuration. - # - class Client - # @private - API_VERSION = "" - - # @private - DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" - - include Paths - - # @private - attr_reader :catalog_service_stub - - ## - # Configure the CatalogService Client class. - # - # See {::Google::Cloud::Retail::V2::CatalogService::Client::Configuration} - # for a description of the configuration fields. - # - # @example - # - # # Modify the configuration for all CatalogService clients - # ::Google::Cloud::Retail::V2::CatalogService::Client.configure do |config| - # config.timeout = 10.0 - # end - # - # @yield [config] Configure the Client client. - # @yieldparam config [Client::Configuration] - # - # @return [Client::Configuration] - # - def self.configure - @configure ||= begin - namespace = ["Google", "Cloud", "Retail", "V2"] - parent_config = while namespace.any? - parent_name = namespace.join "::" - parent_const = const_get parent_name - break parent_const.configure if parent_const.respond_to? :configure - namespace.pop - end - default_config = Client::Configuration.new parent_config - - default_config.timeout = 5.0 - default_config.retry_policy = { - initial_delay: 0.1, max_delay: 5.0, multiplier: 1.3, retry_codes: [14, 4] - } - - default_config - end - yield @configure if block_given? - @configure - end - - ## - # Configure the CatalogService Client instance. - # - # The configuration is set to the derived mode, meaning that values can be changed, - # but structural changes (adding new fields, etc.) are not allowed. Structural changes - # should be made on {Client.configure}. - # - # See {::Google::Cloud::Retail::V2::CatalogService::Client::Configuration} - # for a description of the configuration fields. - # - # @yield [config] Configure the Client client. - # @yieldparam config [Client::Configuration] - # - # @return [Client::Configuration] - # - def configure - yield @config if block_given? - @config - end - - ## - # The effective universe domain - # - # @return [String] - # - def universe_domain - @catalog_service_stub.universe_domain - end - - ## - # Create a new CatalogService client object. - # - # @example - # - # # Create a client using the default configuration - # client = ::Google::Cloud::Retail::V2::CatalogService::Client.new - # - # # Create a client using a custom configuration - # client = ::Google::Cloud::Retail::V2::CatalogService::Client.new do |config| - # config.timeout = 10.0 - # end - # - # @yield [config] Configure the CatalogService client. - # @yieldparam config [Client::Configuration] - # - def initialize - # These require statements are intentionally placed here to initialize - # the gRPC module only when it's required. - # See https://github.com/googleapis/toolkit/issues/446 - require "gapic/grpc" - require "google/cloud/retail/v2/catalog_service_services_pb" - - # Create the configuration object - @config = Configuration.new Client.configure - - # Yield the configuration if needed - yield @config if block_given? - - # Create credentials - credentials = @config.credentials - # Use self-signed JWT if the endpoint is unchanged from default, - # but only if the default endpoint does not have a region prefix. - enable_self_signed_jwt = @config.endpoint.nil? || - (@config.endpoint == Configuration::DEFAULT_ENDPOINT && - !@config.endpoint.split(".").first.include?("-")) - credentials ||= Credentials.default scope: @config.scope, - enable_self_signed_jwt: enable_self_signed_jwt - if credentials.is_a?(::String) || credentials.is_a?(::Hash) - credentials = Credentials.new credentials, scope: @config.scope - end - @quota_project_id = @config.quota_project - @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id - - @catalog_service_stub = ::Gapic::ServiceStub.new( - ::Google::Cloud::Retail::V2::CatalogService::Stub, - credentials: credentials, - endpoint: @config.endpoint, - endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, - universe_domain: @config.universe_domain, - channel_args: @config.channel_args, - interceptors: @config.interceptors, - channel_pool_config: @config.channel_pool, - logger: @config.logger - ) - - @catalog_service_stub.stub_logger&.info do |entry| - entry.set_system_name - entry.set_service - entry.message = "Created client for #{entry.service}" - entry.set_credentials_fields credentials - entry.set "customEndpoint", @config.endpoint if @config.endpoint - entry.set "defaultTimeout", @config.timeout if @config.timeout - entry.set "quotaProject", @quota_project_id if @quota_project_id - end - - @location_client = Google::Cloud::Location::Locations::Client.new do |config| - config.credentials = credentials - config.quota_project = @quota_project_id - config.endpoint = @catalog_service_stub.endpoint - config.universe_domain = @catalog_service_stub.universe_domain - config.logger = @catalog_service_stub.logger if config.respond_to? :logger= - end - end - - ## - # Get the associated client for mix-in of the Locations. - # - # @return [Google::Cloud::Location::Locations::Client] - # - attr_reader :location_client - - ## - # The logger used for request/response debug logging. - # - # @return [Logger] - # - def logger - @catalog_service_stub.logger - end - - # Service calls - - ## - # Lists all the {::Google::Cloud::Retail::V2::Catalog Catalog}s associated with - # the project. - # - # @overload list_catalogs(request, options = nil) - # Pass arguments to `list_catalogs` via a request object, either of type - # {::Google::Cloud::Retail::V2::ListCatalogsRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::ListCatalogsRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload list_catalogs(parent: nil, page_size: nil, page_token: nil) - # Pass arguments to `list_catalogs` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. The account resource name with an associated location. - # - # If the caller does not have permission to list - # {::Google::Cloud::Retail::V2::Catalog Catalog}s under this location, regardless - # of whether or not this location exists, a PERMISSION_DENIED error is - # returned. - # @param page_size [::Integer] - # Maximum number of {::Google::Cloud::Retail::V2::Catalog Catalog}s to return. If - # unspecified, defaults to 50. The maximum allowed value is 1000. Values - # above 1000 will be coerced to 1000. - # - # If this field is negative, an INVALID_ARGUMENT is returned. - # @param page_token [::String] - # A page token - # {::Google::Cloud::Retail::V2::ListCatalogsResponse#next_page_token ListCatalogsResponse.next_page_token}, - # received from a previous - # {::Google::Cloud::Retail::V2::CatalogService::Client#list_catalogs CatalogService.ListCatalogs} - # call. Provide this to retrieve the subsequent page. - # - # When paginating, all other parameters provided to - # {::Google::Cloud::Retail::V2::CatalogService::Client#list_catalogs CatalogService.ListCatalogs} - # must match the call that provided the page token. Otherwise, an - # INVALID_ARGUMENT error is returned. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Retail::V2::Catalog>] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::PagedEnumerable<::Google::Cloud::Retail::V2::Catalog>] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::CatalogService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::ListCatalogsRequest.new - # - # # Call the list_catalogs method. - # result = client.list_catalogs request - # - # # The returned object is of type Gapic::PagedEnumerable. You can iterate - # # over elements, and API calls will be issued to fetch pages as needed. - # result.each do |item| - # # Each element is of type ::Google::Cloud::Retail::V2::Catalog. - # p item - # end - # - def list_catalogs request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ListCatalogsRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.list_catalogs.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.parent - header_params["parent"] = request.parent - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.list_catalogs.timeout, - metadata: metadata, - retry_policy: @config.rpcs.list_catalogs.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @catalog_service_stub.call_rpc :list_catalogs, request, options: options do |response, operation| - response = ::Gapic::PagedEnumerable.new @catalog_service_stub, :list_catalogs, request, response, operation, options - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Updates the {::Google::Cloud::Retail::V2::Catalog Catalog}s. - # - # @overload update_catalog(request, options = nil) - # Pass arguments to `update_catalog` via a request object, either of type - # {::Google::Cloud::Retail::V2::UpdateCatalogRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::UpdateCatalogRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload update_catalog(catalog: nil, update_mask: nil) - # Pass arguments to `update_catalog` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param catalog [::Google::Cloud::Retail::V2::Catalog, ::Hash] - # Required. The {::Google::Cloud::Retail::V2::Catalog Catalog} to update. - # - # If the caller does not have permission to update the - # {::Google::Cloud::Retail::V2::Catalog Catalog}, regardless of whether or not it - # exists, a PERMISSION_DENIED error is returned. - # - # If the {::Google::Cloud::Retail::V2::Catalog Catalog} to update does not exist, - # a NOT_FOUND error is returned. - # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] - # Indicates which fields in the provided - # {::Google::Cloud::Retail::V2::Catalog Catalog} to update. - # - # If an unsupported or unknown field is provided, an INVALID_ARGUMENT error - # is returned. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Cloud::Retail::V2::Catalog] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Cloud::Retail::V2::Catalog] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::CatalogService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::UpdateCatalogRequest.new - # - # # Call the update_catalog method. - # result = client.update_catalog request - # - # # The returned object is of type Google::Cloud::Retail::V2::Catalog. - # p result - # - def update_catalog request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::UpdateCatalogRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.update_catalog.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.catalog&.name - header_params["catalog.name"] = request.catalog.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.update_catalog.timeout, - metadata: metadata, - retry_policy: @config.rpcs.update_catalog.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @catalog_service_stub.call_rpc :update_catalog, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Set a specified branch id as default branch. API methods such as - # {::Google::Cloud::Retail::V2::SearchService::Client#search SearchService.Search}, - # {::Google::Cloud::Retail::V2::ProductService::Client#get_product ProductService.GetProduct}, - # {::Google::Cloud::Retail::V2::ProductService::Client#list_products ProductService.ListProducts} - # will treat requests using "default_branch" to the actual branch id set as - # default. - # - # For example, if `projects/*/locations/*/catalogs/*/branches/1` is set as - # default, setting - # {::Google::Cloud::Retail::V2::SearchRequest#branch SearchRequest.branch} to - # `projects/*/locations/*/catalogs/*/branches/default_branch` is equivalent - # to setting - # {::Google::Cloud::Retail::V2::SearchRequest#branch SearchRequest.branch} to - # `projects/*/locations/*/catalogs/*/branches/1`. - # - # Using multiple branches can be useful when developers would like - # to have a staging branch to test and verify for future usage. When it - # becomes ready, developers switch on the staging branch using this API - # while keeping using - # `projects/*/locations/*/catalogs/*/branches/default_branch` as - # {::Google::Cloud::Retail::V2::SearchRequest#branch SearchRequest.branch} to - # route the traffic to this staging branch. - # - # CAUTION: If you have live predict/search traffic, switching the default - # branch could potentially cause outages if the ID space of the new branch - # is very different from the old one. - # - # More specifically: - # - # * PredictionService will only return product IDs from branch \\{newBranch}. - # * SearchService will only return product IDs from branch \\{newBranch} - # (if branch is not explicitly set). - # * UserEventService will only join events with products from branch - # \\{newBranch}. - # - # @overload set_default_branch(request, options = nil) - # Pass arguments to `set_default_branch` via a request object, either of type - # {::Google::Cloud::Retail::V2::SetDefaultBranchRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::SetDefaultBranchRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload set_default_branch(catalog: nil, branch_id: nil, note: nil, force: nil) - # Pass arguments to `set_default_branch` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param catalog [::String] - # Full resource name of the catalog, such as - # `projects/*/locations/global/catalogs/default_catalog`. - # @param branch_id [::String] - # The final component of the resource name of a branch. - # - # This field must be one of "0", "1" or "2". Otherwise, an INVALID_ARGUMENT - # error is returned. - # - # If there are no sufficient active products in the targeted branch and - # {::Google::Cloud::Retail::V2::SetDefaultBranchRequest#force force} is not set, a - # FAILED_PRECONDITION error is returned. - # @param note [::String] - # Some note on this request, this can be retrieved by - # {::Google::Cloud::Retail::V2::CatalogService::Client#get_default_branch CatalogService.GetDefaultBranch} - # before next valid default branch set occurs. - # - # This field must be a UTF-8 encoded string with a length limit of 1,000 - # characters. Otherwise, an INVALID_ARGUMENT error is returned. - # @param force [::Boolean] - # If set to true, it permits switching to a branch with - # {::Google::Cloud::Retail::V2::SetDefaultBranchRequest#branch_id branch_id} even - # if it has no sufficient active products. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Protobuf::Empty] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Protobuf::Empty] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::CatalogService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::SetDefaultBranchRequest.new - # - # # Call the set_default_branch method. - # result = client.set_default_branch request - # - # # The returned object is of type Google::Protobuf::Empty. - # p result - # - def set_default_branch request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::SetDefaultBranchRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.set_default_branch.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.catalog - header_params["catalog"] = request.catalog - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.set_default_branch.timeout, - metadata: metadata, - retry_policy: @config.rpcs.set_default_branch.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @catalog_service_stub.call_rpc :set_default_branch, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Get which branch is currently default branch set by - # {::Google::Cloud::Retail::V2::CatalogService::Client#set_default_branch CatalogService.SetDefaultBranch} - # method under a specified parent catalog. - # - # @overload get_default_branch(request, options = nil) - # Pass arguments to `get_default_branch` via a request object, either of type - # {::Google::Cloud::Retail::V2::GetDefaultBranchRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::GetDefaultBranchRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload get_default_branch(catalog: nil) - # Pass arguments to `get_default_branch` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param catalog [::String] - # The parent catalog resource name, such as - # `projects/*/locations/global/catalogs/default_catalog`. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Cloud::Retail::V2::GetDefaultBranchResponse] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Cloud::Retail::V2::GetDefaultBranchResponse] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::CatalogService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::GetDefaultBranchRequest.new - # - # # Call the get_default_branch method. - # result = client.get_default_branch request - # - # # The returned object is of type Google::Cloud::Retail::V2::GetDefaultBranchResponse. - # p result - # - def get_default_branch request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::GetDefaultBranchRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.get_default_branch.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.catalog - header_params["catalog"] = request.catalog - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.get_default_branch.timeout, - metadata: metadata, - retry_policy: @config.rpcs.get_default_branch.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @catalog_service_stub.call_rpc :get_default_branch, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Gets a {::Google::Cloud::Retail::V2::CompletionConfig CompletionConfig}. - # - # @overload get_completion_config(request, options = nil) - # Pass arguments to `get_completion_config` via a request object, either of type - # {::Google::Cloud::Retail::V2::GetCompletionConfigRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::GetCompletionConfigRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload get_completion_config(name: nil) - # Pass arguments to `get_completion_config` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # Required. Full CompletionConfig resource name. Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig` - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Cloud::Retail::V2::CompletionConfig] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Cloud::Retail::V2::CompletionConfig] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::CatalogService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::GetCompletionConfigRequest.new - # - # # Call the get_completion_config method. - # result = client.get_completion_config request - # - # # The returned object is of type Google::Cloud::Retail::V2::CompletionConfig. - # p result - # - def get_completion_config request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::GetCompletionConfigRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.get_completion_config.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.name - header_params["name"] = request.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.get_completion_config.timeout, - metadata: metadata, - retry_policy: @config.rpcs.get_completion_config.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @catalog_service_stub.call_rpc :get_completion_config, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Updates the {::Google::Cloud::Retail::V2::CompletionConfig CompletionConfig}s. - # - # @overload update_completion_config(request, options = nil) - # Pass arguments to `update_completion_config` via a request object, either of type - # {::Google::Cloud::Retail::V2::UpdateCompletionConfigRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::UpdateCompletionConfigRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload update_completion_config(completion_config: nil, update_mask: nil) - # Pass arguments to `update_completion_config` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param completion_config [::Google::Cloud::Retail::V2::CompletionConfig, ::Hash] - # Required. The {::Google::Cloud::Retail::V2::CompletionConfig CompletionConfig} - # to update. - # - # If the caller does not have permission to update the - # {::Google::Cloud::Retail::V2::CompletionConfig CompletionConfig}, then a - # PERMISSION_DENIED error is returned. - # - # If the {::Google::Cloud::Retail::V2::CompletionConfig CompletionConfig} to - # update does not exist, a NOT_FOUND error is returned. - # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] - # Indicates which fields in the provided - # {::Google::Cloud::Retail::V2::CompletionConfig CompletionConfig} to update. The - # following are the only supported fields: - # - # * {::Google::Cloud::Retail::V2::CompletionConfig#matching_order CompletionConfig.matching_order} - # * {::Google::Cloud::Retail::V2::CompletionConfig#max_suggestions CompletionConfig.max_suggestions} - # * {::Google::Cloud::Retail::V2::CompletionConfig#min_prefix_length CompletionConfig.min_prefix_length} - # * {::Google::Cloud::Retail::V2::CompletionConfig#auto_learning CompletionConfig.auto_learning} - # - # If not set, all supported fields are updated. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Cloud::Retail::V2::CompletionConfig] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Cloud::Retail::V2::CompletionConfig] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::CatalogService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::UpdateCompletionConfigRequest.new - # - # # Call the update_completion_config method. - # result = client.update_completion_config request - # - # # The returned object is of type Google::Cloud::Retail::V2::CompletionConfig. - # p result - # - def update_completion_config request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::UpdateCompletionConfigRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.update_completion_config.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.completion_config&.name - header_params["completion_config.name"] = request.completion_config.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.update_completion_config.timeout, - metadata: metadata, - retry_policy: @config.rpcs.update_completion_config.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @catalog_service_stub.call_rpc :update_completion_config, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Gets an {::Google::Cloud::Retail::V2::AttributesConfig AttributesConfig}. - # - # @overload get_attributes_config(request, options = nil) - # Pass arguments to `get_attributes_config` via a request object, either of type - # {::Google::Cloud::Retail::V2::GetAttributesConfigRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::GetAttributesConfigRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload get_attributes_config(name: nil) - # Pass arguments to `get_attributes_config` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # Required. Full AttributesConfig resource name. Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Cloud::Retail::V2::AttributesConfig] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Cloud::Retail::V2::AttributesConfig] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::CatalogService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::GetAttributesConfigRequest.new - # - # # Call the get_attributes_config method. - # result = client.get_attributes_config request - # - # # The returned object is of type Google::Cloud::Retail::V2::AttributesConfig. - # p result - # - def get_attributes_config request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::GetAttributesConfigRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.get_attributes_config.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.name - header_params["name"] = request.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.get_attributes_config.timeout, - metadata: metadata, - retry_policy: @config.rpcs.get_attributes_config.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @catalog_service_stub.call_rpc :get_attributes_config, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Updates the {::Google::Cloud::Retail::V2::AttributesConfig AttributesConfig}. - # - # The catalog attributes in the request will be updated in the catalog, or - # inserted if they do not exist. Existing catalog attributes not included in - # the request will remain unchanged. Attributes that are assigned to - # products, but do not exist at the catalog level, are always included in the - # response. The product attribute is assigned default values for missing - # catalog attribute fields, e.g., searchable and dynamic facetable options. - # - # @overload update_attributes_config(request, options = nil) - # Pass arguments to `update_attributes_config` via a request object, either of type - # {::Google::Cloud::Retail::V2::UpdateAttributesConfigRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::UpdateAttributesConfigRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload update_attributes_config(attributes_config: nil, update_mask: nil) - # Pass arguments to `update_attributes_config` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param attributes_config [::Google::Cloud::Retail::V2::AttributesConfig, ::Hash] - # Required. The {::Google::Cloud::Retail::V2::AttributesConfig AttributesConfig} - # to update. - # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] - # Indicates which fields in the provided - # {::Google::Cloud::Retail::V2::AttributesConfig AttributesConfig} to update. The - # following is the only supported field: - # - # * {::Google::Cloud::Retail::V2::AttributesConfig#catalog_attributes AttributesConfig.catalog_attributes} - # - # If not set, all supported fields are updated. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Cloud::Retail::V2::AttributesConfig] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Cloud::Retail::V2::AttributesConfig] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::CatalogService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::UpdateAttributesConfigRequest.new - # - # # Call the update_attributes_config method. - # result = client.update_attributes_config request - # - # # The returned object is of type Google::Cloud::Retail::V2::AttributesConfig. - # p result - # - def update_attributes_config request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::UpdateAttributesConfigRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.update_attributes_config.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.attributes_config&.name - header_params["attributes_config.name"] = request.attributes_config.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.update_attributes_config.timeout, - metadata: metadata, - retry_policy: @config.rpcs.update_attributes_config.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @catalog_service_stub.call_rpc :update_attributes_config, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Adds the specified - # {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} to the - # {::Google::Cloud::Retail::V2::AttributesConfig AttributesConfig}. - # - # If the {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} to add - # already exists, an ALREADY_EXISTS error is returned. - # - # @overload add_catalog_attribute(request, options = nil) - # Pass arguments to `add_catalog_attribute` via a request object, either of type - # {::Google::Cloud::Retail::V2::AddCatalogAttributeRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::AddCatalogAttributeRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload add_catalog_attribute(attributes_config: nil, catalog_attribute: nil) - # Pass arguments to `add_catalog_attribute` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param attributes_config [::String] - # Required. Full AttributesConfig resource name. Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` - # @param catalog_attribute [::Google::Cloud::Retail::V2::CatalogAttribute, ::Hash] - # Required. The {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} - # to add. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Cloud::Retail::V2::AttributesConfig] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Cloud::Retail::V2::AttributesConfig] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::CatalogService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::AddCatalogAttributeRequest.new - # - # # Call the add_catalog_attribute method. - # result = client.add_catalog_attribute request - # - # # The returned object is of type Google::Cloud::Retail::V2::AttributesConfig. - # p result - # - def add_catalog_attribute request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::AddCatalogAttributeRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.add_catalog_attribute.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.attributes_config - header_params["attributes_config"] = request.attributes_config - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.add_catalog_attribute.timeout, - metadata: metadata, - retry_policy: @config.rpcs.add_catalog_attribute.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @catalog_service_stub.call_rpc :add_catalog_attribute, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Removes the specified - # {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} from the - # {::Google::Cloud::Retail::V2::AttributesConfig AttributesConfig}. - # - # If the {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} to - # remove does not exist, a NOT_FOUND error is returned. - # - # @overload remove_catalog_attribute(request, options = nil) - # Pass arguments to `remove_catalog_attribute` via a request object, either of type - # {::Google::Cloud::Retail::V2::RemoveCatalogAttributeRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::RemoveCatalogAttributeRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload remove_catalog_attribute(attributes_config: nil, key: nil) - # Pass arguments to `remove_catalog_attribute` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param attributes_config [::String] - # Required. Full AttributesConfig resource name. Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` - # @param key [::String] - # Required. The attribute name key of the - # {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} to remove. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Cloud::Retail::V2::AttributesConfig] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Cloud::Retail::V2::AttributesConfig] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::CatalogService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::RemoveCatalogAttributeRequest.new - # - # # Call the remove_catalog_attribute method. - # result = client.remove_catalog_attribute request - # - # # The returned object is of type Google::Cloud::Retail::V2::AttributesConfig. - # p result - # - def remove_catalog_attribute request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::RemoveCatalogAttributeRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.remove_catalog_attribute.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.attributes_config - header_params["attributes_config"] = request.attributes_config - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.remove_catalog_attribute.timeout, - metadata: metadata, - retry_policy: @config.rpcs.remove_catalog_attribute.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @catalog_service_stub.call_rpc :remove_catalog_attribute, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Replaces the specified - # {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} in the - # {::Google::Cloud::Retail::V2::AttributesConfig AttributesConfig} by updating the - # catalog attribute with the same - # {::Google::Cloud::Retail::V2::CatalogAttribute#key CatalogAttribute.key}. - # - # If the {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} to - # replace does not exist, a NOT_FOUND error is returned. - # - # @overload replace_catalog_attribute(request, options = nil) - # Pass arguments to `replace_catalog_attribute` via a request object, either of type - # {::Google::Cloud::Retail::V2::ReplaceCatalogAttributeRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::ReplaceCatalogAttributeRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload replace_catalog_attribute(attributes_config: nil, catalog_attribute: nil, update_mask: nil) - # Pass arguments to `replace_catalog_attribute` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param attributes_config [::String] - # Required. Full AttributesConfig resource name. Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` - # @param catalog_attribute [::Google::Cloud::Retail::V2::CatalogAttribute, ::Hash] - # Required. The updated - # {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute}. - # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] - # Indicates which fields in the provided - # {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} to update. The - # following are NOT supported: - # - # * {::Google::Cloud::Retail::V2::CatalogAttribute#key CatalogAttribute.key} - # - # If not set, all supported fields are updated. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Cloud::Retail::V2::AttributesConfig] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Cloud::Retail::V2::AttributesConfig] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::CatalogService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::ReplaceCatalogAttributeRequest.new - # - # # Call the replace_catalog_attribute method. - # result = client.replace_catalog_attribute request - # - # # The returned object is of type Google::Cloud::Retail::V2::AttributesConfig. - # p result - # - def replace_catalog_attribute request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ReplaceCatalogAttributeRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.replace_catalog_attribute.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.attributes_config - header_params["attributes_config"] = request.attributes_config - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.replace_catalog_attribute.timeout, - metadata: metadata, - retry_policy: @config.rpcs.replace_catalog_attribute.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @catalog_service_stub.call_rpc :replace_catalog_attribute, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Configuration class for the CatalogService API. - # - # This class represents the configuration for CatalogService, - # providing control over timeouts, retry behavior, logging, transport - # parameters, and other low-level controls. Certain parameters can also be - # applied individually to specific RPCs. See - # {::Google::Cloud::Retail::V2::CatalogService::Client::Configuration::Rpcs} - # for a list of RPCs that can be configured independently. - # - # Configuration can be applied globally to all clients, or to a single client - # on construction. - # - # @example - # - # # Modify the global config, setting the timeout for - # # list_catalogs to 20 seconds, - # # and all remaining timeouts to 10 seconds. - # ::Google::Cloud::Retail::V2::CatalogService::Client.configure do |config| - # config.timeout = 10.0 - # config.rpcs.list_catalogs.timeout = 20.0 - # end - # - # # Apply the above configuration only to a new client. - # client = ::Google::Cloud::Retail::V2::CatalogService::Client.new do |config| - # config.timeout = 10.0 - # config.rpcs.list_catalogs.timeout = 20.0 - # end - # - # @!attribute [rw] endpoint - # A custom service endpoint, as a hostname or hostname:port. The default is - # nil, indicating to use the default endpoint in the current universe domain. - # @return [::String,nil] - # @!attribute [rw] credentials - # Credentials to send with calls. You may provide any of the following types: - # * (`Google::Auth::Credentials`) A googleauth credentials object - # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) - # * (`Signet::OAuth2::Client`) A signet oauth2 client object - # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) - # * (`GRPC::Core::Channel`) a gRPC channel with included credentials - # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object - # * (`nil`) indicating no credentials - # - # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials - # is deprecated. Providing an unvalidated credential configuration to - # Google APIs can compromise the security of your systems and data. - # - # @example - # - # # The recommended way to provide credentials is to use the `make_creds` method - # # on the appropriate credentials class for your environment. - # - # require "googleauth" - # - # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds( - # json_key_io: ::File.open("/path/to/keyfile.json") - # ) - # - # client = ::Google::Cloud::Retail::V2::CatalogService::Client.new do |config| - # config.credentials = credentials - # end - # - # @note Warning: If you accept a credential configuration (JSON file or Hash) from an - # external source for authentication to Google Cloud, you must validate it before - # providing it to a Google API client library. Providing an unvalidated credential - # configuration to Google APIs can compromise the security of your systems and data. - # For more information, refer to [Validate credential configurations from external - # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). - # @return [::Object] - # @!attribute [rw] scope - # The OAuth scopes - # @return [::Array<::String>] - # @!attribute [rw] lib_name - # The library name as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] lib_version - # The library version as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] channel_args - # Extra parameters passed to the gRPC channel. Note: this is ignored if a - # `GRPC::Core::Channel` object is provided as the credential. - # @return [::Hash] - # @!attribute [rw] interceptors - # An array of interceptors that are run before calls are executed. - # @return [::Array<::GRPC::ClientInterceptor>] - # @!attribute [rw] timeout - # The call timeout in seconds. - # @return [::Numeric] - # @!attribute [rw] metadata - # Additional gRPC headers to be sent with the call. - # @return [::Hash{::Symbol=>::String}] - # @!attribute [rw] retry_policy - # The retry policy. The value is a hash with the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # @return [::Hash] - # @!attribute [rw] quota_project - # A separate project against which to charge quota. - # @return [::String] - # @!attribute [rw] universe_domain - # The universe domain within which to make requests. This determines the - # default endpoint URL. The default value of nil uses the environment - # universe (usually the default "googleapis.com" universe). - # @return [::String,nil] - # @!attribute [rw] logger - # A custom logger to use for request/response debug logging, or the value - # `:default` (the default) to construct a default logger, or `nil` to - # explicitly disable logging. - # @return [::Logger,:default,nil] - # - class Configuration - extend ::Gapic::Config - - # @private - # The endpoint specific to the default "googleapis.com" universe. Deprecated. - DEFAULT_ENDPOINT = "retail.googleapis.com" - - config_attr :endpoint, nil, ::String, nil - config_attr :credentials, nil do |value| - allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] - allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel - allowed.any? { |klass| klass === value } - end - config_attr :scope, nil, ::String, ::Array, nil - config_attr :lib_name, nil, ::String, nil - config_attr :lib_version, nil, ::String, nil - config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) - config_attr :interceptors, nil, ::Array, nil - config_attr :timeout, nil, ::Numeric, nil - config_attr :metadata, nil, ::Hash, nil - config_attr :retry_policy, nil, ::Hash, ::Proc, nil - config_attr :quota_project, nil, ::String, nil - config_attr :universe_domain, nil, ::String, nil - config_attr :logger, :default, ::Logger, nil, :default - - # @private - def initialize parent_config = nil - @parent_config = parent_config unless parent_config.nil? - - yield self if block_given? - end - - ## - # Configurations for individual RPCs - # @return [Rpcs] - # - def rpcs - @rpcs ||= begin - parent_rpcs = nil - parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) - Rpcs.new parent_rpcs - end - end - - ## - # Configuration for the channel pool - # @return [::Gapic::ServiceStub::ChannelPool::Configuration] - # - def channel_pool - @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new - end - - ## - # Configuration RPC class for the CatalogService API. - # - # Includes fields providing the configuration for each RPC in this service. - # Each configuration object is of type `Gapic::Config::Method` and includes - # the following configuration fields: - # - # * `timeout` (*type:* `Numeric`) - The call timeout in seconds - # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers - # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields - # include the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # - class Rpcs - ## - # RPC-specific configuration for `list_catalogs` - # @return [::Gapic::Config::Method] - # - attr_reader :list_catalogs - ## - # RPC-specific configuration for `update_catalog` - # @return [::Gapic::Config::Method] - # - attr_reader :update_catalog - ## - # RPC-specific configuration for `set_default_branch` - # @return [::Gapic::Config::Method] - # - attr_reader :set_default_branch - ## - # RPC-specific configuration for `get_default_branch` - # @return [::Gapic::Config::Method] - # - attr_reader :get_default_branch - ## - # RPC-specific configuration for `get_completion_config` - # @return [::Gapic::Config::Method] - # - attr_reader :get_completion_config - ## - # RPC-specific configuration for `update_completion_config` - # @return [::Gapic::Config::Method] - # - attr_reader :update_completion_config - ## - # RPC-specific configuration for `get_attributes_config` - # @return [::Gapic::Config::Method] - # - attr_reader :get_attributes_config - ## - # RPC-specific configuration for `update_attributes_config` - # @return [::Gapic::Config::Method] - # - attr_reader :update_attributes_config - ## - # RPC-specific configuration for `add_catalog_attribute` - # @return [::Gapic::Config::Method] - # - attr_reader :add_catalog_attribute - ## - # RPC-specific configuration for `remove_catalog_attribute` - # @return [::Gapic::Config::Method] - # - attr_reader :remove_catalog_attribute - ## - # RPC-specific configuration for `replace_catalog_attribute` - # @return [::Gapic::Config::Method] - # - attr_reader :replace_catalog_attribute - - # @private - def initialize parent_rpcs = nil - list_catalogs_config = parent_rpcs.list_catalogs if parent_rpcs.respond_to? :list_catalogs - @list_catalogs = ::Gapic::Config::Method.new list_catalogs_config - update_catalog_config = parent_rpcs.update_catalog if parent_rpcs.respond_to? :update_catalog - @update_catalog = ::Gapic::Config::Method.new update_catalog_config - set_default_branch_config = parent_rpcs.set_default_branch if parent_rpcs.respond_to? :set_default_branch - @set_default_branch = ::Gapic::Config::Method.new set_default_branch_config - get_default_branch_config = parent_rpcs.get_default_branch if parent_rpcs.respond_to? :get_default_branch - @get_default_branch = ::Gapic::Config::Method.new get_default_branch_config - get_completion_config_config = parent_rpcs.get_completion_config if parent_rpcs.respond_to? :get_completion_config - @get_completion_config = ::Gapic::Config::Method.new get_completion_config_config - update_completion_config_config = parent_rpcs.update_completion_config if parent_rpcs.respond_to? :update_completion_config - @update_completion_config = ::Gapic::Config::Method.new update_completion_config_config - get_attributes_config_config = parent_rpcs.get_attributes_config if parent_rpcs.respond_to? :get_attributes_config - @get_attributes_config = ::Gapic::Config::Method.new get_attributes_config_config - update_attributes_config_config = parent_rpcs.update_attributes_config if parent_rpcs.respond_to? :update_attributes_config - @update_attributes_config = ::Gapic::Config::Method.new update_attributes_config_config - add_catalog_attribute_config = parent_rpcs.add_catalog_attribute if parent_rpcs.respond_to? :add_catalog_attribute - @add_catalog_attribute = ::Gapic::Config::Method.new add_catalog_attribute_config - remove_catalog_attribute_config = parent_rpcs.remove_catalog_attribute if parent_rpcs.respond_to? :remove_catalog_attribute - @remove_catalog_attribute = ::Gapic::Config::Method.new remove_catalog_attribute_config - replace_catalog_attribute_config = parent_rpcs.replace_catalog_attribute if parent_rpcs.respond_to? :replace_catalog_attribute - @replace_catalog_attribute = ::Gapic::Config::Method.new replace_catalog_attribute_config - - yield self if block_given? - end - end - end - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/credentials.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/credentials.rb deleted file mode 100644 index 181a310393b3..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/credentials.rb +++ /dev/null @@ -1,51 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "googleauth" - -module Google - module Cloud - module Retail - module V2 - module CatalogService - # Credentials for the CatalogService API. - class Credentials < ::Google::Auth::Credentials - self.scope = [ - "https://www.googleapis.com/auth/cloud-platform" - ] - self.env_vars = [ - "RETAIL_CREDENTIALS", - "RETAIL_KEYFILE", - "GOOGLE_CLOUD_CREDENTIALS", - "GOOGLE_CLOUD_KEYFILE", - "GCLOUD_KEYFILE", - "RETAIL_CREDENTIALS_JSON", - "RETAIL_KEYFILE_JSON", - "GOOGLE_CLOUD_CREDENTIALS_JSON", - "GOOGLE_CLOUD_KEYFILE_JSON", - "GCLOUD_KEYFILE_JSON" - ] - self.paths = [ - "~/.config/google_cloud/application_default_credentials.json" - ] - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/paths.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/paths.rb deleted file mode 100644 index 19287ee026f3..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/paths.rb +++ /dev/null @@ -1,128 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Cloud - module Retail - module V2 - module CatalogService - # Path helper methods for the CatalogService API. - module Paths - ## - # Create a fully-qualified AttributesConfig resource string. - # - # The resource will be in the following format: - # - # `projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig` - # - # @param project [String] - # @param location [String] - # @param catalog [String] - # - # @return [::String] - def attributes_config_path project:, location:, catalog: - raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" - raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" - - "projects/#{project}/locations/#{location}/catalogs/#{catalog}/attributesConfig" - end - - ## - # Create a fully-qualified Branch resource string. - # - # The resource will be in the following format: - # - # `projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}` - # - # @param project [String] - # @param location [String] - # @param catalog [String] - # @param branch [String] - # - # @return [::String] - def branch_path project:, location:, catalog:, branch: - raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" - raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" - raise ::ArgumentError, "catalog cannot contain /" if catalog.to_s.include? "/" - - "projects/#{project}/locations/#{location}/catalogs/#{catalog}/branches/#{branch}" - end - - ## - # Create a fully-qualified Catalog resource string. - # - # The resource will be in the following format: - # - # `projects/{project}/locations/{location}/catalogs/{catalog}` - # - # @param project [String] - # @param location [String] - # @param catalog [String] - # - # @return [::String] - def catalog_path project:, location:, catalog: - raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" - raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" - - "projects/#{project}/locations/#{location}/catalogs/#{catalog}" - end - - ## - # Create a fully-qualified CompletionConfig resource string. - # - # The resource will be in the following format: - # - # `projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig` - # - # @param project [String] - # @param location [String] - # @param catalog [String] - # - # @return [::String] - def completion_config_path project:, location:, catalog: - raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" - raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" - - "projects/#{project}/locations/#{location}/catalogs/#{catalog}/completionConfig" - end - - ## - # Create a fully-qualified Location resource string. - # - # The resource will be in the following format: - # - # `projects/{project}/locations/{location}` - # - # @param project [String] - # @param location [String] - # - # @return [::String] - def location_path project:, location: - raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" - - "projects/#{project}/locations/#{location}" - end - - extend self - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/rest.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/rest.rb deleted file mode 100644 index ea2c8cf3fcef..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/rest.rb +++ /dev/null @@ -1,52 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "gapic/rest" -require "gapic/config" -require "gapic/config/method" - -require "google/cloud/retail/v2/version" - -require "google/cloud/retail/v2/catalog_service/credentials" -require "google/cloud/retail/v2/catalog_service/paths" -require "google/cloud/retail/v2/catalog_service/rest/client" - -module Google - module Cloud - module Retail - module V2 - ## - # Service for managing catalog configuration. - # - # To load this service and instantiate a REST client: - # - # require "google/cloud/retail/v2/catalog_service/rest" - # client = ::Google::Cloud::Retail::V2::CatalogService::Rest::Client.new - # - module CatalogService - # Client for the REST transport - module Rest - end - end - end - end - end -end - -helper_path = ::File.join __dir__, "rest", "helpers.rb" -require "google/cloud/retail/v2/catalog_service/rest/helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/rest/client.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/rest/client.rb deleted file mode 100644 index 7627e97bdcbd..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/rest/client.rb +++ /dev/null @@ -1,1470 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "google/cloud/errors" -require "google/cloud/retail/v2/catalog_service_pb" -require "google/cloud/retail/v2/catalog_service/rest/service_stub" -require "google/cloud/location/rest" - -module Google - module Cloud - module Retail - module V2 - module CatalogService - module Rest - ## - # REST client for the CatalogService service. - # - # Service for managing catalog configuration. - # - class Client - # @private - API_VERSION = "" - - # @private - DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" - - include Paths - - # @private - attr_reader :catalog_service_stub - - ## - # Configure the CatalogService Client class. - # - # See {::Google::Cloud::Retail::V2::CatalogService::Rest::Client::Configuration} - # for a description of the configuration fields. - # - # @example - # - # # Modify the configuration for all CatalogService clients - # ::Google::Cloud::Retail::V2::CatalogService::Rest::Client.configure do |config| - # config.timeout = 10.0 - # end - # - # @yield [config] Configure the Client client. - # @yieldparam config [Client::Configuration] - # - # @return [Client::Configuration] - # - def self.configure - @configure ||= begin - namespace = ["Google", "Cloud", "Retail", "V2"] - parent_config = while namespace.any? - parent_name = namespace.join "::" - parent_const = const_get parent_name - break parent_const.configure if parent_const.respond_to? :configure - namespace.pop - end - default_config = Client::Configuration.new parent_config - - default_config.timeout = 5.0 - default_config.retry_policy = { - initial_delay: 0.1, max_delay: 5.0, multiplier: 1.3, retry_codes: [14, 4] - } - - default_config - end - yield @configure if block_given? - @configure - end - - ## - # Configure the CatalogService Client instance. - # - # The configuration is set to the derived mode, meaning that values can be changed, - # but structural changes (adding new fields, etc.) are not allowed. Structural changes - # should be made on {Client.configure}. - # - # See {::Google::Cloud::Retail::V2::CatalogService::Rest::Client::Configuration} - # for a description of the configuration fields. - # - # @yield [config] Configure the Client client. - # @yieldparam config [Client::Configuration] - # - # @return [Client::Configuration] - # - def configure - yield @config if block_given? - @config - end - - ## - # The effective universe domain - # - # @return [String] - # - def universe_domain - @catalog_service_stub.universe_domain - end - - ## - # Create a new CatalogService REST client object. - # - # @example - # - # # Create a client using the default configuration - # client = ::Google::Cloud::Retail::V2::CatalogService::Rest::Client.new - # - # # Create a client using a custom configuration - # client = ::Google::Cloud::Retail::V2::CatalogService::Rest::Client.new do |config| - # config.timeout = 10.0 - # end - # - # @yield [config] Configure the CatalogService client. - # @yieldparam config [Client::Configuration] - # - def initialize - # Create the configuration object - @config = Configuration.new Client.configure - - # Yield the configuration if needed - yield @config if block_given? - - # Create credentials - credentials = @config.credentials - # Use self-signed JWT if the endpoint is unchanged from default, - # but only if the default endpoint does not have a region prefix. - enable_self_signed_jwt = @config.endpoint.nil? || - (@config.endpoint == Configuration::DEFAULT_ENDPOINT && - !@config.endpoint.split(".").first.include?("-")) - credentials ||= Credentials.default scope: @config.scope, - enable_self_signed_jwt: enable_self_signed_jwt - if credentials.is_a?(::String) || credentials.is_a?(::Hash) - credentials = Credentials.new credentials, scope: @config.scope - end - - @quota_project_id = @config.quota_project - @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id - - @catalog_service_stub = ::Google::Cloud::Retail::V2::CatalogService::Rest::ServiceStub.new( - endpoint: @config.endpoint, - endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, - universe_domain: @config.universe_domain, - credentials: credentials, - logger: @config.logger - ) - - @catalog_service_stub.logger(stub: true)&.info do |entry| - entry.set_system_name - entry.set_service - entry.message = "Created client for #{entry.service}" - entry.set_credentials_fields credentials - entry.set "customEndpoint", @config.endpoint if @config.endpoint - entry.set "defaultTimeout", @config.timeout if @config.timeout - entry.set "quotaProject", @quota_project_id if @quota_project_id - end - - @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config| - config.credentials = credentials - config.quota_project = @quota_project_id - config.endpoint = @catalog_service_stub.endpoint - config.universe_domain = @catalog_service_stub.universe_domain - config.logger = @catalog_service_stub.logger if config.respond_to? :logger= - end - end - - ## - # Get the associated client for mix-in of the Locations. - # - # @return [Google::Cloud::Location::Locations::Rest::Client] - # - attr_reader :location_client - - ## - # The logger used for request/response debug logging. - # - # @return [Logger] - # - def logger - @catalog_service_stub.logger - end - - # Service calls - - ## - # Lists all the {::Google::Cloud::Retail::V2::Catalog Catalog}s associated with - # the project. - # - # @overload list_catalogs(request, options = nil) - # Pass arguments to `list_catalogs` via a request object, either of type - # {::Google::Cloud::Retail::V2::ListCatalogsRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::ListCatalogsRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload list_catalogs(parent: nil, page_size: nil, page_token: nil) - # Pass arguments to `list_catalogs` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. The account resource name with an associated location. - # - # If the caller does not have permission to list - # {::Google::Cloud::Retail::V2::Catalog Catalog}s under this location, regardless - # of whether or not this location exists, a PERMISSION_DENIED error is - # returned. - # @param page_size [::Integer] - # Maximum number of {::Google::Cloud::Retail::V2::Catalog Catalog}s to return. If - # unspecified, defaults to 50. The maximum allowed value is 1000. Values - # above 1000 will be coerced to 1000. - # - # If this field is negative, an INVALID_ARGUMENT is returned. - # @param page_token [::String] - # A page token - # {::Google::Cloud::Retail::V2::ListCatalogsResponse#next_page_token ListCatalogsResponse.next_page_token}, - # received from a previous - # {::Google::Cloud::Retail::V2::CatalogService::Rest::Client#list_catalogs CatalogService.ListCatalogs} - # call. Provide this to retrieve the subsequent page. - # - # When paginating, all other parameters provided to - # {::Google::Cloud::Retail::V2::CatalogService::Rest::Client#list_catalogs CatalogService.ListCatalogs} - # must match the call that provided the page token. Otherwise, an - # INVALID_ARGUMENT error is returned. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Retail::V2::Catalog>] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Retail::V2::Catalog>] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::CatalogService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::ListCatalogsRequest.new - # - # # Call the list_catalogs method. - # result = client.list_catalogs request - # - # # The returned object is of type Gapic::PagedEnumerable. You can iterate - # # over elements, and API calls will be issued to fetch pages as needed. - # result.each do |item| - # # Each element is of type ::Google::Cloud::Retail::V2::Catalog. - # p item - # end - # - def list_catalogs request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ListCatalogsRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.list_catalogs.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.list_catalogs.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.list_catalogs.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @catalog_service_stub.list_catalogs request, options do |result, operation| - result = ::Gapic::Rest::PagedEnumerable.new @catalog_service_stub, :list_catalogs, "catalogs", request, result, options - yield result, operation if block_given? - throw :response, result - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Updates the {::Google::Cloud::Retail::V2::Catalog Catalog}s. - # - # @overload update_catalog(request, options = nil) - # Pass arguments to `update_catalog` via a request object, either of type - # {::Google::Cloud::Retail::V2::UpdateCatalogRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::UpdateCatalogRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload update_catalog(catalog: nil, update_mask: nil) - # Pass arguments to `update_catalog` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param catalog [::Google::Cloud::Retail::V2::Catalog, ::Hash] - # Required. The {::Google::Cloud::Retail::V2::Catalog Catalog} to update. - # - # If the caller does not have permission to update the - # {::Google::Cloud::Retail::V2::Catalog Catalog}, regardless of whether or not it - # exists, a PERMISSION_DENIED error is returned. - # - # If the {::Google::Cloud::Retail::V2::Catalog Catalog} to update does not exist, - # a NOT_FOUND error is returned. - # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] - # Indicates which fields in the provided - # {::Google::Cloud::Retail::V2::Catalog Catalog} to update. - # - # If an unsupported or unknown field is provided, an INVALID_ARGUMENT error - # is returned. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::Catalog] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::Catalog] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::CatalogService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::UpdateCatalogRequest.new - # - # # Call the update_catalog method. - # result = client.update_catalog request - # - # # The returned object is of type Google::Cloud::Retail::V2::Catalog. - # p result - # - def update_catalog request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::UpdateCatalogRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.update_catalog.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.update_catalog.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.update_catalog.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @catalog_service_stub.update_catalog request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Set a specified branch id as default branch. API methods such as - # {::Google::Cloud::Retail::V2::SearchService::Rest::Client#search SearchService.Search}, - # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#get_product ProductService.GetProduct}, - # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#list_products ProductService.ListProducts} - # will treat requests using "default_branch" to the actual branch id set as - # default. - # - # For example, if `projects/*/locations/*/catalogs/*/branches/1` is set as - # default, setting - # {::Google::Cloud::Retail::V2::SearchRequest#branch SearchRequest.branch} to - # `projects/*/locations/*/catalogs/*/branches/default_branch` is equivalent - # to setting - # {::Google::Cloud::Retail::V2::SearchRequest#branch SearchRequest.branch} to - # `projects/*/locations/*/catalogs/*/branches/1`. - # - # Using multiple branches can be useful when developers would like - # to have a staging branch to test and verify for future usage. When it - # becomes ready, developers switch on the staging branch using this API - # while keeping using - # `projects/*/locations/*/catalogs/*/branches/default_branch` as - # {::Google::Cloud::Retail::V2::SearchRequest#branch SearchRequest.branch} to - # route the traffic to this staging branch. - # - # CAUTION: If you have live predict/search traffic, switching the default - # branch could potentially cause outages if the ID space of the new branch - # is very different from the old one. - # - # More specifically: - # - # * PredictionService will only return product IDs from branch \\{newBranch}. - # * SearchService will only return product IDs from branch \\{newBranch} - # (if branch is not explicitly set). - # * UserEventService will only join events with products from branch - # \\{newBranch}. - # - # @overload set_default_branch(request, options = nil) - # Pass arguments to `set_default_branch` via a request object, either of type - # {::Google::Cloud::Retail::V2::SetDefaultBranchRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::SetDefaultBranchRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload set_default_branch(catalog: nil, branch_id: nil, note: nil, force: nil) - # Pass arguments to `set_default_branch` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param catalog [::String] - # Full resource name of the catalog, such as - # `projects/*/locations/global/catalogs/default_catalog`. - # @param branch_id [::String] - # The final component of the resource name of a branch. - # - # This field must be one of "0", "1" or "2". Otherwise, an INVALID_ARGUMENT - # error is returned. - # - # If there are no sufficient active products in the targeted branch and - # {::Google::Cloud::Retail::V2::SetDefaultBranchRequest#force force} is not set, a - # FAILED_PRECONDITION error is returned. - # @param note [::String] - # Some note on this request, this can be retrieved by - # {::Google::Cloud::Retail::V2::CatalogService::Rest::Client#get_default_branch CatalogService.GetDefaultBranch} - # before next valid default branch set occurs. - # - # This field must be a UTF-8 encoded string with a length limit of 1,000 - # characters. Otherwise, an INVALID_ARGUMENT error is returned. - # @param force [::Boolean] - # If set to true, it permits switching to a branch with - # {::Google::Cloud::Retail::V2::SetDefaultBranchRequest#branch_id branch_id} even - # if it has no sufficient active products. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Protobuf::Empty] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Protobuf::Empty] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::CatalogService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::SetDefaultBranchRequest.new - # - # # Call the set_default_branch method. - # result = client.set_default_branch request - # - # # The returned object is of type Google::Protobuf::Empty. - # p result - # - def set_default_branch request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::SetDefaultBranchRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.set_default_branch.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.set_default_branch.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.set_default_branch.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @catalog_service_stub.set_default_branch request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Get which branch is currently default branch set by - # {::Google::Cloud::Retail::V2::CatalogService::Rest::Client#set_default_branch CatalogService.SetDefaultBranch} - # method under a specified parent catalog. - # - # @overload get_default_branch(request, options = nil) - # Pass arguments to `get_default_branch` via a request object, either of type - # {::Google::Cloud::Retail::V2::GetDefaultBranchRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::GetDefaultBranchRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload get_default_branch(catalog: nil) - # Pass arguments to `get_default_branch` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param catalog [::String] - # The parent catalog resource name, such as - # `projects/*/locations/global/catalogs/default_catalog`. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::GetDefaultBranchResponse] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::GetDefaultBranchResponse] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::CatalogService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::GetDefaultBranchRequest.new - # - # # Call the get_default_branch method. - # result = client.get_default_branch request - # - # # The returned object is of type Google::Cloud::Retail::V2::GetDefaultBranchResponse. - # p result - # - def get_default_branch request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::GetDefaultBranchRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.get_default_branch.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.get_default_branch.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.get_default_branch.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @catalog_service_stub.get_default_branch request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Gets a {::Google::Cloud::Retail::V2::CompletionConfig CompletionConfig}. - # - # @overload get_completion_config(request, options = nil) - # Pass arguments to `get_completion_config` via a request object, either of type - # {::Google::Cloud::Retail::V2::GetCompletionConfigRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::GetCompletionConfigRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload get_completion_config(name: nil) - # Pass arguments to `get_completion_config` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # Required. Full CompletionConfig resource name. Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig` - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::CompletionConfig] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::CompletionConfig] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::CatalogService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::GetCompletionConfigRequest.new - # - # # Call the get_completion_config method. - # result = client.get_completion_config request - # - # # The returned object is of type Google::Cloud::Retail::V2::CompletionConfig. - # p result - # - def get_completion_config request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::GetCompletionConfigRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.get_completion_config.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.get_completion_config.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.get_completion_config.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @catalog_service_stub.get_completion_config request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Updates the {::Google::Cloud::Retail::V2::CompletionConfig CompletionConfig}s. - # - # @overload update_completion_config(request, options = nil) - # Pass arguments to `update_completion_config` via a request object, either of type - # {::Google::Cloud::Retail::V2::UpdateCompletionConfigRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::UpdateCompletionConfigRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload update_completion_config(completion_config: nil, update_mask: nil) - # Pass arguments to `update_completion_config` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param completion_config [::Google::Cloud::Retail::V2::CompletionConfig, ::Hash] - # Required. The {::Google::Cloud::Retail::V2::CompletionConfig CompletionConfig} - # to update. - # - # If the caller does not have permission to update the - # {::Google::Cloud::Retail::V2::CompletionConfig CompletionConfig}, then a - # PERMISSION_DENIED error is returned. - # - # If the {::Google::Cloud::Retail::V2::CompletionConfig CompletionConfig} to - # update does not exist, a NOT_FOUND error is returned. - # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] - # Indicates which fields in the provided - # {::Google::Cloud::Retail::V2::CompletionConfig CompletionConfig} to update. The - # following are the only supported fields: - # - # * {::Google::Cloud::Retail::V2::CompletionConfig#matching_order CompletionConfig.matching_order} - # * {::Google::Cloud::Retail::V2::CompletionConfig#max_suggestions CompletionConfig.max_suggestions} - # * {::Google::Cloud::Retail::V2::CompletionConfig#min_prefix_length CompletionConfig.min_prefix_length} - # * {::Google::Cloud::Retail::V2::CompletionConfig#auto_learning CompletionConfig.auto_learning} - # - # If not set, all supported fields are updated. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::CompletionConfig] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::CompletionConfig] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::CatalogService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::UpdateCompletionConfigRequest.new - # - # # Call the update_completion_config method. - # result = client.update_completion_config request - # - # # The returned object is of type Google::Cloud::Retail::V2::CompletionConfig. - # p result - # - def update_completion_config request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::UpdateCompletionConfigRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.update_completion_config.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.update_completion_config.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.update_completion_config.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @catalog_service_stub.update_completion_config request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Gets an {::Google::Cloud::Retail::V2::AttributesConfig AttributesConfig}. - # - # @overload get_attributes_config(request, options = nil) - # Pass arguments to `get_attributes_config` via a request object, either of type - # {::Google::Cloud::Retail::V2::GetAttributesConfigRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::GetAttributesConfigRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload get_attributes_config(name: nil) - # Pass arguments to `get_attributes_config` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # Required. Full AttributesConfig resource name. Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::AttributesConfig] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::AttributesConfig] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::CatalogService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::GetAttributesConfigRequest.new - # - # # Call the get_attributes_config method. - # result = client.get_attributes_config request - # - # # The returned object is of type Google::Cloud::Retail::V2::AttributesConfig. - # p result - # - def get_attributes_config request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::GetAttributesConfigRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.get_attributes_config.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.get_attributes_config.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.get_attributes_config.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @catalog_service_stub.get_attributes_config request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Updates the {::Google::Cloud::Retail::V2::AttributesConfig AttributesConfig}. - # - # The catalog attributes in the request will be updated in the catalog, or - # inserted if they do not exist. Existing catalog attributes not included in - # the request will remain unchanged. Attributes that are assigned to - # products, but do not exist at the catalog level, are always included in the - # response. The product attribute is assigned default values for missing - # catalog attribute fields, e.g., searchable and dynamic facetable options. - # - # @overload update_attributes_config(request, options = nil) - # Pass arguments to `update_attributes_config` via a request object, either of type - # {::Google::Cloud::Retail::V2::UpdateAttributesConfigRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::UpdateAttributesConfigRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload update_attributes_config(attributes_config: nil, update_mask: nil) - # Pass arguments to `update_attributes_config` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param attributes_config [::Google::Cloud::Retail::V2::AttributesConfig, ::Hash] - # Required. The {::Google::Cloud::Retail::V2::AttributesConfig AttributesConfig} - # to update. - # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] - # Indicates which fields in the provided - # {::Google::Cloud::Retail::V2::AttributesConfig AttributesConfig} to update. The - # following is the only supported field: - # - # * {::Google::Cloud::Retail::V2::AttributesConfig#catalog_attributes AttributesConfig.catalog_attributes} - # - # If not set, all supported fields are updated. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::AttributesConfig] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::AttributesConfig] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::CatalogService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::UpdateAttributesConfigRequest.new - # - # # Call the update_attributes_config method. - # result = client.update_attributes_config request - # - # # The returned object is of type Google::Cloud::Retail::V2::AttributesConfig. - # p result - # - def update_attributes_config request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::UpdateAttributesConfigRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.update_attributes_config.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.update_attributes_config.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.update_attributes_config.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @catalog_service_stub.update_attributes_config request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Adds the specified - # {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} to the - # {::Google::Cloud::Retail::V2::AttributesConfig AttributesConfig}. - # - # If the {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} to add - # already exists, an ALREADY_EXISTS error is returned. - # - # @overload add_catalog_attribute(request, options = nil) - # Pass arguments to `add_catalog_attribute` via a request object, either of type - # {::Google::Cloud::Retail::V2::AddCatalogAttributeRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::AddCatalogAttributeRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload add_catalog_attribute(attributes_config: nil, catalog_attribute: nil) - # Pass arguments to `add_catalog_attribute` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param attributes_config [::String] - # Required. Full AttributesConfig resource name. Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` - # @param catalog_attribute [::Google::Cloud::Retail::V2::CatalogAttribute, ::Hash] - # Required. The {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} - # to add. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::AttributesConfig] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::AttributesConfig] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::CatalogService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::AddCatalogAttributeRequest.new - # - # # Call the add_catalog_attribute method. - # result = client.add_catalog_attribute request - # - # # The returned object is of type Google::Cloud::Retail::V2::AttributesConfig. - # p result - # - def add_catalog_attribute request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::AddCatalogAttributeRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.add_catalog_attribute.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.add_catalog_attribute.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.add_catalog_attribute.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @catalog_service_stub.add_catalog_attribute request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Removes the specified - # {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} from the - # {::Google::Cloud::Retail::V2::AttributesConfig AttributesConfig}. - # - # If the {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} to - # remove does not exist, a NOT_FOUND error is returned. - # - # @overload remove_catalog_attribute(request, options = nil) - # Pass arguments to `remove_catalog_attribute` via a request object, either of type - # {::Google::Cloud::Retail::V2::RemoveCatalogAttributeRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::RemoveCatalogAttributeRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload remove_catalog_attribute(attributes_config: nil, key: nil) - # Pass arguments to `remove_catalog_attribute` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param attributes_config [::String] - # Required. Full AttributesConfig resource name. Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` - # @param key [::String] - # Required. The attribute name key of the - # {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} to remove. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::AttributesConfig] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::AttributesConfig] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::CatalogService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::RemoveCatalogAttributeRequest.new - # - # # Call the remove_catalog_attribute method. - # result = client.remove_catalog_attribute request - # - # # The returned object is of type Google::Cloud::Retail::V2::AttributesConfig. - # p result - # - def remove_catalog_attribute request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::RemoveCatalogAttributeRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.remove_catalog_attribute.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.remove_catalog_attribute.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.remove_catalog_attribute.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @catalog_service_stub.remove_catalog_attribute request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Replaces the specified - # {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} in the - # {::Google::Cloud::Retail::V2::AttributesConfig AttributesConfig} by updating the - # catalog attribute with the same - # {::Google::Cloud::Retail::V2::CatalogAttribute#key CatalogAttribute.key}. - # - # If the {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} to - # replace does not exist, a NOT_FOUND error is returned. - # - # @overload replace_catalog_attribute(request, options = nil) - # Pass arguments to `replace_catalog_attribute` via a request object, either of type - # {::Google::Cloud::Retail::V2::ReplaceCatalogAttributeRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::ReplaceCatalogAttributeRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload replace_catalog_attribute(attributes_config: nil, catalog_attribute: nil, update_mask: nil) - # Pass arguments to `replace_catalog_attribute` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param attributes_config [::String] - # Required. Full AttributesConfig resource name. Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` - # @param catalog_attribute [::Google::Cloud::Retail::V2::CatalogAttribute, ::Hash] - # Required. The updated - # {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute}. - # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] - # Indicates which fields in the provided - # {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} to update. The - # following are NOT supported: - # - # * {::Google::Cloud::Retail::V2::CatalogAttribute#key CatalogAttribute.key} - # - # If not set, all supported fields are updated. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::AttributesConfig] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::AttributesConfig] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::CatalogService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::ReplaceCatalogAttributeRequest.new - # - # # Call the replace_catalog_attribute method. - # result = client.replace_catalog_attribute request - # - # # The returned object is of type Google::Cloud::Retail::V2::AttributesConfig. - # p result - # - def replace_catalog_attribute request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ReplaceCatalogAttributeRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.replace_catalog_attribute.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.replace_catalog_attribute.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.replace_catalog_attribute.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @catalog_service_stub.replace_catalog_attribute request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Configuration class for the CatalogService REST API. - # - # This class represents the configuration for CatalogService REST, - # providing control over timeouts, retry behavior, logging, transport - # parameters, and other low-level controls. Certain parameters can also be - # applied individually to specific RPCs. See - # {::Google::Cloud::Retail::V2::CatalogService::Rest::Client::Configuration::Rpcs} - # for a list of RPCs that can be configured independently. - # - # Configuration can be applied globally to all clients, or to a single client - # on construction. - # - # @example - # - # # Modify the global config, setting the timeout for - # # list_catalogs to 20 seconds, - # # and all remaining timeouts to 10 seconds. - # ::Google::Cloud::Retail::V2::CatalogService::Rest::Client.configure do |config| - # config.timeout = 10.0 - # config.rpcs.list_catalogs.timeout = 20.0 - # end - # - # # Apply the above configuration only to a new client. - # client = ::Google::Cloud::Retail::V2::CatalogService::Rest::Client.new do |config| - # config.timeout = 10.0 - # config.rpcs.list_catalogs.timeout = 20.0 - # end - # - # @!attribute [rw] endpoint - # A custom service endpoint, as a hostname or hostname:port. The default is - # nil, indicating to use the default endpoint in the current universe domain. - # @return [::String,nil] - # @!attribute [rw] credentials - # Credentials to send with calls. You may provide any of the following types: - # * (`String`) The path to a service account key file in JSON format - # * (`Hash`) A service account key as a Hash - # * (`Google::Auth::Credentials`) A googleauth credentials object - # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) - # * (`Signet::OAuth2::Client`) A signet oauth2 client object - # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) - # * (`nil`) indicating no credentials - # - # Warning: If you accept a credential configuration (JSON file or Hash) from an - # external source for authentication to Google Cloud, you must validate it before - # providing it to a Google API client library. Providing an unvalidated credential - # configuration to Google APIs can compromise the security of your systems and data. - # For more information, refer to [Validate credential configurations from external - # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). - # @return [::Object] - # @!attribute [rw] scope - # The OAuth scopes - # @return [::Array<::String>] - # @!attribute [rw] lib_name - # The library name as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] lib_version - # The library version as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] timeout - # The call timeout in seconds. - # @return [::Numeric] - # @!attribute [rw] metadata - # Additional headers to be sent with the call. - # @return [::Hash{::Symbol=>::String}] - # @!attribute [rw] retry_policy - # The retry policy. The value is a hash with the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # @return [::Hash] - # @!attribute [rw] quota_project - # A separate project against which to charge quota. - # @return [::String] - # @!attribute [rw] universe_domain - # The universe domain within which to make requests. This determines the - # default endpoint URL. The default value of nil uses the environment - # universe (usually the default "googleapis.com" universe). - # @return [::String,nil] - # @!attribute [rw] logger - # A custom logger to use for request/response debug logging, or the value - # `:default` (the default) to construct a default logger, or `nil` to - # explicitly disable logging. - # @return [::Logger,:default,nil] - # - class Configuration - extend ::Gapic::Config - - # @private - # The endpoint specific to the default "googleapis.com" universe. Deprecated. - DEFAULT_ENDPOINT = "retail.googleapis.com" - - config_attr :endpoint, nil, ::String, nil - config_attr :credentials, nil do |value| - allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] - allowed.any? { |klass| klass === value } - end - config_attr :scope, nil, ::String, ::Array, nil - config_attr :lib_name, nil, ::String, nil - config_attr :lib_version, nil, ::String, nil - config_attr :timeout, nil, ::Numeric, nil - config_attr :metadata, nil, ::Hash, nil - config_attr :retry_policy, nil, ::Hash, ::Proc, nil - config_attr :quota_project, nil, ::String, nil - config_attr :universe_domain, nil, ::String, nil - config_attr :logger, :default, ::Logger, nil, :default - - # @private - def initialize parent_config = nil - @parent_config = parent_config unless parent_config.nil? - - yield self if block_given? - end - - ## - # Configurations for individual RPCs - # @return [Rpcs] - # - def rpcs - @rpcs ||= begin - parent_rpcs = nil - parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) - Rpcs.new parent_rpcs - end - end - - ## - # Configuration RPC class for the CatalogService API. - # - # Includes fields providing the configuration for each RPC in this service. - # Each configuration object is of type `Gapic::Config::Method` and includes - # the following configuration fields: - # - # * `timeout` (*type:* `Numeric`) - The call timeout in seconds - # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers - # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields - # include the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # - class Rpcs - ## - # RPC-specific configuration for `list_catalogs` - # @return [::Gapic::Config::Method] - # - attr_reader :list_catalogs - ## - # RPC-specific configuration for `update_catalog` - # @return [::Gapic::Config::Method] - # - attr_reader :update_catalog - ## - # RPC-specific configuration for `set_default_branch` - # @return [::Gapic::Config::Method] - # - attr_reader :set_default_branch - ## - # RPC-specific configuration for `get_default_branch` - # @return [::Gapic::Config::Method] - # - attr_reader :get_default_branch - ## - # RPC-specific configuration for `get_completion_config` - # @return [::Gapic::Config::Method] - # - attr_reader :get_completion_config - ## - # RPC-specific configuration for `update_completion_config` - # @return [::Gapic::Config::Method] - # - attr_reader :update_completion_config - ## - # RPC-specific configuration for `get_attributes_config` - # @return [::Gapic::Config::Method] - # - attr_reader :get_attributes_config - ## - # RPC-specific configuration for `update_attributes_config` - # @return [::Gapic::Config::Method] - # - attr_reader :update_attributes_config - ## - # RPC-specific configuration for `add_catalog_attribute` - # @return [::Gapic::Config::Method] - # - attr_reader :add_catalog_attribute - ## - # RPC-specific configuration for `remove_catalog_attribute` - # @return [::Gapic::Config::Method] - # - attr_reader :remove_catalog_attribute - ## - # RPC-specific configuration for `replace_catalog_attribute` - # @return [::Gapic::Config::Method] - # - attr_reader :replace_catalog_attribute - - # @private - def initialize parent_rpcs = nil - list_catalogs_config = parent_rpcs.list_catalogs if parent_rpcs.respond_to? :list_catalogs - @list_catalogs = ::Gapic::Config::Method.new list_catalogs_config - update_catalog_config = parent_rpcs.update_catalog if parent_rpcs.respond_to? :update_catalog - @update_catalog = ::Gapic::Config::Method.new update_catalog_config - set_default_branch_config = parent_rpcs.set_default_branch if parent_rpcs.respond_to? :set_default_branch - @set_default_branch = ::Gapic::Config::Method.new set_default_branch_config - get_default_branch_config = parent_rpcs.get_default_branch if parent_rpcs.respond_to? :get_default_branch - @get_default_branch = ::Gapic::Config::Method.new get_default_branch_config - get_completion_config_config = parent_rpcs.get_completion_config if parent_rpcs.respond_to? :get_completion_config - @get_completion_config = ::Gapic::Config::Method.new get_completion_config_config - update_completion_config_config = parent_rpcs.update_completion_config if parent_rpcs.respond_to? :update_completion_config - @update_completion_config = ::Gapic::Config::Method.new update_completion_config_config - get_attributes_config_config = parent_rpcs.get_attributes_config if parent_rpcs.respond_to? :get_attributes_config - @get_attributes_config = ::Gapic::Config::Method.new get_attributes_config_config - update_attributes_config_config = parent_rpcs.update_attributes_config if parent_rpcs.respond_to? :update_attributes_config - @update_attributes_config = ::Gapic::Config::Method.new update_attributes_config_config - add_catalog_attribute_config = parent_rpcs.add_catalog_attribute if parent_rpcs.respond_to? :add_catalog_attribute - @add_catalog_attribute = ::Gapic::Config::Method.new add_catalog_attribute_config - remove_catalog_attribute_config = parent_rpcs.remove_catalog_attribute if parent_rpcs.respond_to? :remove_catalog_attribute - @remove_catalog_attribute = ::Gapic::Config::Method.new remove_catalog_attribute_config - replace_catalog_attribute_config = parent_rpcs.replace_catalog_attribute if parent_rpcs.respond_to? :replace_catalog_attribute - @replace_catalog_attribute = ::Gapic::Config::Method.new replace_catalog_attribute_config - - yield self if block_given? - end - end - end - end - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/rest/service_stub.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/rest/service_stub.rb deleted file mode 100644 index aba96c79d1c5..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service/rest/service_stub.rb +++ /dev/null @@ -1,759 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "google/cloud/retail/v2/catalog_service_pb" - -module Google - module Cloud - module Retail - module V2 - module CatalogService - module Rest - ## - # REST service stub for the CatalogService service. - # Service stub contains baseline method implementations - # including transcoding, making the REST call, and deserialing the response. - # - class ServiceStub - # @private - def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger: - # These require statements are intentionally placed here to initialize - # the REST modules only when it's required. - require "gapic/rest" - - @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, - endpoint_template: endpoint_template, - universe_domain: universe_domain, - credentials: credentials, - numeric_enums: true, - service_name: self.class, - raise_faraday_errors: false, - logger: logger - end - - ## - # The effective universe domain - # - # @return [String] - # - def universe_domain - @client_stub.universe_domain - end - - ## - # The effective endpoint - # - # @return [String] - # - def endpoint - @client_stub.endpoint - end - - ## - # The logger used for request/response debug logging. - # - # @return [Logger] - # - def logger stub: false - stub ? @client_stub.stub_logger : @client_stub.logger - end - - ## - # Baseline implementation for the list_catalogs REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::ListCatalogsRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::ListCatalogsResponse] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::ListCatalogsResponse] - # A result object deserialized from the server's reply - def list_catalogs request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_list_catalogs_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "list_catalogs", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Retail::V2::ListCatalogsResponse.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the update_catalog REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::UpdateCatalogRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::Catalog] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::Catalog] - # A result object deserialized from the server's reply - def update_catalog request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_update_catalog_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "update_catalog", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Retail::V2::Catalog.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the set_default_branch REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::SetDefaultBranchRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Protobuf::Empty] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Protobuf::Empty] - # A result object deserialized from the server's reply - def set_default_branch request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_set_default_branch_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "set_default_branch", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the get_default_branch REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::GetDefaultBranchRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::GetDefaultBranchResponse] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::GetDefaultBranchResponse] - # A result object deserialized from the server's reply - def get_default_branch request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_get_default_branch_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "get_default_branch", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Retail::V2::GetDefaultBranchResponse.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the get_completion_config REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::GetCompletionConfigRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::CompletionConfig] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::CompletionConfig] - # A result object deserialized from the server's reply - def get_completion_config request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_get_completion_config_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "get_completion_config", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Retail::V2::CompletionConfig.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the update_completion_config REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::UpdateCompletionConfigRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::CompletionConfig] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::CompletionConfig] - # A result object deserialized from the server's reply - def update_completion_config request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_update_completion_config_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "update_completion_config", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Retail::V2::CompletionConfig.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the get_attributes_config REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::GetAttributesConfigRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::AttributesConfig] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::AttributesConfig] - # A result object deserialized from the server's reply - def get_attributes_config request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_get_attributes_config_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "get_attributes_config", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Retail::V2::AttributesConfig.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the update_attributes_config REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::UpdateAttributesConfigRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::AttributesConfig] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::AttributesConfig] - # A result object deserialized from the server's reply - def update_attributes_config request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_update_attributes_config_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "update_attributes_config", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Retail::V2::AttributesConfig.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the add_catalog_attribute REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::AddCatalogAttributeRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::AttributesConfig] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::AttributesConfig] - # A result object deserialized from the server's reply - def add_catalog_attribute request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_add_catalog_attribute_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "add_catalog_attribute", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Retail::V2::AttributesConfig.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the remove_catalog_attribute REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::RemoveCatalogAttributeRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::AttributesConfig] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::AttributesConfig] - # A result object deserialized from the server's reply - def remove_catalog_attribute request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_remove_catalog_attribute_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "remove_catalog_attribute", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Retail::V2::AttributesConfig.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the replace_catalog_attribute REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::ReplaceCatalogAttributeRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::AttributesConfig] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::AttributesConfig] - # A result object deserialized from the server's reply - def replace_catalog_attribute request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_replace_catalog_attribute_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "replace_catalog_attribute", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Retail::V2::AttributesConfig.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # @private - # - # GRPC transcoding helper method for the list_catalogs REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::ListCatalogsRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_list_catalogs_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :get, - uri_template: "/v2/{parent}/catalogs", - matches: [ - ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the update_catalog REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::UpdateCatalogRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_update_catalog_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :patch, - uri_template: "/v2/{catalog.name}", - body: "catalog", - matches: [ - ["catalog.name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the set_default_branch REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::SetDefaultBranchRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_set_default_branch_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :post, - uri_template: "/v2/{catalog}:setDefaultBranch", - body: "*", - matches: [ - ["catalog", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the get_default_branch REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::GetDefaultBranchRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_get_default_branch_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :get, - uri_template: "/v2/{catalog}:getDefaultBranch", - matches: [ - ["catalog", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the get_completion_config REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::GetCompletionConfigRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_get_completion_config_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :get, - uri_template: "/v2/{name}", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/completionConfig/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the update_completion_config REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::UpdateCompletionConfigRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_update_completion_config_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :patch, - uri_template: "/v2/{completion_config.name}", - body: "completion_config", - matches: [ - ["completion_config.name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/completionConfig/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the get_attributes_config REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::GetAttributesConfigRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_get_attributes_config_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :get, - uri_template: "/v2/{name}", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/attributesConfig/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the update_attributes_config REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::UpdateAttributesConfigRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_update_attributes_config_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :patch, - uri_template: "/v2/{attributes_config.name}", - body: "attributes_config", - matches: [ - ["attributes_config.name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/attributesConfig/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the add_catalog_attribute REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::AddCatalogAttributeRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_add_catalog_attribute_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :post, - uri_template: "/v2/{attributes_config}:addCatalogAttribute", - body: "*", - matches: [ - ["attributes_config", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/attributesConfig/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the remove_catalog_attribute REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::RemoveCatalogAttributeRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_remove_catalog_attribute_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :post, - uri_template: "/v2/{attributes_config}:removeCatalogAttribute", - body: "*", - matches: [ - ["attributes_config", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/attributesConfig/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the replace_catalog_attribute REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::ReplaceCatalogAttributeRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_replace_catalog_attribute_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :post, - uri_template: "/v2/{attributes_config}:replaceCatalogAttribute", - body: "*", - matches: [ - ["attributes_config", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/attributesConfig/?$}, false] - ] - ) - transcoder.transcode request_pb - end - end - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service_pb.rb deleted file mode 100644 index 13226293301e..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service_pb.rb +++ /dev/null @@ -1,42 +0,0 @@ -# frozen_string_literal: true -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/retail/v2/catalog_service.proto - -require 'google/protobuf' - -require 'google/api/annotations_pb' -require 'google/api/client_pb' -require 'google/api/field_behavior_pb' -require 'google/api/resource_pb' -require 'google/cloud/retail/v2/catalog_pb' -require 'google/protobuf/empty_pb' -require 'google/protobuf/field_mask_pb' -require 'google/protobuf/timestamp_pb' - - -descriptor_data = "\n,google/cloud/retail/v2/catalog_service.proto\x12\x16google.cloud.retail.v2\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a$google/cloud/retail/v2/catalog.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"w\n\x13ListCatalogsRequest\x12\x39\n\x06parent\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!locations.googleapis.com/Location\x12\x11\n\tpage_size\x18\x02 \x01(\x05\x12\x12\n\npage_token\x18\x03 \x01(\t\"b\n\x14ListCatalogsResponse\x12\x31\n\x08\x63\x61talogs\x18\x01 \x03(\x0b\x32\x1f.google.cloud.retail.v2.Catalog\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t\"~\n\x14UpdateCatalogRequest\x12\x35\n\x07\x63\x61talog\x18\x01 \x01(\x0b\x32\x1f.google.cloud.retail.v2.CatalogB\x03\xe0\x41\x02\x12/\n\x0bupdate_mask\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMask\"\xa1\x01\n\x17SetDefaultBranchRequest\x12\x33\n\x07\x63\x61talog\x18\x01 \x01(\tB\"\xfa\x41\x1f\n\x1dretail.googleapis.com/Catalog\x12\x34\n\tbranch_id\x18\x02 \x01(\tB!\xfa\x41\x1e\n\x1cretail.googleapis.com/Branch\x12\x0c\n\x04note\x18\x03 \x01(\t\x12\r\n\x05\x66orce\x18\x04 \x01(\x08\"N\n\x17GetDefaultBranchRequest\x12\x33\n\x07\x63\x61talog\x18\x01 \x01(\tB\"\xfa\x41\x1f\n\x1dretail.googleapis.com/Catalog\"\x89\x01\n\x18GetDefaultBranchResponse\x12\x31\n\x06\x62ranch\x18\x01 \x01(\tB!\xfa\x41\x1e\n\x1cretail.googleapis.com/Branch\x12,\n\x08set_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x0c\n\x04note\x18\x03 \x01(\t\"Z\n\x1aGetCompletionConfigRequest\x12<\n\x04name\x18\x01 \x01(\tB.\xe0\x41\x02\xfa\x41(\n&retail.googleapis.com/CompletionConfig\"\x9a\x01\n\x1dUpdateCompletionConfigRequest\x12H\n\x11\x63ompletion_config\x18\x01 \x01(\x0b\x32(.google.cloud.retail.v2.CompletionConfigB\x03\xe0\x41\x02\x12/\n\x0bupdate_mask\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMask\"Z\n\x1aGetAttributesConfigRequest\x12<\n\x04name\x18\x01 \x01(\tB.\xe0\x41\x02\xfa\x41(\n&retail.googleapis.com/AttributesConfig\"\x9a\x01\n\x1dUpdateAttributesConfigRequest\x12H\n\x11\x61ttributes_config\x18\x01 \x01(\x0b\x32(.google.cloud.retail.v2.AttributesConfigB\x03\xe0\x41\x02\x12/\n\x0bupdate_mask\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMask\"\xb1\x01\n\x1a\x41\x64\x64\x43\x61talogAttributeRequest\x12I\n\x11\x61ttributes_config\x18\x01 \x01(\tB.\xe0\x41\x02\xfa\x41(\n&retail.googleapis.com/AttributesConfig\x12H\n\x11\x63\x61talog_attribute\x18\x02 \x01(\x0b\x32(.google.cloud.retail.v2.CatalogAttributeB\x03\xe0\x41\x02\"|\n\x1dRemoveCatalogAttributeRequest\x12I\n\x11\x61ttributes_config\x18\x01 \x01(\tB.\xe0\x41\x02\xfa\x41(\n&retail.googleapis.com/AttributesConfig\x12\x10\n\x03key\x18\x02 \x01(\tB\x03\xe0\x41\x02\"\xe6\x01\n\x1eReplaceCatalogAttributeRequest\x12I\n\x11\x61ttributes_config\x18\x01 \x01(\tB.\xe0\x41\x02\xfa\x41(\n&retail.googleapis.com/AttributesConfig\x12H\n\x11\x63\x61talog_attribute\x18\x02 \x01(\x0b\x32(.google.cloud.retail.v2.CatalogAttributeB\x03\xe0\x41\x02\x12/\n\x0bupdate_mask\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.FieldMask2\x97\x13\n\x0e\x43\x61talogService\x12\xa8\x01\n\x0cListCatalogs\x12+.google.cloud.retail.v2.ListCatalogsRequest\x1a,.google.cloud.retail.v2.ListCatalogsResponse\"=\xda\x41\x06parent\x82\xd3\xe4\x93\x02.\x12,/v2/{parent=projects/*/locations/*}/catalogs\x12\xbb\x01\n\rUpdateCatalog\x12,.google.cloud.retail.v2.UpdateCatalogRequest\x1a\x1f.google.cloud.retail.v2.Catalog\"[\xda\x41\x13\x63\x61talog,update_mask\x82\xd3\xe4\x93\x02?24/v2/{catalog.name=projects/*/locations/*/catalogs/*}:\x07\x63\x61talog\x12\xb2\x01\n\x10SetDefaultBranch\x12/.google.cloud.retail.v2.SetDefaultBranchRequest\x1a\x16.google.protobuf.Empty\"U\xda\x41\x07\x63\x61talog\x82\xd3\xe4\x93\x02\x45\"@/v2/{catalog=projects/*/locations/*/catalogs/*}:setDefaultBranch:\x01*\x12\xc9\x01\n\x10GetDefaultBranch\x12/.google.cloud.retail.v2.GetDefaultBranchRequest\x1a\x30.google.cloud.retail.v2.GetDefaultBranchResponse\"R\xda\x41\x07\x63\x61talog\x82\xd3\xe4\x93\x02\x42\x12@/v2/{catalog=projects/*/locations/*/catalogs/*}:getDefaultBranch\x12\xc1\x01\n\x13GetCompletionConfig\x12\x32.google.cloud.retail.v2.GetCompletionConfigRequest\x1a(.google.cloud.retail.v2.CompletionConfig\"L\xda\x41\x04name\x82\xd3\xe4\x93\x02?\x12=/v2/{name=projects/*/locations/*/catalogs/*/completionConfig}\x12\x86\x02\n\x16UpdateCompletionConfig\x12\x35.google.cloud.retail.v2.UpdateCompletionConfigRequest\x1a(.google.cloud.retail.v2.CompletionConfig\"\x8a\x01\xda\x41\x1d\x63ompletion_config,update_mask\x82\xd3\xe4\x93\x02\x64\x32O/v2/{completion_config.name=projects/*/locations/*/catalogs/*/completionConfig}:\x11\x63ompletion_config\x12\xc1\x01\n\x13GetAttributesConfig\x12\x32.google.cloud.retail.v2.GetAttributesConfigRequest\x1a(.google.cloud.retail.v2.AttributesConfig\"L\xda\x41\x04name\x82\xd3\xe4\x93\x02?\x12=/v2/{name=projects/*/locations/*/catalogs/*/attributesConfig}\x12\x86\x02\n\x16UpdateAttributesConfig\x12\x35.google.cloud.retail.v2.UpdateAttributesConfigRequest\x1a(.google.cloud.retail.v2.AttributesConfig\"\x8a\x01\xda\x41\x1d\x61ttributes_config,update_mask\x82\xd3\xe4\x93\x02\x64\x32O/v2/{attributes_config.name=projects/*/locations/*/catalogs/*/attributesConfig}:\x11\x61ttributes_config\x12\xde\x01\n\x13\x41\x64\x64\x43\x61talogAttribute\x12\x32.google.cloud.retail.v2.AddCatalogAttributeRequest\x1a(.google.cloud.retail.v2.AttributesConfig\"i\x82\xd3\xe4\x93\x02\x63\"^/v2/{attributes_config=projects/*/locations/*/catalogs/*/attributesConfig}:addCatalogAttribute:\x01*\x12\xe7\x01\n\x16RemoveCatalogAttribute\x12\x35.google.cloud.retail.v2.RemoveCatalogAttributeRequest\x1a(.google.cloud.retail.v2.AttributesConfig\"l\x82\xd3\xe4\x93\x02\x66\"a/v2/{attributes_config=projects/*/locations/*/catalogs/*/attributesConfig}:removeCatalogAttribute:\x01*\x12\xea\x01\n\x17ReplaceCatalogAttribute\x12\x36.google.cloud.retail.v2.ReplaceCatalogAttributeRequest\x1a(.google.cloud.retail.v2.AttributesConfig\"m\x82\xd3\xe4\x93\x02g\"b/v2/{attributes_config=projects/*/locations/*/catalogs/*/attributesConfig}:replaceCatalogAttribute:\x01*\x1aI\xca\x41\x15retail.googleapis.com\xd2\x41.https://www.googleapis.com/auth/cloud-platformB\xbe\x01\n\x1a\x63om.google.cloud.retail.v2B\x13\x43\x61talogServiceProtoP\x01Z2cloud.google.com/go/retail/apiv2/retailpb;retailpb\xa2\x02\x06RETAIL\xaa\x02\x16Google.Cloud.Retail.V2\xca\x02\x16Google\\Cloud\\Retail\\V2\xea\x02\x19Google::Cloud::Retail::V2b\x06proto3" - -pool = ::Google::Protobuf::DescriptorPool.generated_pool -pool.add_serialized_file(descriptor_data) - -module Google - module Cloud - module Retail - module V2 - ListCatalogsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ListCatalogsRequest").msgclass - ListCatalogsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ListCatalogsResponse").msgclass - UpdateCatalogRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.UpdateCatalogRequest").msgclass - SetDefaultBranchRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SetDefaultBranchRequest").msgclass - GetDefaultBranchRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.GetDefaultBranchRequest").msgclass - GetDefaultBranchResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.GetDefaultBranchResponse").msgclass - GetCompletionConfigRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.GetCompletionConfigRequest").msgclass - UpdateCompletionConfigRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.UpdateCompletionConfigRequest").msgclass - GetAttributesConfigRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.GetAttributesConfigRequest").msgclass - UpdateAttributesConfigRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.UpdateAttributesConfigRequest").msgclass - AddCatalogAttributeRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.AddCatalogAttributeRequest").msgclass - RemoveCatalogAttributeRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.RemoveCatalogAttributeRequest").msgclass - ReplaceCatalogAttributeRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ReplaceCatalogAttributeRequest").msgclass - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service_services_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service_services_pb.rb deleted file mode 100644 index bfd199b2e5c5..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/catalog_service_services_pb.rb +++ /dev/null @@ -1,125 +0,0 @@ -# Generated by the protocol buffer compiler. DO NOT EDIT! -# Source: google/cloud/retail/v2/catalog_service.proto for package 'Google.Cloud.Retail.V2' -# Original file comments: -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -require 'grpc' -require 'google/cloud/retail/v2/catalog_service_pb' - -module Google - module Cloud - module Retail - module V2 - module CatalogService - # Service for managing catalog configuration. - class Service - - include ::GRPC::GenericService - - self.marshal_class_method = :encode - self.unmarshal_class_method = :decode - self.service_name = 'google.cloud.retail.v2.CatalogService' - - # Lists all the [Catalog][google.cloud.retail.v2.Catalog]s associated with - # the project. - rpc :ListCatalogs, ::Google::Cloud::Retail::V2::ListCatalogsRequest, ::Google::Cloud::Retail::V2::ListCatalogsResponse - # Updates the [Catalog][google.cloud.retail.v2.Catalog]s. - rpc :UpdateCatalog, ::Google::Cloud::Retail::V2::UpdateCatalogRequest, ::Google::Cloud::Retail::V2::Catalog - # Set a specified branch id as default branch. API methods such as - # [SearchService.Search][google.cloud.retail.v2.SearchService.Search], - # [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct], - # [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts] - # will treat requests using "default_branch" to the actual branch id set as - # default. - # - # For example, if `projects/*/locations/*/catalogs/*/branches/1` is set as - # default, setting - # [SearchRequest.branch][google.cloud.retail.v2.SearchRequest.branch] to - # `projects/*/locations/*/catalogs/*/branches/default_branch` is equivalent - # to setting - # [SearchRequest.branch][google.cloud.retail.v2.SearchRequest.branch] to - # `projects/*/locations/*/catalogs/*/branches/1`. - # - # Using multiple branches can be useful when developers would like - # to have a staging branch to test and verify for future usage. When it - # becomes ready, developers switch on the staging branch using this API - # while keeping using - # `projects/*/locations/*/catalogs/*/branches/default_branch` as - # [SearchRequest.branch][google.cloud.retail.v2.SearchRequest.branch] to - # route the traffic to this staging branch. - # - # CAUTION: If you have live predict/search traffic, switching the default - # branch could potentially cause outages if the ID space of the new branch - # is very different from the old one. - # - # More specifically: - # - # * PredictionService will only return product IDs from branch {newBranch}. - # * SearchService will only return product IDs from branch {newBranch} - # (if branch is not explicitly set). - # * UserEventService will only join events with products from branch - # {newBranch}. - rpc :SetDefaultBranch, ::Google::Cloud::Retail::V2::SetDefaultBranchRequest, ::Google::Protobuf::Empty - # Get which branch is currently default branch set by - # [CatalogService.SetDefaultBranch][google.cloud.retail.v2.CatalogService.SetDefaultBranch] - # method under a specified parent catalog. - rpc :GetDefaultBranch, ::Google::Cloud::Retail::V2::GetDefaultBranchRequest, ::Google::Cloud::Retail::V2::GetDefaultBranchResponse - # Gets a [CompletionConfig][google.cloud.retail.v2.CompletionConfig]. - rpc :GetCompletionConfig, ::Google::Cloud::Retail::V2::GetCompletionConfigRequest, ::Google::Cloud::Retail::V2::CompletionConfig - # Updates the [CompletionConfig][google.cloud.retail.v2.CompletionConfig]s. - rpc :UpdateCompletionConfig, ::Google::Cloud::Retail::V2::UpdateCompletionConfigRequest, ::Google::Cloud::Retail::V2::CompletionConfig - # Gets an [AttributesConfig][google.cloud.retail.v2.AttributesConfig]. - rpc :GetAttributesConfig, ::Google::Cloud::Retail::V2::GetAttributesConfigRequest, ::Google::Cloud::Retail::V2::AttributesConfig - # Updates the [AttributesConfig][google.cloud.retail.v2.AttributesConfig]. - # - # The catalog attributes in the request will be updated in the catalog, or - # inserted if they do not exist. Existing catalog attributes not included in - # the request will remain unchanged. Attributes that are assigned to - # products, but do not exist at the catalog level, are always included in the - # response. The product attribute is assigned default values for missing - # catalog attribute fields, e.g., searchable and dynamic facetable options. - rpc :UpdateAttributesConfig, ::Google::Cloud::Retail::V2::UpdateAttributesConfigRequest, ::Google::Cloud::Retail::V2::AttributesConfig - # Adds the specified - # [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to the - # [AttributesConfig][google.cloud.retail.v2.AttributesConfig]. - # - # If the [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to add - # already exists, an ALREADY_EXISTS error is returned. - rpc :AddCatalogAttribute, ::Google::Cloud::Retail::V2::AddCatalogAttributeRequest, ::Google::Cloud::Retail::V2::AttributesConfig - # Removes the specified - # [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] from the - # [AttributesConfig][google.cloud.retail.v2.AttributesConfig]. - # - # If the [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to - # remove does not exist, a NOT_FOUND error is returned. - rpc :RemoveCatalogAttribute, ::Google::Cloud::Retail::V2::RemoveCatalogAttributeRequest, ::Google::Cloud::Retail::V2::AttributesConfig - # Replaces the specified - # [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] in the - # [AttributesConfig][google.cloud.retail.v2.AttributesConfig] by updating the - # catalog attribute with the same - # [CatalogAttribute.key][google.cloud.retail.v2.CatalogAttribute.key]. - # - # If the [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to - # replace does not exist, a NOT_FOUND error is returned. - rpc :ReplaceCatalogAttribute, ::Google::Cloud::Retail::V2::ReplaceCatalogAttributeRequest, ::Google::Cloud::Retail::V2::AttributesConfig - end - - Stub = Service.rpc_stub_class - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/common_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/common_pb.rb deleted file mode 100644 index 275dd759e9cb..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/common_pb.rb +++ /dev/null @@ -1,58 +0,0 @@ -# frozen_string_literal: true -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/retail/v2/common.proto - -require 'google/protobuf' - -require 'google/api/field_behavior_pb' -require 'google/protobuf/timestamp_pb' - - -descriptor_data = "\n#google/cloud/retail/v2/common.proto\x12\x16google.cloud.retail.v2\x1a\x1fgoogle/api/field_behavior.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xc9\x02\n\tCondition\x12@\n\x0bquery_terms\x18\x01 \x03(\x0b\x32+.google.cloud.retail.v2.Condition.QueryTerm\x12\x46\n\x11\x61\x63tive_time_range\x18\x03 \x03(\x0b\x32+.google.cloud.retail.v2.Condition.TimeRange\x12\x17\n\x0fpage_categories\x18\x04 \x03(\t\x1a.\n\tQueryTerm\x12\r\n\x05value\x18\x01 \x01(\t\x12\x12\n\nfull_match\x18\x02 \x01(\x08\x1ai\n\tTimeRange\x12.\n\nstart_time\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12,\n\x08\x65nd_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"\xea\r\n\x04Rule\x12@\n\x0c\x62oost_action\x18\x02 \x01(\x0b\x32(.google.cloud.retail.v2.Rule.BoostActionH\x00\x12\x46\n\x0fredirect_action\x18\x03 \x01(\x0b\x32+.google.cloud.retail.v2.Rule.RedirectActionH\x00\x12S\n\x16oneway_synonyms_action\x18\x06 \x01(\x0b\x32\x31.google.cloud.retail.v2.Rule.OnewaySynonymsActionH\x00\x12T\n\x17\x64o_not_associate_action\x18\x07 \x01(\x0b\x32\x31.google.cloud.retail.v2.Rule.DoNotAssociateActionH\x00\x12L\n\x12replacement_action\x18\x08 \x01(\x0b\x32..google.cloud.retail.v2.Rule.ReplacementActionH\x00\x12\x42\n\rignore_action\x18\t \x01(\x0b\x32).google.cloud.retail.v2.Rule.IgnoreActionH\x00\x12\x42\n\rfilter_action\x18\n \x01(\x0b\x32).google.cloud.retail.v2.Rule.FilterActionH\x00\x12S\n\x16twoway_synonyms_action\x18\x0b \x01(\x0b\x32\x31.google.cloud.retail.v2.Rule.TwowaySynonymsActionH\x00\x12X\n\x19\x66orce_return_facet_action\x18\x0c \x01(\x0b\x32\x33.google.cloud.retail.v2.Rule.ForceReturnFacetActionH\x00\x12M\n\x13remove_facet_action\x18\r \x01(\x0b\x32..google.cloud.retail.v2.Rule.RemoveFacetActionH\x00\x12<\n\npin_action\x18\x0e \x01(\x0b\x32&.google.cloud.retail.v2.Rule.PinActionH\x00\x12\x39\n\tcondition\x18\x01 \x01(\x0b\x32!.google.cloud.retail.v2.ConditionB\x03\xe0\x41\x02\x1a\x35\n\x0b\x42oostAction\x12\r\n\x05\x62oost\x18\x01 \x01(\x02\x12\x17\n\x0fproducts_filter\x18\x02 \x01(\t\x1a\x1e\n\x0c\x46ilterAction\x12\x0e\n\x06\x66ilter\x18\x01 \x01(\t\x1a&\n\x0eRedirectAction\x12\x14\n\x0credirect_uri\x18\x01 \x01(\t\x1a(\n\x14TwowaySynonymsAction\x12\x10\n\x08synonyms\x18\x01 \x03(\t\x1aS\n\x14OnewaySynonymsAction\x12\x13\n\x0bquery_terms\x18\x03 \x03(\t\x12\x10\n\x08synonyms\x18\x04 \x03(\t\x12\x14\n\x0coneway_terms\x18\x02 \x03(\t\x1aZ\n\x14\x44oNotAssociateAction\x12\x13\n\x0bquery_terms\x18\x02 \x03(\t\x12\x1e\n\x16\x64o_not_associate_terms\x18\x03 \x03(\t\x12\r\n\x05terms\x18\x01 \x03(\t\x1aP\n\x11ReplacementAction\x12\x13\n\x0bquery_terms\x18\x02 \x03(\t\x12\x18\n\x10replacement_term\x18\x03 \x01(\t\x12\x0c\n\x04term\x18\x01 \x01(\t\x1a$\n\x0cIgnoreAction\x12\x14\n\x0cignore_terms\x18\x01 \x03(\t\x1a\xce\x01\n\x16\x46orceReturnFacetAction\x12o\n\x1a\x66\x61\x63\x65t_position_adjustments\x18\x01 \x03(\x0b\x32K.google.cloud.retail.v2.Rule.ForceReturnFacetAction.FacetPositionAdjustment\x1a\x43\n\x17\x46\x61\x63\x65tPositionAdjustment\x12\x16\n\x0e\x61ttribute_name\x18\x01 \x01(\t\x12\x10\n\x08position\x18\x02 \x01(\x05\x1a,\n\x11RemoveFacetAction\x12\x17\n\x0f\x61ttribute_names\x18\x01 \x03(\t\x1a\x84\x01\n\tPinAction\x12H\n\x07pin_map\x18\x01 \x03(\x0b\x32\x32.google.cloud.retail.v2.Rule.PinAction.PinMapEntryB\x03\xe0\x41\x02\x1a-\n\x0bPinMapEntry\x12\x0b\n\x03key\x18\x01 \x01(\x03\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x42\x08\n\x06\x61\x63tion\"/\n\x08\x41udience\x12\x0f\n\x07genders\x18\x01 \x03(\t\x12\x12\n\nage_groups\x18\x02 \x03(\t\"3\n\tColorInfo\x12\x16\n\x0e\x63olor_families\x18\x01 \x03(\t\x12\x0e\n\x06\x63olors\x18\x02 \x03(\t\"\x86\x01\n\x0f\x43ustomAttribute\x12\x0c\n\x04text\x18\x01 \x03(\t\x12\x0f\n\x07numbers\x18\x02 \x03(\x01\x12\x1b\n\nsearchable\x18\x03 \x01(\x08\x42\x02\x18\x01H\x00\x88\x01\x01\x12\x1a\n\tindexable\x18\x04 \x01(\x08\x42\x02\x18\x01H\x01\x88\x01\x01\x42\r\n\x0b_searchableB\x0c\n\n_indexable\"2\n\x0f\x46ulfillmentInfo\x12\x0c\n\x04type\x18\x01 \x01(\t\x12\x11\n\tplace_ids\x18\x02 \x03(\t\"8\n\x05Image\x12\x10\n\x03uri\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x0e\n\x06height\x18\x02 \x01(\x05\x12\r\n\x05width\x18\x03 \x01(\x05\"x\n\x08Interval\x12\x11\n\x07minimum\x18\x01 \x01(\x01H\x00\x12\x1b\n\x11\x65xclusive_minimum\x18\x02 \x01(\x01H\x00\x12\x11\n\x07maximum\x18\x03 \x01(\x01H\x01\x12\x1b\n\x11\x65xclusive_maximum\x18\x04 \x01(\x01H\x01\x42\x05\n\x03minB\x05\n\x03max\"\x89\x03\n\tPriceInfo\x12\x15\n\rcurrency_code\x18\x01 \x01(\t\x12\r\n\x05price\x18\x02 \x01(\x02\x12\x16\n\x0eoriginal_price\x18\x03 \x01(\x02\x12\x0c\n\x04\x63ost\x18\x04 \x01(\x02\x12\x38\n\x14price_effective_time\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x35\n\x11price_expire_time\x18\x06 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x46\n\x0bprice_range\x18\x07 \x01(\x0b\x32,.google.cloud.retail.v2.PriceInfo.PriceRangeB\x03\xe0\x41\x03\x1aw\n\nPriceRange\x12/\n\x05price\x18\x01 \x01(\x0b\x32 .google.cloud.retail.v2.Interval\x12\x38\n\x0eoriginal_price\x18\x02 \x01(\x0b\x32 .google.cloud.retail.v2.Interval\"P\n\x06Rating\x12\x14\n\x0crating_count\x18\x01 \x01(\x05\x12\x16\n\x0e\x61verage_rating\x18\x02 \x01(\x02\x12\x18\n\x10rating_histogram\x18\x03 \x03(\x05\"`\n\x08UserInfo\x12\x0f\n\x07user_id\x18\x01 \x01(\t\x12\x12\n\nip_address\x18\x02 \x01(\t\x12\x12\n\nuser_agent\x18\x03 \x01(\t\x12\x1b\n\x13\x64irect_user_request\x18\x04 \x01(\x08\"\xb0\x02\n\x0eLocalInventory\x12\x15\n\x08place_id\x18\x01 \x01(\tB\x03\xe0\x41\x01\x12:\n\nprice_info\x18\x02 \x01(\x0b\x32!.google.cloud.retail.v2.PriceInfoB\x03\xe0\x41\x01\x12O\n\nattributes\x18\x03 \x03(\x0b\x32\x36.google.cloud.retail.v2.LocalInventory.AttributesEntryB\x03\xe0\x41\x01\x12\x1e\n\x11\x66ulfillment_types\x18\x04 \x03(\tB\x03\xe0\x41\x01\x1aZ\n\x0f\x41ttributesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x36\n\x05value\x18\x02 \x01(\x0b\x32\'.google.cloud.retail.v2.CustomAttribute:\x02\x38\x01\"\xbf\x03\n\x12PinControlMetadata\x12X\n\x10\x61ll_matched_pins\x18\x01 \x03(\x0b\x32>.google.cloud.retail.v2.PinControlMetadata.AllMatchedPinsEntry\x12Q\n\x0c\x64ropped_pins\x18\x02 \x03(\x0b\x32;.google.cloud.retail.v2.PinControlMetadata.DroppedPinsEntry\x1a!\n\x0bProductPins\x12\x12\n\nproduct_id\x18\x01 \x03(\t\x1am\n\x13\x41llMatchedPinsEntry\x12\x0b\n\x03key\x18\x01 \x01(\x03\x12\x45\n\x05value\x18\x02 \x01(\x0b\x32\x36.google.cloud.retail.v2.PinControlMetadata.ProductPins:\x02\x38\x01\x1aj\n\x10\x44roppedPinsEntry\x12\x0b\n\x03key\x18\x01 \x01(\x03\x12\x45\n\x05value\x18\x02 \x01(\x0b\x32\x36.google.cloud.retail.v2.PinControlMetadata.ProductPins:\x02\x38\x01\"\x1c\n\nStringList\x12\x0e\n\x06values\x18\x01 \x03(\t\"\x1c\n\nDoubleList\x12\x0e\n\x06values\x18\x01 \x03(\x01*\x86\x01\n\x14\x41ttributeConfigLevel\x12&\n\"ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED\x10\x00\x12\"\n\x1ePRODUCT_LEVEL_ATTRIBUTE_CONFIG\x10\x01\x12\"\n\x1e\x43\x41TALOG_LEVEL_ATTRIBUTE_CONFIG\x10\x02*i\n\x0cSolutionType\x12\x1d\n\x19SOLUTION_TYPE_UNSPECIFIED\x10\x00\x12 \n\x1cSOLUTION_TYPE_RECOMMENDATION\x10\x01\x12\x18\n\x14SOLUTION_TYPE_SEARCH\x10\x02*\xa1\x01\n\x1eRecommendationsFilteringOption\x12\x30\n,RECOMMENDATIONS_FILTERING_OPTION_UNSPECIFIED\x10\x00\x12&\n\"RECOMMENDATIONS_FILTERING_DISABLED\x10\x01\x12%\n!RECOMMENDATIONS_FILTERING_ENABLED\x10\x03*\x8b\x01\n\x15SearchSolutionUseCase\x12(\n$SEARCH_SOLUTION_USE_CASE_UNSPECIFIED\x10\x00\x12#\n\x1fSEARCH_SOLUTION_USE_CASE_SEARCH\x10\x01\x12#\n\x1fSEARCH_SOLUTION_USE_CASE_BROWSE\x10\x02\x42\xb6\x01\n\x1a\x63om.google.cloud.retail.v2B\x0b\x43ommonProtoP\x01Z2cloud.google.com/go/retail/apiv2/retailpb;retailpb\xa2\x02\x06RETAIL\xaa\x02\x16Google.Cloud.Retail.V2\xca\x02\x16Google\\Cloud\\Retail\\V2\xea\x02\x19Google::Cloud::Retail::V2b\x06proto3" - -pool = ::Google::Protobuf::DescriptorPool.generated_pool -pool.add_serialized_file(descriptor_data) - -module Google - module Cloud - module Retail - module V2 - Condition = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Condition").msgclass - Condition::QueryTerm = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Condition.QueryTerm").msgclass - Condition::TimeRange = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Condition.TimeRange").msgclass - Rule = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Rule").msgclass - Rule::BoostAction = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Rule.BoostAction").msgclass - Rule::FilterAction = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Rule.FilterAction").msgclass - Rule::RedirectAction = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Rule.RedirectAction").msgclass - Rule::TwowaySynonymsAction = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Rule.TwowaySynonymsAction").msgclass - Rule::OnewaySynonymsAction = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Rule.OnewaySynonymsAction").msgclass - Rule::DoNotAssociateAction = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Rule.DoNotAssociateAction").msgclass - Rule::ReplacementAction = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Rule.ReplacementAction").msgclass - Rule::IgnoreAction = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Rule.IgnoreAction").msgclass - Rule::ForceReturnFacetAction = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Rule.ForceReturnFacetAction").msgclass - Rule::ForceReturnFacetAction::FacetPositionAdjustment = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Rule.ForceReturnFacetAction.FacetPositionAdjustment").msgclass - Rule::RemoveFacetAction = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Rule.RemoveFacetAction").msgclass - Rule::PinAction = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Rule.PinAction").msgclass - Audience = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Audience").msgclass - ColorInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ColorInfo").msgclass - CustomAttribute = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CustomAttribute").msgclass - FulfillmentInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.FulfillmentInfo").msgclass - Image = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Image").msgclass - Interval = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Interval").msgclass - PriceInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.PriceInfo").msgclass - PriceInfo::PriceRange = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.PriceInfo.PriceRange").msgclass - Rating = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Rating").msgclass - UserInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.UserInfo").msgclass - LocalInventory = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.LocalInventory").msgclass - PinControlMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.PinControlMetadata").msgclass - PinControlMetadata::ProductPins = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.PinControlMetadata.ProductPins").msgclass - StringList = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.StringList").msgclass - DoubleList = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.DoubleList").msgclass - AttributeConfigLevel = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.AttributeConfigLevel").enummodule - SolutionType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SolutionType").enummodule - RecommendationsFilteringOption = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.RecommendationsFilteringOption").enummodule - SearchSolutionUseCase = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchSolutionUseCase").enummodule - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service.rb deleted file mode 100644 index 910963175533..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service.rb +++ /dev/null @@ -1,59 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "gapic/common" -require "gapic/config" -require "gapic/config/method" - -require "google/cloud/retail/v2/version" - -require "google/cloud/retail/v2/completion_service/credentials" -require "google/cloud/retail/v2/completion_service/paths" -require "google/cloud/retail/v2/completion_service/operations" -require "google/cloud/retail/v2/completion_service/client" -require "google/cloud/retail/v2/completion_service/rest" - -module Google - module Cloud - module Retail - module V2 - ## - # Autocomplete service for retail. - # - # This feature is only available for users who have Retail Search enabled. - # Enable Retail Search on Cloud Console before using this feature. - # - # @example Load this service and instantiate a gRPC client - # - # require "google/cloud/retail/v2/completion_service" - # client = ::Google::Cloud::Retail::V2::CompletionService::Client.new - # - # @example Load this service and instantiate a REST client - # - # require "google/cloud/retail/v2/completion_service/rest" - # client = ::Google::Cloud::Retail::V2::CompletionService::Rest::Client.new - # - module CompletionService - end - end - end - end -end - -helper_path = ::File.join __dir__, "completion_service", "helpers.rb" -require "google/cloud/retail/v2/completion_service/helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/client.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/client.rb deleted file mode 100644 index 956d00b4dee1..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/client.rb +++ /dev/null @@ -1,716 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "google/cloud/errors" -require "google/cloud/retail/v2/completion_service_pb" -require "google/cloud/location" - -module Google - module Cloud - module Retail - module V2 - module CompletionService - ## - # Client for the CompletionService service. - # - # Autocomplete service for retail. - # - # This feature is only available for users who have Retail Search enabled. - # Enable Retail Search on Cloud Console before using this feature. - # - class Client - # @private - API_VERSION = "" - - # @private - DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" - - include Paths - - # @private - attr_reader :completion_service_stub - - ## - # Configure the CompletionService Client class. - # - # See {::Google::Cloud::Retail::V2::CompletionService::Client::Configuration} - # for a description of the configuration fields. - # - # @example - # - # # Modify the configuration for all CompletionService clients - # ::Google::Cloud::Retail::V2::CompletionService::Client.configure do |config| - # config.timeout = 10.0 - # end - # - # @yield [config] Configure the Client client. - # @yieldparam config [Client::Configuration] - # - # @return [Client::Configuration] - # - def self.configure - @configure ||= begin - namespace = ["Google", "Cloud", "Retail", "V2"] - parent_config = while namespace.any? - parent_name = namespace.join "::" - parent_const = const_get parent_name - break parent_const.configure if parent_const.respond_to? :configure - namespace.pop - end - default_config = Client::Configuration.new parent_config - - default_config.timeout = 5.0 - default_config.retry_policy = { - initial_delay: 0.1, max_delay: 5.0, multiplier: 1.3, retry_codes: [14, 4] - } - - default_config - end - yield @configure if block_given? - @configure - end - - ## - # Configure the CompletionService Client instance. - # - # The configuration is set to the derived mode, meaning that values can be changed, - # but structural changes (adding new fields, etc.) are not allowed. Structural changes - # should be made on {Client.configure}. - # - # See {::Google::Cloud::Retail::V2::CompletionService::Client::Configuration} - # for a description of the configuration fields. - # - # @yield [config] Configure the Client client. - # @yieldparam config [Client::Configuration] - # - # @return [Client::Configuration] - # - def configure - yield @config if block_given? - @config - end - - ## - # The effective universe domain - # - # @return [String] - # - def universe_domain - @completion_service_stub.universe_domain - end - - ## - # Create a new CompletionService client object. - # - # @example - # - # # Create a client using the default configuration - # client = ::Google::Cloud::Retail::V2::CompletionService::Client.new - # - # # Create a client using a custom configuration - # client = ::Google::Cloud::Retail::V2::CompletionService::Client.new do |config| - # config.timeout = 10.0 - # end - # - # @yield [config] Configure the CompletionService client. - # @yieldparam config [Client::Configuration] - # - def initialize - # These require statements are intentionally placed here to initialize - # the gRPC module only when it's required. - # See https://github.com/googleapis/toolkit/issues/446 - require "gapic/grpc" - require "google/cloud/retail/v2/completion_service_services_pb" - - # Create the configuration object - @config = Configuration.new Client.configure - - # Yield the configuration if needed - yield @config if block_given? - - # Create credentials - credentials = @config.credentials - # Use self-signed JWT if the endpoint is unchanged from default, - # but only if the default endpoint does not have a region prefix. - enable_self_signed_jwt = @config.endpoint.nil? || - (@config.endpoint == Configuration::DEFAULT_ENDPOINT && - !@config.endpoint.split(".").first.include?("-")) - credentials ||= Credentials.default scope: @config.scope, - enable_self_signed_jwt: enable_self_signed_jwt - if credentials.is_a?(::String) || credentials.is_a?(::Hash) - credentials = Credentials.new credentials, scope: @config.scope - end - @quota_project_id = @config.quota_project - @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id - - @operations_client = Operations.new do |config| - config.credentials = credentials - config.quota_project = @quota_project_id - config.endpoint = @config.endpoint - config.universe_domain = @config.universe_domain - end - - @completion_service_stub = ::Gapic::ServiceStub.new( - ::Google::Cloud::Retail::V2::CompletionService::Stub, - credentials: credentials, - endpoint: @config.endpoint, - endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, - universe_domain: @config.universe_domain, - channel_args: @config.channel_args, - interceptors: @config.interceptors, - channel_pool_config: @config.channel_pool, - logger: @config.logger - ) - - @completion_service_stub.stub_logger&.info do |entry| - entry.set_system_name - entry.set_service - entry.message = "Created client for #{entry.service}" - entry.set_credentials_fields credentials - entry.set "customEndpoint", @config.endpoint if @config.endpoint - entry.set "defaultTimeout", @config.timeout if @config.timeout - entry.set "quotaProject", @quota_project_id if @quota_project_id - end - - @location_client = Google::Cloud::Location::Locations::Client.new do |config| - config.credentials = credentials - config.quota_project = @quota_project_id - config.endpoint = @completion_service_stub.endpoint - config.universe_domain = @completion_service_stub.universe_domain - config.logger = @completion_service_stub.logger if config.respond_to? :logger= - end - end - - ## - # Get the associated client for long-running operations. - # - # @return [::Google::Cloud::Retail::V2::CompletionService::Operations] - # - attr_reader :operations_client - - ## - # Get the associated client for mix-in of the Locations. - # - # @return [Google::Cloud::Location::Locations::Client] - # - attr_reader :location_client - - ## - # The logger used for request/response debug logging. - # - # @return [Logger] - # - def logger - @completion_service_stub.logger - end - - # Service calls - - ## - # Completes the specified prefix with keyword suggestions. - # - # This feature is only available for users who have Retail Search enabled. - # Enable Retail Search on Cloud Console before using this feature. - # - # @overload complete_query(request, options = nil) - # Pass arguments to `complete_query` via a request object, either of type - # {::Google::Cloud::Retail::V2::CompleteQueryRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::CompleteQueryRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload complete_query(catalog: nil, query: nil, visitor_id: nil, language_codes: nil, device_type: nil, dataset: nil, max_suggestions: nil, enable_attribute_suggestions: nil, entity: nil) - # Pass arguments to `complete_query` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param catalog [::String] - # Required. Catalog for which the completion is performed. - # - # Full resource name of catalog, such as - # `projects/*/locations/global/catalogs/default_catalog`. - # @param query [::String] - # Required. The query used to generate suggestions. - # - # The maximum number of allowed characters is 255. - # @param visitor_id [::String] - # Recommended field. A unique identifier for tracking visitors. For example, - # this could be implemented with an HTTP cookie, which should be able to - # uniquely identify a visitor on a single device. This unique identifier - # should not change if the visitor logs in or out of the website. - # - # The field must be a UTF-8 encoded string with a length limit of 128 - # characters. Otherwise, an INVALID_ARGUMENT error is returned. - # @param language_codes [::Array<::String>] - # Note that this field applies for `user-data` dataset only. For requests - # with `cloud-retail` dataset, setting this field has no effect. - # - # The language filters applied to the output suggestions. If set, it should - # contain the language of the query. If not set, suggestions are returned - # without considering language restrictions. This is the BCP-47 language - # code, such as "en-US" or "sr-Latn". For more information, see [Tags for - # Identifying Languages](https://tools.ietf.org/html/bcp47). The maximum - # number of language codes is 3. - # @param device_type [::String] - # The device type context for completion suggestions. We recommend that you - # leave this field empty. - # - # It can apply different suggestions on different device types, e.g. - # `DESKTOP`, `MOBILE`. If it is empty, the suggestions are across all device - # types. - # - # Supported formats: - # - # * `UNKNOWN_DEVICE_TYPE` - # - # * `DESKTOP` - # - # * `MOBILE` - # - # * A customized string starts with `OTHER_`, e.g. `OTHER_IPHONE`. - # @param dataset [::String] - # Determines which dataset to use for fetching completion. "user-data" will - # use the dataset imported through - # {::Google::Cloud::Retail::V2::CompletionService::Client#import_completion_data CompletionService.ImportCompletionData}. - # `cloud-retail` will use the dataset generated by Cloud Retail based on user - # events. If left empty, completions will be fetched from the `user-data` - # dataset. - # - # Current supported values: - # - # * user-data - # - # * cloud-retail: - # This option requires enabling auto-learning function first. See - # [guidelines](https://cloud.google.com/retail/docs/completion-overview#generated-completion-dataset). - # @param max_suggestions [::Integer] - # Completion max suggestions. If left unset or set to 0, then will fallback - # to the configured value - # {::Google::Cloud::Retail::V2::CompletionConfig#max_suggestions CompletionConfig.max_suggestions}. - # - # The maximum allowed max suggestions is 20. If it is set higher, it will be - # capped by 20. - # @param enable_attribute_suggestions [::Boolean] - # If true, attribute suggestions are enabled and provided in the response. - # - # This field is only available for the `cloud-retail` dataset. - # @param entity [::String] - # The entity for customers who run multiple entities, domains, sites, or - # regions, for example, `Google US`, `Google Ads`, `Waymo`, - # `google.com`, `youtube.com`, etc. - # If this is set, it must be an exact match with - # {::Google::Cloud::Retail::V2::UserEvent#entity UserEvent.entity} to get - # per-entity autocomplete results. This field will be applied to - # `completion_results` only. It has no effect on the `attribute_results`. - # Also, this entity should be limited to 256 characters, if too long, it will - # be truncated to 256 characters in both generation and serving time, and may - # lead to mis-match. To ensure it works, please set the entity with string - # within 256 characters. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Cloud::Retail::V2::CompleteQueryResponse] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Cloud::Retail::V2::CompleteQueryResponse] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::CompletionService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::CompleteQueryRequest.new - # - # # Call the complete_query method. - # result = client.complete_query request - # - # # The returned object is of type Google::Cloud::Retail::V2::CompleteQueryResponse. - # p result - # - def complete_query request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::CompleteQueryRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.complete_query.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.catalog - header_params["catalog"] = request.catalog - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.complete_query.timeout, - metadata: metadata, - retry_policy: @config.rpcs.complete_query.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @completion_service_stub.call_rpc :complete_query, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Bulk import of processed completion dataset. - # - # Request processing is asynchronous. Partial updating is not supported. - # - # The operation is successfully finished only after the imported suggestions - # are indexed successfully and ready for serving. The process takes hours. - # - # This feature is only available for users who have Retail Search enabled. - # Enable Retail Search on Cloud Console before using this feature. - # - # @overload import_completion_data(request, options = nil) - # Pass arguments to `import_completion_data` via a request object, either of type - # {::Google::Cloud::Retail::V2::ImportCompletionDataRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::ImportCompletionDataRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload import_completion_data(parent: nil, input_config: nil, notification_pubsub_topic: nil) - # Pass arguments to `import_completion_data` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. The catalog which the suggestions dataset belongs to. - # - # Format: `projects/1234/locations/global/catalogs/default_catalog`. - # @param input_config [::Google::Cloud::Retail::V2::CompletionDataInputConfig, ::Hash] - # Required. The desired input location of the data. - # @param notification_pubsub_topic [::String] - # Pub/Sub topic for receiving notification. If this field is set, - # when the import is finished, a notification is sent to - # specified Pub/Sub topic. The message data is JSON string of a - # {::Google::Longrunning::Operation Operation}. - # Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::Operation] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::CompletionService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::ImportCompletionDataRequest.new - # - # # Call the import_completion_data method. - # result = client.import_completion_data request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def import_completion_data request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ImportCompletionDataRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.import_completion_data.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.parent - header_params["parent"] = request.parent - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.import_completion_data.timeout, - metadata: metadata, - retry_policy: @config.rpcs.import_completion_data.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @completion_service_stub.call_rpc :import_completion_data, request, options: options do |response, operation| - response = ::Gapic::Operation.new response, @operations_client, options: options - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Configuration class for the CompletionService API. - # - # This class represents the configuration for CompletionService, - # providing control over timeouts, retry behavior, logging, transport - # parameters, and other low-level controls. Certain parameters can also be - # applied individually to specific RPCs. See - # {::Google::Cloud::Retail::V2::CompletionService::Client::Configuration::Rpcs} - # for a list of RPCs that can be configured independently. - # - # Configuration can be applied globally to all clients, or to a single client - # on construction. - # - # @example - # - # # Modify the global config, setting the timeout for - # # complete_query to 20 seconds, - # # and all remaining timeouts to 10 seconds. - # ::Google::Cloud::Retail::V2::CompletionService::Client.configure do |config| - # config.timeout = 10.0 - # config.rpcs.complete_query.timeout = 20.0 - # end - # - # # Apply the above configuration only to a new client. - # client = ::Google::Cloud::Retail::V2::CompletionService::Client.new do |config| - # config.timeout = 10.0 - # config.rpcs.complete_query.timeout = 20.0 - # end - # - # @!attribute [rw] endpoint - # A custom service endpoint, as a hostname or hostname:port. The default is - # nil, indicating to use the default endpoint in the current universe domain. - # @return [::String,nil] - # @!attribute [rw] credentials - # Credentials to send with calls. You may provide any of the following types: - # * (`Google::Auth::Credentials`) A googleauth credentials object - # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) - # * (`Signet::OAuth2::Client`) A signet oauth2 client object - # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) - # * (`GRPC::Core::Channel`) a gRPC channel with included credentials - # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object - # * (`nil`) indicating no credentials - # - # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials - # is deprecated. Providing an unvalidated credential configuration to - # Google APIs can compromise the security of your systems and data. - # - # @example - # - # # The recommended way to provide credentials is to use the `make_creds` method - # # on the appropriate credentials class for your environment. - # - # require "googleauth" - # - # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds( - # json_key_io: ::File.open("/path/to/keyfile.json") - # ) - # - # client = ::Google::Cloud::Retail::V2::CompletionService::Client.new do |config| - # config.credentials = credentials - # end - # - # @note Warning: If you accept a credential configuration (JSON file or Hash) from an - # external source for authentication to Google Cloud, you must validate it before - # providing it to a Google API client library. Providing an unvalidated credential - # configuration to Google APIs can compromise the security of your systems and data. - # For more information, refer to [Validate credential configurations from external - # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). - # @return [::Object] - # @!attribute [rw] scope - # The OAuth scopes - # @return [::Array<::String>] - # @!attribute [rw] lib_name - # The library name as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] lib_version - # The library version as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] channel_args - # Extra parameters passed to the gRPC channel. Note: this is ignored if a - # `GRPC::Core::Channel` object is provided as the credential. - # @return [::Hash] - # @!attribute [rw] interceptors - # An array of interceptors that are run before calls are executed. - # @return [::Array<::GRPC::ClientInterceptor>] - # @!attribute [rw] timeout - # The call timeout in seconds. - # @return [::Numeric] - # @!attribute [rw] metadata - # Additional gRPC headers to be sent with the call. - # @return [::Hash{::Symbol=>::String}] - # @!attribute [rw] retry_policy - # The retry policy. The value is a hash with the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # @return [::Hash] - # @!attribute [rw] quota_project - # A separate project against which to charge quota. - # @return [::String] - # @!attribute [rw] universe_domain - # The universe domain within which to make requests. This determines the - # default endpoint URL. The default value of nil uses the environment - # universe (usually the default "googleapis.com" universe). - # @return [::String,nil] - # @!attribute [rw] logger - # A custom logger to use for request/response debug logging, or the value - # `:default` (the default) to construct a default logger, or `nil` to - # explicitly disable logging. - # @return [::Logger,:default,nil] - # - class Configuration - extend ::Gapic::Config - - # @private - # The endpoint specific to the default "googleapis.com" universe. Deprecated. - DEFAULT_ENDPOINT = "retail.googleapis.com" - - config_attr :endpoint, nil, ::String, nil - config_attr :credentials, nil do |value| - allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] - allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel - allowed.any? { |klass| klass === value } - end - config_attr :scope, nil, ::String, ::Array, nil - config_attr :lib_name, nil, ::String, nil - config_attr :lib_version, nil, ::String, nil - config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) - config_attr :interceptors, nil, ::Array, nil - config_attr :timeout, nil, ::Numeric, nil - config_attr :metadata, nil, ::Hash, nil - config_attr :retry_policy, nil, ::Hash, ::Proc, nil - config_attr :quota_project, nil, ::String, nil - config_attr :universe_domain, nil, ::String, nil - config_attr :logger, :default, ::Logger, nil, :default - - # @private - def initialize parent_config = nil - @parent_config = parent_config unless parent_config.nil? - - yield self if block_given? - end - - ## - # Configurations for individual RPCs - # @return [Rpcs] - # - def rpcs - @rpcs ||= begin - parent_rpcs = nil - parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) - Rpcs.new parent_rpcs - end - end - - ## - # Configuration for the channel pool - # @return [::Gapic::ServiceStub::ChannelPool::Configuration] - # - def channel_pool - @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new - end - - ## - # Configuration RPC class for the CompletionService API. - # - # Includes fields providing the configuration for each RPC in this service. - # Each configuration object is of type `Gapic::Config::Method` and includes - # the following configuration fields: - # - # * `timeout` (*type:* `Numeric`) - The call timeout in seconds - # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers - # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields - # include the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # - class Rpcs - ## - # RPC-specific configuration for `complete_query` - # @return [::Gapic::Config::Method] - # - attr_reader :complete_query - ## - # RPC-specific configuration for `import_completion_data` - # @return [::Gapic::Config::Method] - # - attr_reader :import_completion_data - - # @private - def initialize parent_rpcs = nil - complete_query_config = parent_rpcs.complete_query if parent_rpcs.respond_to? :complete_query - @complete_query = ::Gapic::Config::Method.new complete_query_config - import_completion_data_config = parent_rpcs.import_completion_data if parent_rpcs.respond_to? :import_completion_data - @import_completion_data = ::Gapic::Config::Method.new import_completion_data_config - - yield self if block_given? - end - end - end - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/credentials.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/credentials.rb deleted file mode 100644 index fad74ea58827..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/credentials.rb +++ /dev/null @@ -1,51 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "googleauth" - -module Google - module Cloud - module Retail - module V2 - module CompletionService - # Credentials for the CompletionService API. - class Credentials < ::Google::Auth::Credentials - self.scope = [ - "https://www.googleapis.com/auth/cloud-platform" - ] - self.env_vars = [ - "RETAIL_CREDENTIALS", - "RETAIL_KEYFILE", - "GOOGLE_CLOUD_CREDENTIALS", - "GOOGLE_CLOUD_KEYFILE", - "GCLOUD_KEYFILE", - "RETAIL_CREDENTIALS_JSON", - "RETAIL_KEYFILE_JSON", - "GOOGLE_CLOUD_CREDENTIALS_JSON", - "GOOGLE_CLOUD_KEYFILE_JSON", - "GCLOUD_KEYFILE_JSON" - ] - self.paths = [ - "~/.config/google_cloud/application_default_credentials.json" - ] - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/operations.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/operations.rb deleted file mode 100644 index 0c0957f84195..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/operations.rb +++ /dev/null @@ -1,843 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "gapic/operation" -require "google/longrunning/operations_pb" - -module Google - module Cloud - module Retail - module V2 - module CompletionService - # Service that implements Longrunning Operations API. - class Operations - # @private - API_VERSION = "" - - # @private - DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" - - # @private - attr_reader :operations_stub - - ## - # Configuration for the CompletionService Operations API. - # - # @yield [config] Configure the Operations client. - # @yieldparam config [Operations::Configuration] - # - # @return [Operations::Configuration] - # - def self.configure - @configure ||= Operations::Configuration.new - yield @configure if block_given? - @configure - end - - ## - # Configure the CompletionService Operations instance. - # - # The configuration is set to the derived mode, meaning that values can be changed, - # but structural changes (adding new fields, etc.) are not allowed. Structural changes - # should be made on {Operations.configure}. - # - # @yield [config] Configure the Operations client. - # @yieldparam config [Operations::Configuration] - # - # @return [Operations::Configuration] - # - def configure - yield @config if block_given? - @config - end - - ## - # The effective universe domain - # - # @return [String] - # - def universe_domain - @operations_stub.universe_domain - end - - ## - # Create a new Operations client object. - # - # @yield [config] Configure the Client client. - # @yieldparam config [Operations::Configuration] - # - def initialize - # These require statements are intentionally placed here to initialize - # the gRPC module only when it's required. - # See https://github.com/googleapis/toolkit/issues/446 - require "gapic/grpc" - require "google/longrunning/operations_services_pb" - - # Create the configuration object - @config = Configuration.new Operations.configure - - # Yield the configuration if needed - yield @config if block_given? - - # Create credentials - credentials = @config.credentials - credentials ||= Credentials.default scope: @config.scope - if credentials.is_a?(::String) || credentials.is_a?(::Hash) - credentials = Credentials.new credentials, scope: @config.scope - end - @quota_project_id = @config.quota_project - @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id - - @operations_stub = ::Gapic::ServiceStub.new( - ::Google::Longrunning::Operations::Stub, - credentials: credentials, - endpoint: @config.endpoint, - endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, - universe_domain: @config.universe_domain, - channel_args: @config.channel_args, - interceptors: @config.interceptors, - channel_pool_config: @config.channel_pool - ) - - # Used by an LRO wrapper for some methods of this service - @operations_client = self - end - - # Service calls - - ## - # Lists operations that match the specified filter in the request. If the - # server doesn't support this method, it returns `UNIMPLEMENTED`. - # - # @overload list_operations(request, options = nil) - # Pass arguments to `list_operations` via a request object, either of type - # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::ListOperationsRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload list_operations(name: nil, filter: nil, page_size: nil, page_token: nil, return_partial_success: nil) - # Pass arguments to `list_operations` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation's parent resource. - # @param filter [::String] - # The standard list filter. - # @param page_size [::Integer] - # The standard list page size. - # @param page_token [::String] - # The standard list page token. - # @param return_partial_success [::Boolean] - # When set to `true`, operations that are reachable are returned as normal, - # and those that are unreachable are returned in the - # [ListOperationsResponse.unreachable] field. - # - # This can only be `true` when reading across collections e.g. when `parent` - # is set to `"projects/example/locations/-"`. - # - # This field is not by default supported and will result in an - # `UNIMPLEMENTED` error if set unless explicitly documented otherwise in - # service or product specific documentation. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::PagedEnumerable<::Gapic::Operation>] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::PagedEnumerable<::Gapic::Operation>] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::ListOperationsRequest.new - # - # # Call the list_operations method. - # result = client.list_operations request - # - # # The returned object is of type Gapic::PagedEnumerable. You can iterate - # # over elements, and API calls will be issued to fetch pages as needed. - # result.each do |item| - # # Each element is of type ::Google::Longrunning::Operation. - # p item - # end - # - def list_operations request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::ListOperationsRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.list_operations.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.name - header_params["name"] = request.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.list_operations.timeout, - metadata: metadata, - retry_policy: @config.rpcs.list_operations.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.call_rpc :list_operations, request, options: options do |response, operation| - wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client } - response = ::Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Gets the latest state of a long-running operation. Clients can use this - # method to poll the operation result at intervals as recommended by the API - # service. - # - # @overload get_operation(request, options = nil) - # Pass arguments to `get_operation` via a request object, either of type - # {::Google::Longrunning::GetOperationRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::GetOperationRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload get_operation(name: nil) - # Pass arguments to `get_operation` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation resource. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::Operation] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::GetOperationRequest.new - # - # # Call the get_operation method. - # result = client.get_operation request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def get_operation request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::GetOperationRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.get_operation.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.name - header_params["name"] = request.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.get_operation.timeout, - metadata: metadata, - retry_policy: @config.rpcs.get_operation.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.call_rpc :get_operation, request, options: options do |response, operation| - response = ::Gapic::Operation.new response, @operations_client, options: options - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Deletes a long-running operation. This method indicates that the client is - # no longer interested in the operation result. It does not cancel the - # operation. If the server doesn't support this method, it returns - # `google.rpc.Code.UNIMPLEMENTED`. - # - # @overload delete_operation(request, options = nil) - # Pass arguments to `delete_operation` via a request object, either of type - # {::Google::Longrunning::DeleteOperationRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::DeleteOperationRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload delete_operation(name: nil) - # Pass arguments to `delete_operation` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation resource to be deleted. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Protobuf::Empty] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Protobuf::Empty] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::DeleteOperationRequest.new - # - # # Call the delete_operation method. - # result = client.delete_operation request - # - # # The returned object is of type Google::Protobuf::Empty. - # p result - # - def delete_operation request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::DeleteOperationRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.delete_operation.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.name - header_params["name"] = request.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.delete_operation.timeout, - metadata: metadata, - retry_policy: @config.rpcs.delete_operation.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.call_rpc :delete_operation, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Starts asynchronous cancellation on a long-running operation. The server - # makes a best effort to cancel the operation, but success is not - # guaranteed. If the server doesn't support this method, it returns - # `google.rpc.Code.UNIMPLEMENTED`. Clients can use - # Operations.GetOperation or - # other methods to check whether the cancellation succeeded or whether the - # operation completed despite cancellation. On successful cancellation, - # the operation is not deleted; instead, it becomes an operation with - # an {::Google::Longrunning::Operation#error Operation.error} value with a - # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to - # `Code.CANCELLED`. - # - # @overload cancel_operation(request, options = nil) - # Pass arguments to `cancel_operation` via a request object, either of type - # {::Google::Longrunning::CancelOperationRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::CancelOperationRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload cancel_operation(name: nil) - # Pass arguments to `cancel_operation` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation resource to be cancelled. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Protobuf::Empty] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Protobuf::Empty] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::CancelOperationRequest.new - # - # # Call the cancel_operation method. - # result = client.cancel_operation request - # - # # The returned object is of type Google::Protobuf::Empty. - # p result - # - def cancel_operation request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::CancelOperationRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.cancel_operation.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.name - header_params["name"] = request.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.cancel_operation.timeout, - metadata: metadata, - retry_policy: @config.rpcs.cancel_operation.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Waits until the specified long-running operation is done or reaches at most - # a specified timeout, returning the latest state. If the operation is - # already done, the latest state is immediately returned. If the timeout - # specified is greater than the default HTTP/RPC timeout, the HTTP/RPC - # timeout is used. If the server does not support this method, it returns - # `google.rpc.Code.UNIMPLEMENTED`. - # Note that this method is on a best-effort basis. It may return the latest - # state before the specified timeout (including immediately), meaning even an - # immediate response is no guarantee that the operation is done. - # - # @overload wait_operation(request, options = nil) - # Pass arguments to `wait_operation` via a request object, either of type - # {::Google::Longrunning::WaitOperationRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::WaitOperationRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload wait_operation(name: nil, timeout: nil) - # Pass arguments to `wait_operation` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation resource to wait on. - # @param timeout [::Google::Protobuf::Duration, ::Hash] - # The maximum duration to wait before timing out. If left blank, the wait - # will be at most the time permitted by the underlying HTTP/RPC protocol. - # If RPC context deadline is also specified, the shorter one will be used. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::Operation] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::WaitOperationRequest.new - # - # # Call the wait_operation method. - # result = client.wait_operation request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def wait_operation request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::WaitOperationRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.wait_operation.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.wait_operation.timeout, - metadata: metadata, - retry_policy: @config.rpcs.wait_operation.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation| - response = ::Gapic::Operation.new response, @operations_client, options: options - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Configuration class for the Operations API. - # - # This class represents the configuration for Operations, - # providing control over timeouts, retry behavior, logging, transport - # parameters, and other low-level controls. Certain parameters can also be - # applied individually to specific RPCs. See - # {::Google::Longrunning::Operations::Client::Configuration::Rpcs} - # for a list of RPCs that can be configured independently. - # - # Configuration can be applied globally to all clients, or to a single client - # on construction. - # - # @example - # - # # Modify the global config, setting the timeout for - # # list_operations to 20 seconds, - # # and all remaining timeouts to 10 seconds. - # ::Google::Longrunning::Operations::Client.configure do |config| - # config.timeout = 10.0 - # config.rpcs.list_operations.timeout = 20.0 - # end - # - # # Apply the above configuration only to a new client. - # client = ::Google::Longrunning::Operations::Client.new do |config| - # config.timeout = 10.0 - # config.rpcs.list_operations.timeout = 20.0 - # end - # - # @!attribute [rw] endpoint - # A custom service endpoint, as a hostname or hostname:port. The default is - # nil, indicating to use the default endpoint in the current universe domain. - # @return [::String,nil] - # @!attribute [rw] credentials - # Credentials to send with calls. You may provide any of the following types: - # * (`Google::Auth::Credentials`) A googleauth credentials object - # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) - # * (`Signet::OAuth2::Client`) A signet oauth2 client object - # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) - # * (`GRPC::Core::Channel`) a gRPC channel with included credentials - # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object - # * (`nil`) indicating no credentials - # - # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials - # is deprecated. Providing an unvalidated credential configuration to - # Google APIs can compromise the security of your systems and data. - # - # @example - # - # # The recommended way to provide credentials is to use the `make_creds` method - # # on the appropriate credentials class for your environment. - # - # require "googleauth" - # - # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds( - # json_key_io: ::File.open("/path/to/keyfile.json") - # ) - # - # client = ::Google::Longrunning::Operations::Client.new do |config| - # config.credentials = credentials - # end - # - # @note Warning: If you accept a credential configuration (JSON file or Hash) from an - # external source for authentication to Google Cloud, you must validate it before - # providing it to a Google API client library. Providing an unvalidated credential - # configuration to Google APIs can compromise the security of your systems and data. - # For more information, refer to [Validate credential configurations from external - # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). - # @return [::Object] - # @!attribute [rw] scope - # The OAuth scopes - # @return [::Array<::String>] - # @!attribute [rw] lib_name - # The library name as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] lib_version - # The library version as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] channel_args - # Extra parameters passed to the gRPC channel. Note: this is ignored if a - # `GRPC::Core::Channel` object is provided as the credential. - # @return [::Hash] - # @!attribute [rw] interceptors - # An array of interceptors that are run before calls are executed. - # @return [::Array<::GRPC::ClientInterceptor>] - # @!attribute [rw] timeout - # The call timeout in seconds. - # @return [::Numeric] - # @!attribute [rw] metadata - # Additional gRPC headers to be sent with the call. - # @return [::Hash{::Symbol=>::String}] - # @!attribute [rw] retry_policy - # The retry policy. The value is a hash with the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # @return [::Hash] - # @!attribute [rw] quota_project - # A separate project against which to charge quota. - # @return [::String] - # @!attribute [rw] universe_domain - # The universe domain within which to make requests. This determines the - # default endpoint URL. The default value of nil uses the environment - # universe (usually the default "googleapis.com" universe). - # @return [::String,nil] - # @!attribute [rw] logger - # A custom logger to use for request/response debug logging, or the value - # `:default` (the default) to construct a default logger, or `nil` to - # explicitly disable logging. - # @return [::Logger,:default,nil] - # - class Configuration - extend ::Gapic::Config - - # @private - # The endpoint specific to the default "googleapis.com" universe. Deprecated. - DEFAULT_ENDPOINT = "retail.googleapis.com" - - config_attr :endpoint, nil, ::String, nil - config_attr :credentials, nil do |value| - allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] - allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel - allowed.any? { |klass| klass === value } - end - config_attr :scope, nil, ::String, ::Array, nil - config_attr :lib_name, nil, ::String, nil - config_attr :lib_version, nil, ::String, nil - config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) - config_attr :interceptors, nil, ::Array, nil - config_attr :timeout, nil, ::Numeric, nil - config_attr :metadata, nil, ::Hash, nil - config_attr :retry_policy, nil, ::Hash, ::Proc, nil - config_attr :quota_project, nil, ::String, nil - config_attr :universe_domain, nil, ::String, nil - config_attr :logger, :default, ::Logger, nil, :default - - # @private - def initialize parent_config = nil - @parent_config = parent_config unless parent_config.nil? - - yield self if block_given? - end - - ## - # Configurations for individual RPCs - # @return [Rpcs] - # - def rpcs - @rpcs ||= begin - parent_rpcs = nil - parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) - Rpcs.new parent_rpcs - end - end - - ## - # Configuration for the channel pool - # @return [::Gapic::ServiceStub::ChannelPool::Configuration] - # - def channel_pool - @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new - end - - ## - # Configuration RPC class for the Operations API. - # - # Includes fields providing the configuration for each RPC in this service. - # Each configuration object is of type `Gapic::Config::Method` and includes - # the following configuration fields: - # - # * `timeout` (*type:* `Numeric`) - The call timeout in seconds - # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers - # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields - # include the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # - class Rpcs - ## - # RPC-specific configuration for `list_operations` - # @return [::Gapic::Config::Method] - # - attr_reader :list_operations - ## - # RPC-specific configuration for `get_operation` - # @return [::Gapic::Config::Method] - # - attr_reader :get_operation - ## - # RPC-specific configuration for `delete_operation` - # @return [::Gapic::Config::Method] - # - attr_reader :delete_operation - ## - # RPC-specific configuration for `cancel_operation` - # @return [::Gapic::Config::Method] - # - attr_reader :cancel_operation - ## - # RPC-specific configuration for `wait_operation` - # @return [::Gapic::Config::Method] - # - attr_reader :wait_operation - - # @private - def initialize parent_rpcs = nil - list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations - @list_operations = ::Gapic::Config::Method.new list_operations_config - get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation - @get_operation = ::Gapic::Config::Method.new get_operation_config - delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation - @delete_operation = ::Gapic::Config::Method.new delete_operation_config - cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation - @cancel_operation = ::Gapic::Config::Method.new cancel_operation_config - wait_operation_config = parent_rpcs.wait_operation if parent_rpcs.respond_to? :wait_operation - @wait_operation = ::Gapic::Config::Method.new wait_operation_config - - yield self if block_given? - end - end - end - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/paths.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/paths.rb deleted file mode 100644 index 600b86ed9a0d..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/paths.rb +++ /dev/null @@ -1,52 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Cloud - module Retail - module V2 - module CompletionService - # Path helper methods for the CompletionService API. - module Paths - ## - # Create a fully-qualified Catalog resource string. - # - # The resource will be in the following format: - # - # `projects/{project}/locations/{location}/catalogs/{catalog}` - # - # @param project [String] - # @param location [String] - # @param catalog [String] - # - # @return [::String] - def catalog_path project:, location:, catalog: - raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" - raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" - - "projects/#{project}/locations/#{location}/catalogs/#{catalog}" - end - - extend self - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/rest.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/rest.rb deleted file mode 100644 index 1cf8247a53be..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/rest.rb +++ /dev/null @@ -1,56 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "gapic/rest" -require "gapic/config" -require "gapic/config/method" - -require "google/cloud/retail/v2/version" - -require "google/cloud/retail/v2/completion_service/credentials" -require "google/cloud/retail/v2/completion_service/paths" -require "google/cloud/retail/v2/completion_service/rest/operations" -require "google/cloud/retail/v2/completion_service/rest/client" - -module Google - module Cloud - module Retail - module V2 - ## - # Autocomplete service for retail. - # - # This feature is only available for users who have Retail Search enabled. - # Enable Retail Search on Cloud Console before using this feature. - # - # To load this service and instantiate a REST client: - # - # require "google/cloud/retail/v2/completion_service/rest" - # client = ::Google::Cloud::Retail::V2::CompletionService::Rest::Client.new - # - module CompletionService - # Client for the REST transport - module Rest - end - end - end - end - end -end - -helper_path = ::File.join __dir__, "rest", "helpers.rb" -require "google/cloud/retail/v2/completion_service/rest/helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/rest/client.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/rest/client.rb deleted file mode 100644 index 7e1ea70c6b10..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/rest/client.rb +++ /dev/null @@ -1,659 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "google/cloud/errors" -require "google/cloud/retail/v2/completion_service_pb" -require "google/cloud/retail/v2/completion_service/rest/service_stub" -require "google/cloud/location/rest" - -module Google - module Cloud - module Retail - module V2 - module CompletionService - module Rest - ## - # REST client for the CompletionService service. - # - # Autocomplete service for retail. - # - # This feature is only available for users who have Retail Search enabled. - # Enable Retail Search on Cloud Console before using this feature. - # - class Client - # @private - API_VERSION = "" - - # @private - DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" - - include Paths - - # @private - attr_reader :completion_service_stub - - ## - # Configure the CompletionService Client class. - # - # See {::Google::Cloud::Retail::V2::CompletionService::Rest::Client::Configuration} - # for a description of the configuration fields. - # - # @example - # - # # Modify the configuration for all CompletionService clients - # ::Google::Cloud::Retail::V2::CompletionService::Rest::Client.configure do |config| - # config.timeout = 10.0 - # end - # - # @yield [config] Configure the Client client. - # @yieldparam config [Client::Configuration] - # - # @return [Client::Configuration] - # - def self.configure - @configure ||= begin - namespace = ["Google", "Cloud", "Retail", "V2"] - parent_config = while namespace.any? - parent_name = namespace.join "::" - parent_const = const_get parent_name - break parent_const.configure if parent_const.respond_to? :configure - namespace.pop - end - default_config = Client::Configuration.new parent_config - - default_config.timeout = 5.0 - default_config.retry_policy = { - initial_delay: 0.1, max_delay: 5.0, multiplier: 1.3, retry_codes: [14, 4] - } - - default_config - end - yield @configure if block_given? - @configure - end - - ## - # Configure the CompletionService Client instance. - # - # The configuration is set to the derived mode, meaning that values can be changed, - # but structural changes (adding new fields, etc.) are not allowed. Structural changes - # should be made on {Client.configure}. - # - # See {::Google::Cloud::Retail::V2::CompletionService::Rest::Client::Configuration} - # for a description of the configuration fields. - # - # @yield [config] Configure the Client client. - # @yieldparam config [Client::Configuration] - # - # @return [Client::Configuration] - # - def configure - yield @config if block_given? - @config - end - - ## - # The effective universe domain - # - # @return [String] - # - def universe_domain - @completion_service_stub.universe_domain - end - - ## - # Create a new CompletionService REST client object. - # - # @example - # - # # Create a client using the default configuration - # client = ::Google::Cloud::Retail::V2::CompletionService::Rest::Client.new - # - # # Create a client using a custom configuration - # client = ::Google::Cloud::Retail::V2::CompletionService::Rest::Client.new do |config| - # config.timeout = 10.0 - # end - # - # @yield [config] Configure the CompletionService client. - # @yieldparam config [Client::Configuration] - # - def initialize - # Create the configuration object - @config = Configuration.new Client.configure - - # Yield the configuration if needed - yield @config if block_given? - - # Create credentials - credentials = @config.credentials - # Use self-signed JWT if the endpoint is unchanged from default, - # but only if the default endpoint does not have a region prefix. - enable_self_signed_jwt = @config.endpoint.nil? || - (@config.endpoint == Configuration::DEFAULT_ENDPOINT && - !@config.endpoint.split(".").first.include?("-")) - credentials ||= Credentials.default scope: @config.scope, - enable_self_signed_jwt: enable_self_signed_jwt - if credentials.is_a?(::String) || credentials.is_a?(::Hash) - credentials = Credentials.new credentials, scope: @config.scope - end - - @quota_project_id = @config.quota_project - @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id - - @operations_client = ::Google::Cloud::Retail::V2::CompletionService::Rest::Operations.new do |config| - config.credentials = credentials - config.quota_project = @quota_project_id - config.endpoint = @config.endpoint - config.universe_domain = @config.universe_domain - end - - @completion_service_stub = ::Google::Cloud::Retail::V2::CompletionService::Rest::ServiceStub.new( - endpoint: @config.endpoint, - endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, - universe_domain: @config.universe_domain, - credentials: credentials, - logger: @config.logger - ) - - @completion_service_stub.logger(stub: true)&.info do |entry| - entry.set_system_name - entry.set_service - entry.message = "Created client for #{entry.service}" - entry.set_credentials_fields credentials - entry.set "customEndpoint", @config.endpoint if @config.endpoint - entry.set "defaultTimeout", @config.timeout if @config.timeout - entry.set "quotaProject", @quota_project_id if @quota_project_id - end - - @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config| - config.credentials = credentials - config.quota_project = @quota_project_id - config.endpoint = @completion_service_stub.endpoint - config.universe_domain = @completion_service_stub.universe_domain - config.logger = @completion_service_stub.logger if config.respond_to? :logger= - end - end - - ## - # Get the associated client for long-running operations. - # - # @return [::Google::Cloud::Retail::V2::CompletionService::Rest::Operations] - # - attr_reader :operations_client - - ## - # Get the associated client for mix-in of the Locations. - # - # @return [Google::Cloud::Location::Locations::Rest::Client] - # - attr_reader :location_client - - ## - # The logger used for request/response debug logging. - # - # @return [Logger] - # - def logger - @completion_service_stub.logger - end - - # Service calls - - ## - # Completes the specified prefix with keyword suggestions. - # - # This feature is only available for users who have Retail Search enabled. - # Enable Retail Search on Cloud Console before using this feature. - # - # @overload complete_query(request, options = nil) - # Pass arguments to `complete_query` via a request object, either of type - # {::Google::Cloud::Retail::V2::CompleteQueryRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::CompleteQueryRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload complete_query(catalog: nil, query: nil, visitor_id: nil, language_codes: nil, device_type: nil, dataset: nil, max_suggestions: nil, enable_attribute_suggestions: nil, entity: nil) - # Pass arguments to `complete_query` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param catalog [::String] - # Required. Catalog for which the completion is performed. - # - # Full resource name of catalog, such as - # `projects/*/locations/global/catalogs/default_catalog`. - # @param query [::String] - # Required. The query used to generate suggestions. - # - # The maximum number of allowed characters is 255. - # @param visitor_id [::String] - # Recommended field. A unique identifier for tracking visitors. For example, - # this could be implemented with an HTTP cookie, which should be able to - # uniquely identify a visitor on a single device. This unique identifier - # should not change if the visitor logs in or out of the website. - # - # The field must be a UTF-8 encoded string with a length limit of 128 - # characters. Otherwise, an INVALID_ARGUMENT error is returned. - # @param language_codes [::Array<::String>] - # Note that this field applies for `user-data` dataset only. For requests - # with `cloud-retail` dataset, setting this field has no effect. - # - # The language filters applied to the output suggestions. If set, it should - # contain the language of the query. If not set, suggestions are returned - # without considering language restrictions. This is the BCP-47 language - # code, such as "en-US" or "sr-Latn". For more information, see [Tags for - # Identifying Languages](https://tools.ietf.org/html/bcp47). The maximum - # number of language codes is 3. - # @param device_type [::String] - # The device type context for completion suggestions. We recommend that you - # leave this field empty. - # - # It can apply different suggestions on different device types, e.g. - # `DESKTOP`, `MOBILE`. If it is empty, the suggestions are across all device - # types. - # - # Supported formats: - # - # * `UNKNOWN_DEVICE_TYPE` - # - # * `DESKTOP` - # - # * `MOBILE` - # - # * A customized string starts with `OTHER_`, e.g. `OTHER_IPHONE`. - # @param dataset [::String] - # Determines which dataset to use for fetching completion. "user-data" will - # use the dataset imported through - # {::Google::Cloud::Retail::V2::CompletionService::Rest::Client#import_completion_data CompletionService.ImportCompletionData}. - # `cloud-retail` will use the dataset generated by Cloud Retail based on user - # events. If left empty, completions will be fetched from the `user-data` - # dataset. - # - # Current supported values: - # - # * user-data - # - # * cloud-retail: - # This option requires enabling auto-learning function first. See - # [guidelines](https://cloud.google.com/retail/docs/completion-overview#generated-completion-dataset). - # @param max_suggestions [::Integer] - # Completion max suggestions. If left unset or set to 0, then will fallback - # to the configured value - # {::Google::Cloud::Retail::V2::CompletionConfig#max_suggestions CompletionConfig.max_suggestions}. - # - # The maximum allowed max suggestions is 20. If it is set higher, it will be - # capped by 20. - # @param enable_attribute_suggestions [::Boolean] - # If true, attribute suggestions are enabled and provided in the response. - # - # This field is only available for the `cloud-retail` dataset. - # @param entity [::String] - # The entity for customers who run multiple entities, domains, sites, or - # regions, for example, `Google US`, `Google Ads`, `Waymo`, - # `google.com`, `youtube.com`, etc. - # If this is set, it must be an exact match with - # {::Google::Cloud::Retail::V2::UserEvent#entity UserEvent.entity} to get - # per-entity autocomplete results. This field will be applied to - # `completion_results` only. It has no effect on the `attribute_results`. - # Also, this entity should be limited to 256 characters, if too long, it will - # be truncated to 256 characters in both generation and serving time, and may - # lead to mis-match. To ensure it works, please set the entity with string - # within 256 characters. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::CompleteQueryResponse] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::CompleteQueryResponse] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::CompletionService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::CompleteQueryRequest.new - # - # # Call the complete_query method. - # result = client.complete_query request - # - # # The returned object is of type Google::Cloud::Retail::V2::CompleteQueryResponse. - # p result - # - def complete_query request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::CompleteQueryRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.complete_query.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.complete_query.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.complete_query.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @completion_service_stub.complete_query request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Bulk import of processed completion dataset. - # - # Request processing is asynchronous. Partial updating is not supported. - # - # The operation is successfully finished only after the imported suggestions - # are indexed successfully and ready for serving. The process takes hours. - # - # This feature is only available for users who have Retail Search enabled. - # Enable Retail Search on Cloud Console before using this feature. - # - # @overload import_completion_data(request, options = nil) - # Pass arguments to `import_completion_data` via a request object, either of type - # {::Google::Cloud::Retail::V2::ImportCompletionDataRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::ImportCompletionDataRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload import_completion_data(parent: nil, input_config: nil, notification_pubsub_topic: nil) - # Pass arguments to `import_completion_data` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. The catalog which the suggestions dataset belongs to. - # - # Format: `projects/1234/locations/global/catalogs/default_catalog`. - # @param input_config [::Google::Cloud::Retail::V2::CompletionDataInputConfig, ::Hash] - # Required. The desired input location of the data. - # @param notification_pubsub_topic [::String] - # Pub/Sub topic for receiving notification. If this field is set, - # when the import is finished, a notification is sent to - # specified Pub/Sub topic. The message data is JSON string of a - # {::Google::Longrunning::Operation Operation}. - # Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Gapic::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::CompletionService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::ImportCompletionDataRequest.new - # - # # Call the import_completion_data method. - # result = client.import_completion_data request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def import_completion_data request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ImportCompletionDataRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.import_completion_data.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.import_completion_data.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.import_completion_data.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @completion_service_stub.import_completion_data request, options do |result, operation| - result = ::Gapic::Operation.new result, @operations_client, options: options - yield result, operation if block_given? - throw :response, result - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Configuration class for the CompletionService REST API. - # - # This class represents the configuration for CompletionService REST, - # providing control over timeouts, retry behavior, logging, transport - # parameters, and other low-level controls. Certain parameters can also be - # applied individually to specific RPCs. See - # {::Google::Cloud::Retail::V2::CompletionService::Rest::Client::Configuration::Rpcs} - # for a list of RPCs that can be configured independently. - # - # Configuration can be applied globally to all clients, or to a single client - # on construction. - # - # @example - # - # # Modify the global config, setting the timeout for - # # complete_query to 20 seconds, - # # and all remaining timeouts to 10 seconds. - # ::Google::Cloud::Retail::V2::CompletionService::Rest::Client.configure do |config| - # config.timeout = 10.0 - # config.rpcs.complete_query.timeout = 20.0 - # end - # - # # Apply the above configuration only to a new client. - # client = ::Google::Cloud::Retail::V2::CompletionService::Rest::Client.new do |config| - # config.timeout = 10.0 - # config.rpcs.complete_query.timeout = 20.0 - # end - # - # @!attribute [rw] endpoint - # A custom service endpoint, as a hostname or hostname:port. The default is - # nil, indicating to use the default endpoint in the current universe domain. - # @return [::String,nil] - # @!attribute [rw] credentials - # Credentials to send with calls. You may provide any of the following types: - # * (`String`) The path to a service account key file in JSON format - # * (`Hash`) A service account key as a Hash - # * (`Google::Auth::Credentials`) A googleauth credentials object - # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) - # * (`Signet::OAuth2::Client`) A signet oauth2 client object - # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) - # * (`nil`) indicating no credentials - # - # Warning: If you accept a credential configuration (JSON file or Hash) from an - # external source for authentication to Google Cloud, you must validate it before - # providing it to a Google API client library. Providing an unvalidated credential - # configuration to Google APIs can compromise the security of your systems and data. - # For more information, refer to [Validate credential configurations from external - # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). - # @return [::Object] - # @!attribute [rw] scope - # The OAuth scopes - # @return [::Array<::String>] - # @!attribute [rw] lib_name - # The library name as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] lib_version - # The library version as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] timeout - # The call timeout in seconds. - # @return [::Numeric] - # @!attribute [rw] metadata - # Additional headers to be sent with the call. - # @return [::Hash{::Symbol=>::String}] - # @!attribute [rw] retry_policy - # The retry policy. The value is a hash with the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # @return [::Hash] - # @!attribute [rw] quota_project - # A separate project against which to charge quota. - # @return [::String] - # @!attribute [rw] universe_domain - # The universe domain within which to make requests. This determines the - # default endpoint URL. The default value of nil uses the environment - # universe (usually the default "googleapis.com" universe). - # @return [::String,nil] - # @!attribute [rw] logger - # A custom logger to use for request/response debug logging, or the value - # `:default` (the default) to construct a default logger, or `nil` to - # explicitly disable logging. - # @return [::Logger,:default,nil] - # - class Configuration - extend ::Gapic::Config - - # @private - # The endpoint specific to the default "googleapis.com" universe. Deprecated. - DEFAULT_ENDPOINT = "retail.googleapis.com" - - config_attr :endpoint, nil, ::String, nil - config_attr :credentials, nil do |value| - allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] - allowed.any? { |klass| klass === value } - end - config_attr :scope, nil, ::String, ::Array, nil - config_attr :lib_name, nil, ::String, nil - config_attr :lib_version, nil, ::String, nil - config_attr :timeout, nil, ::Numeric, nil - config_attr :metadata, nil, ::Hash, nil - config_attr :retry_policy, nil, ::Hash, ::Proc, nil - config_attr :quota_project, nil, ::String, nil - config_attr :universe_domain, nil, ::String, nil - config_attr :logger, :default, ::Logger, nil, :default - - # @private - def initialize parent_config = nil - @parent_config = parent_config unless parent_config.nil? - - yield self if block_given? - end - - ## - # Configurations for individual RPCs - # @return [Rpcs] - # - def rpcs - @rpcs ||= begin - parent_rpcs = nil - parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) - Rpcs.new parent_rpcs - end - end - - ## - # Configuration RPC class for the CompletionService API. - # - # Includes fields providing the configuration for each RPC in this service. - # Each configuration object is of type `Gapic::Config::Method` and includes - # the following configuration fields: - # - # * `timeout` (*type:* `Numeric`) - The call timeout in seconds - # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers - # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields - # include the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # - class Rpcs - ## - # RPC-specific configuration for `complete_query` - # @return [::Gapic::Config::Method] - # - attr_reader :complete_query - ## - # RPC-specific configuration for `import_completion_data` - # @return [::Gapic::Config::Method] - # - attr_reader :import_completion_data - - # @private - def initialize parent_rpcs = nil - complete_query_config = parent_rpcs.complete_query if parent_rpcs.respond_to? :complete_query - @complete_query = ::Gapic::Config::Method.new complete_query_config - import_completion_data_config = parent_rpcs.import_completion_data if parent_rpcs.respond_to? :import_completion_data - @import_completion_data = ::Gapic::Config::Method.new import_completion_data_config - - yield self if block_given? - end - end - end - end - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/rest/operations.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/rest/operations.rb deleted file mode 100644 index ab0fc41898c9..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/rest/operations.rb +++ /dev/null @@ -1,962 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "gapic/operation" - -module Google - module Cloud - module Retail - module V2 - module CompletionService - module Rest - # Service that implements Longrunning Operations API. - class Operations - # @private - API_VERSION = "" - - # @private - DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" - - # @private - attr_reader :operations_stub - - ## - # Configuration for the CompletionService Operations API. - # - # @yield [config] Configure the Operations client. - # @yieldparam config [Operations::Configuration] - # - # @return [Operations::Configuration] - # - def self.configure - @configure ||= Operations::Configuration.new - yield @configure if block_given? - @configure - end - - ## - # Configure the CompletionService Operations instance. - # - # The configuration is set to the derived mode, meaning that values can be changed, - # but structural changes (adding new fields, etc.) are not allowed. Structural changes - # should be made on {Operations.configure}. - # - # @yield [config] Configure the Operations client. - # @yieldparam config [Operations::Configuration] - # - # @return [Operations::Configuration] - # - def configure - yield @config if block_given? - @config - end - - ## - # The effective universe domain - # - # @return [String] - # - def universe_domain - @operations_stub.universe_domain - end - - ## - # Create a new Operations client object. - # - # @yield [config] Configure the Client client. - # @yieldparam config [Operations::Configuration] - # - def initialize - # Create the configuration object - @config = Configuration.new Operations.configure - - # Yield the configuration if needed - yield @config if block_given? - - # Create credentials - credentials = @config.credentials - credentials ||= Credentials.default scope: @config.scope - if credentials.is_a?(::String) || credentials.is_a?(::Hash) - credentials = Credentials.new credentials, scope: @config.scope - end - - @quota_project_id = @config.quota_project - @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id - - @operations_stub = OperationsServiceStub.new( - endpoint: @config.endpoint, - endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, - universe_domain: @config.universe_domain, - credentials: credentials - ) - - # Used by an LRO wrapper for some methods of this service - @operations_client = self - end - - # Service calls - - ## - # Lists operations that match the specified filter in the request. If the - # server doesn't support this method, it returns `UNIMPLEMENTED`. - # - # @overload list_operations(request, options = nil) - # Pass arguments to `list_operations` via a request object, either of type - # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::ListOperationsRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload list_operations(name: nil, filter: nil, page_size: nil, page_token: nil, return_partial_success: nil) - # Pass arguments to `list_operations` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation's parent resource. - # @param filter [::String] - # The standard list filter. - # @param page_size [::Integer] - # The standard list page size. - # @param page_token [::String] - # The standard list page token. - # @param return_partial_success [::Boolean] - # When set to `true`, operations that are reachable are returned as normal, - # and those that are unreachable are returned in the - # [ListOperationsResponse.unreachable] field. - # - # This can only be `true` when reading across collections e.g. when `parent` - # is set to `"projects/example/locations/-"`. - # - # This field is not by default supported and will result in an - # `UNIMPLEMENTED` error if set unless explicitly documented otherwise in - # service or product specific documentation. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Gapic::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::ListOperationsRequest.new - # - # # Call the list_operations method. - # result = client.list_operations request - # - # # The returned object is of type Gapic::PagedEnumerable. You can iterate - # # over elements, and API calls will be issued to fetch pages as needed. - # result.each do |item| - # # Each element is of type ::Google::Longrunning::Operation. - # p item - # end - # - def list_operations request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::ListOperationsRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.list_operations.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.list_operations.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.list_operations.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.list_operations request, options do |result, operation| - result = ::Gapic::Rest::PagedEnumerable.new @operations_stub, :list_operations, "operations", request, result, options - yield result, operation if block_given? - throw :response, result - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Gets the latest state of a long-running operation. Clients can use this - # method to poll the operation result at intervals as recommended by the API - # service. - # - # @overload get_operation(request, options = nil) - # Pass arguments to `get_operation` via a request object, either of type - # {::Google::Longrunning::GetOperationRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::GetOperationRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload get_operation(name: nil) - # Pass arguments to `get_operation` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation resource. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Gapic::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::GetOperationRequest.new - # - # # Call the get_operation method. - # result = client.get_operation request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def get_operation request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::GetOperationRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.get_operation.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.get_operation.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.get_operation.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.get_operation request, options do |result, operation| - result = ::Gapic::Operation.new result, @operations_client, options: options - yield result, operation if block_given? - throw :response, result - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Deletes a long-running operation. This method indicates that the client is - # no longer interested in the operation result. It does not cancel the - # operation. If the server doesn't support this method, it returns - # `google.rpc.Code.UNIMPLEMENTED`. - # - # @overload delete_operation(request, options = nil) - # Pass arguments to `delete_operation` via a request object, either of type - # {::Google::Longrunning::DeleteOperationRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::DeleteOperationRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload delete_operation(name: nil) - # Pass arguments to `delete_operation` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation resource to be deleted. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Protobuf::Empty] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Protobuf::Empty] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::DeleteOperationRequest.new - # - # # Call the delete_operation method. - # result = client.delete_operation request - # - # # The returned object is of type Google::Protobuf::Empty. - # p result - # - def delete_operation request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::DeleteOperationRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.delete_operation.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.delete_operation.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.delete_operation.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.delete_operation request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Starts asynchronous cancellation on a long-running operation. The server - # makes a best effort to cancel the operation, but success is not - # guaranteed. If the server doesn't support this method, it returns - # `google.rpc.Code.UNIMPLEMENTED`. Clients can use - # Operations.GetOperation or - # other methods to check whether the cancellation succeeded or whether the - # operation completed despite cancellation. On successful cancellation, - # the operation is not deleted; instead, it becomes an operation with - # an {::Google::Longrunning::Operation#error Operation.error} value with a - # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to - # `Code.CANCELLED`. - # - # @overload cancel_operation(request, options = nil) - # Pass arguments to `cancel_operation` via a request object, either of type - # {::Google::Longrunning::CancelOperationRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::CancelOperationRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload cancel_operation(name: nil) - # Pass arguments to `cancel_operation` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation resource to be cancelled. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Protobuf::Empty] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Protobuf::Empty] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::CancelOperationRequest.new - # - # # Call the cancel_operation method. - # result = client.cancel_operation request - # - # # The returned object is of type Google::Protobuf::Empty. - # p result - # - def cancel_operation request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::CancelOperationRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.cancel_operation.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.cancel_operation.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.cancel_operation.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.cancel_operation request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Configuration class for the Operations REST API. - # - # This class represents the configuration for Operations REST, - # providing control over timeouts, retry behavior, logging, transport - # parameters, and other low-level controls. Certain parameters can also be - # applied individually to specific RPCs. See - # {::Google::Longrunning::Operations::Rest::Client::Configuration::Rpcs} - # for a list of RPCs that can be configured independently. - # - # Configuration can be applied globally to all clients, or to a single client - # on construction. - # - # @example - # - # # Modify the global config, setting the timeout for - # # list_operations to 20 seconds, - # # and all remaining timeouts to 10 seconds. - # ::Google::Longrunning::Operations::Rest::Client.configure do |config| - # config.timeout = 10.0 - # config.rpcs.list_operations.timeout = 20.0 - # end - # - # # Apply the above configuration only to a new client. - # client = ::Google::Longrunning::Operations::Rest::Client.new do |config| - # config.timeout = 10.0 - # config.rpcs.list_operations.timeout = 20.0 - # end - # - # @!attribute [rw] endpoint - # A custom service endpoint, as a hostname or hostname:port. The default is - # nil, indicating to use the default endpoint in the current universe domain. - # @return [::String,nil] - # @!attribute [rw] credentials - # Credentials to send with calls. You may provide any of the following types: - # * (`String`) The path to a service account key file in JSON format - # * (`Hash`) A service account key as a Hash - # * (`Google::Auth::Credentials`) A googleauth credentials object - # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) - # * (`Signet::OAuth2::Client`) A signet oauth2 client object - # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) - # * (`nil`) indicating no credentials - # - # Warning: If you accept a credential configuration (JSON file or Hash) from an - # external source for authentication to Google Cloud, you must validate it before - # providing it to a Google API client library. Providing an unvalidated credential - # configuration to Google APIs can compromise the security of your systems and data. - # For more information, refer to [Validate credential configurations from external - # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). - # @return [::Object] - # @!attribute [rw] scope - # The OAuth scopes - # @return [::Array<::String>] - # @!attribute [rw] lib_name - # The library name as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] lib_version - # The library version as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] timeout - # The call timeout in seconds. - # @return [::Numeric] - # @!attribute [rw] metadata - # Additional headers to be sent with the call. - # @return [::Hash{::Symbol=>::String}] - # @!attribute [rw] retry_policy - # The retry policy. The value is a hash with the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # @return [::Hash] - # @!attribute [rw] quota_project - # A separate project against which to charge quota. - # @return [::String] - # @!attribute [rw] universe_domain - # The universe domain within which to make requests. This determines the - # default endpoint URL. The default value of nil uses the environment - # universe (usually the default "googleapis.com" universe). - # @return [::String,nil] - # @!attribute [rw] logger - # A custom logger to use for request/response debug logging, or the value - # `:default` (the default) to construct a default logger, or `nil` to - # explicitly disable logging. - # @return [::Logger,:default,nil] - # - class Configuration - extend ::Gapic::Config - - # @private - # The endpoint specific to the default "googleapis.com" universe. Deprecated. - DEFAULT_ENDPOINT = "retail.googleapis.com" - - config_attr :endpoint, nil, ::String, nil - config_attr :credentials, nil do |value| - allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] - allowed.any? { |klass| klass === value } - end - config_attr :scope, nil, ::String, ::Array, nil - config_attr :lib_name, nil, ::String, nil - config_attr :lib_version, nil, ::String, nil - config_attr :timeout, nil, ::Numeric, nil - config_attr :metadata, nil, ::Hash, nil - config_attr :retry_policy, nil, ::Hash, ::Proc, nil - config_attr :quota_project, nil, ::String, nil - config_attr :universe_domain, nil, ::String, nil - config_attr :logger, :default, ::Logger, nil, :default - - # @private - def initialize parent_config = nil - @parent_config = parent_config unless parent_config.nil? - - yield self if block_given? - end - - ## - # Configurations for individual RPCs - # @return [Rpcs] - # - def rpcs - @rpcs ||= begin - parent_rpcs = nil - parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) - Rpcs.new parent_rpcs - end - end - - ## - # Configuration RPC class for the Operations API. - # - # Includes fields providing the configuration for each RPC in this service. - # Each configuration object is of type `Gapic::Config::Method` and includes - # the following configuration fields: - # - # * `timeout` (*type:* `Numeric`) - The call timeout in seconds - # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers - # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields - # include the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # - class Rpcs - ## - # RPC-specific configuration for `list_operations` - # @return [::Gapic::Config::Method] - # - attr_reader :list_operations - ## - # RPC-specific configuration for `get_operation` - # @return [::Gapic::Config::Method] - # - attr_reader :get_operation - ## - # RPC-specific configuration for `delete_operation` - # @return [::Gapic::Config::Method] - # - attr_reader :delete_operation - ## - # RPC-specific configuration for `cancel_operation` - # @return [::Gapic::Config::Method] - # - attr_reader :cancel_operation - - # @private - def initialize parent_rpcs = nil - list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations - @list_operations = ::Gapic::Config::Method.new list_operations_config - get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation - @get_operation = ::Gapic::Config::Method.new get_operation_config - delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation - @delete_operation = ::Gapic::Config::Method.new delete_operation_config - cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation - @cancel_operation = ::Gapic::Config::Method.new cancel_operation_config - - yield self if block_given? - end - end - end - end - - ## - # @private - # REST service stub for the Longrunning Operations API. - # Service stub contains baseline method implementations - # including transcoding, making the REST call, and deserialing the response. - class OperationsServiceStub - def initialize endpoint:, endpoint_template:, universe_domain:, credentials: - # These require statements are intentionally placed here to initialize - # the REST modules only when it's required. - require "gapic/rest" - - @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, - endpoint_template: endpoint_template, - universe_domain: universe_domain, - credentials: credentials - end - - ## - # Baseline implementation for the list_operations REST call - # - # @param request_pb [::Google::Longrunning::ListOperationsRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Longrunning::ListOperationsResponse] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Longrunning::ListOperationsResponse] - # A result object deserialized from the server's reply - def list_operations request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = OperationsServiceStub.transcode_list_operations_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "list_operations", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Longrunning::ListOperationsResponse.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the get_operation REST call - # - # @param request_pb [::Google::Longrunning::GetOperationRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Longrunning::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Longrunning::Operation] - # A result object deserialized from the server's reply - def get_operation request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = OperationsServiceStub.transcode_get_operation_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "get_operation", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the delete_operation REST call - # - # @param request_pb [::Google::Longrunning::DeleteOperationRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Protobuf::Empty] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Protobuf::Empty] - # A result object deserialized from the server's reply - def delete_operation request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = OperationsServiceStub.transcode_delete_operation_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "delete_operation", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the cancel_operation REST call - # - # @param request_pb [::Google::Longrunning::CancelOperationRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Protobuf::Empty] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Protobuf::Empty] - # A result object deserialized from the server's reply - def cancel_operation request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = OperationsServiceStub.transcode_cancel_operation_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "cancel_operation", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # @private - # - # GRPC transcoding helper method for the list_operations REST call - # - # @param request_pb [::Google::Longrunning::ListOperationsRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_list_operations_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :get, - uri_template: "/v2/{name}/operations", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/?$}, false] - ] - ) - .with_bindings( - uri_method: :get, - uri_template: "/v2/{name}/operations", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] - ] - ) - .with_bindings( - uri_method: :get, - uri_template: "/v2/{name}/operations", - matches: [ - ["name", %r{^projects/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the get_operation REST call - # - # @param request_pb [::Google::Longrunning::GetOperationRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_get_operation_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :get, - uri_template: "/v2/{name}", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/operations/[^/]+/?$}, false] - ] - ) - .with_bindings( - uri_method: :get, - uri_template: "/v2/{name}", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/branches/[^/]+/operations/[^/]+/?$}, false] - ] - ) - .with_bindings( - uri_method: :get, - uri_template: "/v2/{name}", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/operations/[^/]+/?$}, false] - ] - ) - .with_bindings( - uri_method: :get, - uri_template: "/v2/{name}", - matches: [ - ["name", %r{^projects/[^/]+/operations/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the delete_operation REST call - # - # @param request_pb [::Google::Longrunning::DeleteOperationRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_delete_operation_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :delete, - uri_template: "/v1/{name}", - matches: [ - ["name", %r{^operations(?:/(?<__wildcard__>.*))?$}, true] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the cancel_operation REST call - # - # @param request_pb [::Google::Longrunning::CancelOperationRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_cancel_operation_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :post, - uri_template: "/v1/{name}:cancel", - body: "*", - matches: [ - ["name", %r{^operations(?:/(?<__wildcard__>.*))?$}, true] - ] - ) - transcoder.transcode request_pb - end - end - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/rest/service_stub.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/rest/service_stub.rb deleted file mode 100644 index 31957d90f097..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service/rest/service_stub.rb +++ /dev/null @@ -1,204 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "google/cloud/retail/v2/completion_service_pb" - -module Google - module Cloud - module Retail - module V2 - module CompletionService - module Rest - ## - # REST service stub for the CompletionService service. - # Service stub contains baseline method implementations - # including transcoding, making the REST call, and deserialing the response. - # - class ServiceStub - # @private - def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger: - # These require statements are intentionally placed here to initialize - # the REST modules only when it's required. - require "gapic/rest" - - @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, - endpoint_template: endpoint_template, - universe_domain: universe_domain, - credentials: credentials, - numeric_enums: true, - service_name: self.class, - raise_faraday_errors: false, - logger: logger - end - - ## - # The effective universe domain - # - # @return [String] - # - def universe_domain - @client_stub.universe_domain - end - - ## - # The effective endpoint - # - # @return [String] - # - def endpoint - @client_stub.endpoint - end - - ## - # The logger used for request/response debug logging. - # - # @return [Logger] - # - def logger stub: false - stub ? @client_stub.stub_logger : @client_stub.logger - end - - ## - # Baseline implementation for the complete_query REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::CompleteQueryRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::CompleteQueryResponse] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::CompleteQueryResponse] - # A result object deserialized from the server's reply - def complete_query request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_complete_query_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "complete_query", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Retail::V2::CompleteQueryResponse.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the import_completion_data REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::ImportCompletionDataRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Longrunning::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Longrunning::Operation] - # A result object deserialized from the server's reply - def import_completion_data request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_import_completion_data_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "import_completion_data", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # @private - # - # GRPC transcoding helper method for the complete_query REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::CompleteQueryRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_complete_query_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :get, - uri_template: "/v2/{catalog}:completeQuery", - matches: [ - ["catalog", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the import_completion_data REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::ImportCompletionDataRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_import_completion_data_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :post, - uri_template: "/v2/{parent}/completionData:import", - body: "*", - matches: [ - ["parent", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - end - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service_pb.rb deleted file mode 100644 index 6f2a2a1fdade..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service_pb.rb +++ /dev/null @@ -1,33 +0,0 @@ -# frozen_string_literal: true -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/retail/v2/completion_service.proto - -require 'google/protobuf' - -require 'google/api/annotations_pb' -require 'google/api/client_pb' -require 'google/api/field_behavior_pb' -require 'google/api/resource_pb' -require 'google/cloud/retail/v2/common_pb' -require 'google/cloud/retail/v2/import_config_pb' -require 'google/longrunning/operations_pb' - - -descriptor_data = "\n/google/cloud/retail/v2/completion_service.proto\x12\x16google.cloud.retail.v2\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a#google/cloud/retail/v2/common.proto\x1a*google/cloud/retail/v2/import_config.proto\x1a#google/longrunning/operations.proto\"\x83\x02\n\x14\x43ompleteQueryRequest\x12\x36\n\x07\x63\x61talog\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\n\x1dretail.googleapis.com/Catalog\x12\x12\n\x05query\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\x12\n\nvisitor_id\x18\x07 \x01(\t\x12\x16\n\x0elanguage_codes\x18\x03 \x03(\t\x12\x13\n\x0b\x64\x65vice_type\x18\x04 \x01(\t\x12\x0f\n\x07\x64\x61taset\x18\x06 \x01(\t\x12\x17\n\x0fmax_suggestions\x18\x05 \x01(\x05\x12$\n\x1c\x65nable_attribute_suggestions\x18\t \x01(\x08\x12\x0e\n\x06\x65ntity\x18\n \x01(\t\"\x8d\x06\n\x15\x43ompleteQueryResponse\x12Z\n\x12\x63ompletion_results\x18\x01 \x03(\x0b\x32>.google.cloud.retail.v2.CompleteQueryResponse.CompletionResult\x12\x19\n\x11\x61ttribution_token\x18\x02 \x01(\t\x12\x63\n\x15recent_search_results\x18\x03 \x03(\x0b\x32@.google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResultB\x02\x18\x01\x12^\n\x11\x61ttribute_results\x18\x04 \x03(\x0b\x32\x43.google.cloud.retail.v2.CompleteQueryResponse.AttributeResultsEntry\x1a\xe6\x01\n\x10\x43ompletionResult\x12\x12\n\nsuggestion\x18\x01 \x01(\t\x12\x62\n\nattributes\x18\x02 \x03(\x0b\x32N.google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.AttributesEntry\x1aZ\n\x0f\x41ttributesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x36\n\x05value\x18\x02 \x01(\x0b\x32\'.google.cloud.retail.v2.CustomAttribute:\x02\x38\x01\x1a/\n\x12RecentSearchResult\x12\x15\n\rrecent_search\x18\x01 \x01(\t:\x02\x18\x01\x1a&\n\x0f\x41ttributeResult\x12\x13\n\x0bsuggestions\x18\x01 \x03(\t\x1av\n\x15\x41ttributeResultsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12L\n\x05value\x18\x02 \x01(\x0b\x32=.google.cloud.retail.v2.CompleteQueryResponse.AttributeResult:\x02\x38\x01\x32\xb2\x04\n\x11\x43ompletionService\x12\xb3\x01\n\rCompleteQuery\x12,.google.cloud.retail.v2.CompleteQueryRequest\x1a-.google.cloud.retail.v2.CompleteQueryResponse\"E\x82\xd3\xe4\x93\x02?\x12=/v2/{catalog=projects/*/locations/*/catalogs/*}:completeQuery\x12\x9b\x02\n\x14ImportCompletionData\x12\x33.google.cloud.retail.v2.ImportCompletionDataRequest\x1a\x1d.google.longrunning.Operation\"\xae\x01\xca\x41\\\n3google.cloud.retail.v2.ImportCompletionDataResponse\x12%google.cloud.retail.v2.ImportMetadata\x82\xd3\xe4\x93\x02I\"D/v2/{parent=projects/*/locations/*/catalogs/*}/completionData:import:\x01*\x1aI\xca\x41\x15retail.googleapis.com\xd2\x41.https://www.googleapis.com/auth/cloud-platformB\xc1\x01\n\x1a\x63om.google.cloud.retail.v2B\x16\x43ompletionServiceProtoP\x01Z2cloud.google.com/go/retail/apiv2/retailpb;retailpb\xa2\x02\x06RETAIL\xaa\x02\x16Google.Cloud.Retail.V2\xca\x02\x16Google\\Cloud\\Retail\\V2\xea\x02\x19Google::Cloud::Retail::V2b\x06proto3" - -pool = ::Google::Protobuf::DescriptorPool.generated_pool -pool.add_serialized_file(descriptor_data) - -module Google - module Cloud - module Retail - module V2 - CompleteQueryRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CompleteQueryRequest").msgclass - CompleteQueryResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CompleteQueryResponse").msgclass - CompleteQueryResponse::CompletionResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CompleteQueryResponse.CompletionResult").msgclass - CompleteQueryResponse::RecentSearchResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult").msgclass - CompleteQueryResponse::AttributeResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CompleteQueryResponse.AttributeResult").msgclass - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service_services_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service_services_pb.rb deleted file mode 100644 index 64e7fdaa4af5..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/completion_service_services_pb.rb +++ /dev/null @@ -1,61 +0,0 @@ -# Generated by the protocol buffer compiler. DO NOT EDIT! -# Source: google/cloud/retail/v2/completion_service.proto for package 'Google.Cloud.Retail.V2' -# Original file comments: -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -require 'grpc' -require 'google/cloud/retail/v2/completion_service_pb' - -module Google - module Cloud - module Retail - module V2 - module CompletionService - # Autocomplete service for retail. - # - # This feature is only available for users who have Retail Search enabled. - # Enable Retail Search on Cloud Console before using this feature. - class Service - - include ::GRPC::GenericService - - self.marshal_class_method = :encode - self.unmarshal_class_method = :decode - self.service_name = 'google.cloud.retail.v2.CompletionService' - - # Completes the specified prefix with keyword suggestions. - # - # This feature is only available for users who have Retail Search enabled. - # Enable Retail Search on Cloud Console before using this feature. - rpc :CompleteQuery, ::Google::Cloud::Retail::V2::CompleteQueryRequest, ::Google::Cloud::Retail::V2::CompleteQueryResponse - # Bulk import of processed completion dataset. - # - # Request processing is asynchronous. Partial updating is not supported. - # - # The operation is successfully finished only after the imported suggestions - # are indexed successfully and ready for serving. The process takes hours. - # - # This feature is only available for users who have Retail Search enabled. - # Enable Retail Search on Cloud Console before using this feature. - rpc :ImportCompletionData, ::Google::Cloud::Retail::V2::ImportCompletionDataRequest, ::Google::Longrunning::Operation - end - - Stub = Service.rpc_stub_class - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_pb.rb deleted file mode 100644 index 6b4f341f7d2a..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_pb.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/retail/v2/control.proto - -require 'google/protobuf' - -require 'google/api/field_behavior_pb' -require 'google/api/resource_pb' -require 'google/cloud/retail/v2/common_pb' - - -descriptor_data = "\n$google/cloud/retail/v2/control.proto\x12\x16google.cloud.retail.v2\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a#google/cloud/retail/v2/common.proto\"\xa6\x03\n\x07\x43ontrol\x12,\n\x04rule\x18\x04 \x01(\x0b\x32\x1c.google.cloud.retail.v2.RuleH\x00\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x05\x12\x19\n\x0c\x64isplay_name\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12*\n\x1d\x61ssociated_serving_config_ids\x18\x05 \x03(\tB\x03\xe0\x41\x03\x12\x44\n\x0esolution_types\x18\x06 \x03(\x0e\x32$.google.cloud.retail.v2.SolutionTypeB\x06\xe0\x41\x02\xe0\x41\x05\x12O\n\x18search_solution_use_case\x18\x07 \x03(\x0e\x32-.google.cloud.retail.v2.SearchSolutionUseCase:q\xea\x41n\n\x1dretail.googleapis.com/Control\x12Mprojects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}B\t\n\x07\x63ontrolB\xb7\x01\n\x1a\x63om.google.cloud.retail.v2B\x0c\x43ontrolProtoP\x01Z2cloud.google.com/go/retail/apiv2/retailpb;retailpb\xa2\x02\x06RETAIL\xaa\x02\x16Google.Cloud.Retail.V2\xca\x02\x16Google\\Cloud\\Retail\\V2\xea\x02\x19Google::Cloud::Retail::V2b\x06proto3" - -pool = ::Google::Protobuf::DescriptorPool.generated_pool -pool.add_serialized_file(descriptor_data) - -module Google - module Cloud - module Retail - module V2 - Control = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Control").msgclass - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service.rb deleted file mode 100644 index e93086f0a231..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service.rb +++ /dev/null @@ -1,55 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "gapic/common" -require "gapic/config" -require "gapic/config/method" - -require "google/cloud/retail/v2/version" - -require "google/cloud/retail/v2/control_service/credentials" -require "google/cloud/retail/v2/control_service/paths" -require "google/cloud/retail/v2/control_service/client" -require "google/cloud/retail/v2/control_service/rest" - -module Google - module Cloud - module Retail - module V2 - ## - # Service for modifying Control. - # - # @example Load this service and instantiate a gRPC client - # - # require "google/cloud/retail/v2/control_service" - # client = ::Google::Cloud::Retail::V2::ControlService::Client.new - # - # @example Load this service and instantiate a REST client - # - # require "google/cloud/retail/v2/control_service/rest" - # client = ::Google::Cloud::Retail::V2::ControlService::Rest::Client.new - # - module ControlService - end - end - end - end -end - -helper_path = ::File.join __dir__, "control_service", "helpers.rb" -require "google/cloud/retail/v2/control_service/helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/client.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/client.rb deleted file mode 100644 index 58f5be8a828e..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/client.rb +++ /dev/null @@ -1,911 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "google/cloud/errors" -require "google/cloud/retail/v2/control_service_pb" -require "google/cloud/location" - -module Google - module Cloud - module Retail - module V2 - module ControlService - ## - # Client for the ControlService service. - # - # Service for modifying Control. - # - class Client - # @private - API_VERSION = "" - - # @private - DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" - - include Paths - - # @private - attr_reader :control_service_stub - - ## - # Configure the ControlService Client class. - # - # See {::Google::Cloud::Retail::V2::ControlService::Client::Configuration} - # for a description of the configuration fields. - # - # @example - # - # # Modify the configuration for all ControlService clients - # ::Google::Cloud::Retail::V2::ControlService::Client.configure do |config| - # config.timeout = 10.0 - # end - # - # @yield [config] Configure the Client client. - # @yieldparam config [Client::Configuration] - # - # @return [Client::Configuration] - # - def self.configure - @configure ||= begin - namespace = ["Google", "Cloud", "Retail", "V2"] - parent_config = while namespace.any? - parent_name = namespace.join "::" - parent_const = const_get parent_name - break parent_const.configure if parent_const.respond_to? :configure - namespace.pop - end - default_config = Client::Configuration.new parent_config - - default_config - end - yield @configure if block_given? - @configure - end - - ## - # Configure the ControlService Client instance. - # - # The configuration is set to the derived mode, meaning that values can be changed, - # but structural changes (adding new fields, etc.) are not allowed. Structural changes - # should be made on {Client.configure}. - # - # See {::Google::Cloud::Retail::V2::ControlService::Client::Configuration} - # for a description of the configuration fields. - # - # @yield [config] Configure the Client client. - # @yieldparam config [Client::Configuration] - # - # @return [Client::Configuration] - # - def configure - yield @config if block_given? - @config - end - - ## - # The effective universe domain - # - # @return [String] - # - def universe_domain - @control_service_stub.universe_domain - end - - ## - # Create a new ControlService client object. - # - # @example - # - # # Create a client using the default configuration - # client = ::Google::Cloud::Retail::V2::ControlService::Client.new - # - # # Create a client using a custom configuration - # client = ::Google::Cloud::Retail::V2::ControlService::Client.new do |config| - # config.timeout = 10.0 - # end - # - # @yield [config] Configure the ControlService client. - # @yieldparam config [Client::Configuration] - # - def initialize - # These require statements are intentionally placed here to initialize - # the gRPC module only when it's required. - # See https://github.com/googleapis/toolkit/issues/446 - require "gapic/grpc" - require "google/cloud/retail/v2/control_service_services_pb" - - # Create the configuration object - @config = Configuration.new Client.configure - - # Yield the configuration if needed - yield @config if block_given? - - # Create credentials - credentials = @config.credentials - # Use self-signed JWT if the endpoint is unchanged from default, - # but only if the default endpoint does not have a region prefix. - enable_self_signed_jwt = @config.endpoint.nil? || - (@config.endpoint == Configuration::DEFAULT_ENDPOINT && - !@config.endpoint.split(".").first.include?("-")) - credentials ||= Credentials.default scope: @config.scope, - enable_self_signed_jwt: enable_self_signed_jwt - if credentials.is_a?(::String) || credentials.is_a?(::Hash) - credentials = Credentials.new credentials, scope: @config.scope - end - @quota_project_id = @config.quota_project - @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id - - @control_service_stub = ::Gapic::ServiceStub.new( - ::Google::Cloud::Retail::V2::ControlService::Stub, - credentials: credentials, - endpoint: @config.endpoint, - endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, - universe_domain: @config.universe_domain, - channel_args: @config.channel_args, - interceptors: @config.interceptors, - channel_pool_config: @config.channel_pool, - logger: @config.logger - ) - - @control_service_stub.stub_logger&.info do |entry| - entry.set_system_name - entry.set_service - entry.message = "Created client for #{entry.service}" - entry.set_credentials_fields credentials - entry.set "customEndpoint", @config.endpoint if @config.endpoint - entry.set "defaultTimeout", @config.timeout if @config.timeout - entry.set "quotaProject", @quota_project_id if @quota_project_id - end - - @location_client = Google::Cloud::Location::Locations::Client.new do |config| - config.credentials = credentials - config.quota_project = @quota_project_id - config.endpoint = @control_service_stub.endpoint - config.universe_domain = @control_service_stub.universe_domain - config.logger = @control_service_stub.logger if config.respond_to? :logger= - end - end - - ## - # Get the associated client for mix-in of the Locations. - # - # @return [Google::Cloud::Location::Locations::Client] - # - attr_reader :location_client - - ## - # The logger used for request/response debug logging. - # - # @return [Logger] - # - def logger - @control_service_stub.logger - end - - # Service calls - - ## - # Creates a Control. - # - # If the {::Google::Cloud::Retail::V2::Control Control} to create already exists, - # an ALREADY_EXISTS error is returned. - # - # @overload create_control(request, options = nil) - # Pass arguments to `create_control` via a request object, either of type - # {::Google::Cloud::Retail::V2::CreateControlRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::CreateControlRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload create_control(parent: nil, control: nil, control_id: nil) - # Pass arguments to `create_control` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. Full resource name of parent catalog. Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - # @param control [::Google::Cloud::Retail::V2::Control, ::Hash] - # Required. The Control to create. - # @param control_id [::String] - # Required. The ID to use for the Control, which will become the final - # component of the Control's resource name. - # - # This value should be 4-63 characters, and valid characters - # are /[a-z][0-9]-_/. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Cloud::Retail::V2::Control] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Cloud::Retail::V2::Control] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ControlService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::CreateControlRequest.new - # - # # Call the create_control method. - # result = client.create_control request - # - # # The returned object is of type Google::Cloud::Retail::V2::Control. - # p result - # - def create_control request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::CreateControlRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.create_control.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.parent - header_params["parent"] = request.parent - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.create_control.timeout, - metadata: metadata, - retry_policy: @config.rpcs.create_control.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @control_service_stub.call_rpc :create_control, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Deletes a Control. - # - # If the {::Google::Cloud::Retail::V2::Control Control} to delete does not exist, - # a NOT_FOUND error is returned. - # - # @overload delete_control(request, options = nil) - # Pass arguments to `delete_control` via a request object, either of type - # {::Google::Cloud::Retail::V2::DeleteControlRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::DeleteControlRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload delete_control(name: nil) - # Pass arguments to `delete_control` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # Required. The resource name of the Control to delete. Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}` - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Protobuf::Empty] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Protobuf::Empty] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ControlService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::DeleteControlRequest.new - # - # # Call the delete_control method. - # result = client.delete_control request - # - # # The returned object is of type Google::Protobuf::Empty. - # p result - # - def delete_control request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::DeleteControlRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.delete_control.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.name - header_params["name"] = request.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.delete_control.timeout, - metadata: metadata, - retry_policy: @config.rpcs.delete_control.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @control_service_stub.call_rpc :delete_control, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Updates a Control. - # - # {::Google::Cloud::Retail::V2::Control Control} cannot be set to a different - # oneof field, if so an INVALID_ARGUMENT is returned. If the - # {::Google::Cloud::Retail::V2::Control Control} to update does not exist, a - # NOT_FOUND error is returned. - # - # @overload update_control(request, options = nil) - # Pass arguments to `update_control` via a request object, either of type - # {::Google::Cloud::Retail::V2::UpdateControlRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::UpdateControlRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload update_control(control: nil, update_mask: nil) - # Pass arguments to `update_control` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param control [::Google::Cloud::Retail::V2::Control, ::Hash] - # Required. The Control to update. - # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] - # Indicates which fields in the provided - # {::Google::Cloud::Retail::V2::Control Control} to update. The following are NOT - # supported: - # - # * {::Google::Cloud::Retail::V2::Control#name Control.name} - # - # If not set or empty, all supported fields are updated. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Cloud::Retail::V2::Control] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Cloud::Retail::V2::Control] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ControlService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::UpdateControlRequest.new - # - # # Call the update_control method. - # result = client.update_control request - # - # # The returned object is of type Google::Cloud::Retail::V2::Control. - # p result - # - def update_control request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::UpdateControlRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.update_control.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.control&.name - header_params["control.name"] = request.control.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.update_control.timeout, - metadata: metadata, - retry_policy: @config.rpcs.update_control.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @control_service_stub.call_rpc :update_control, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Gets a Control. - # - # @overload get_control(request, options = nil) - # Pass arguments to `get_control` via a request object, either of type - # {::Google::Cloud::Retail::V2::GetControlRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::GetControlRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload get_control(name: nil) - # Pass arguments to `get_control` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # Required. The resource name of the Control to get. Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}` - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Cloud::Retail::V2::Control] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Cloud::Retail::V2::Control] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ControlService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::GetControlRequest.new - # - # # Call the get_control method. - # result = client.get_control request - # - # # The returned object is of type Google::Cloud::Retail::V2::Control. - # p result - # - def get_control request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::GetControlRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.get_control.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.name - header_params["name"] = request.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.get_control.timeout, - metadata: metadata, - retry_policy: @config.rpcs.get_control.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @control_service_stub.call_rpc :get_control, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Lists all Controls by their parent - # {::Google::Cloud::Retail::V2::Catalog Catalog}. - # - # @overload list_controls(request, options = nil) - # Pass arguments to `list_controls` via a request object, either of type - # {::Google::Cloud::Retail::V2::ListControlsRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::ListControlsRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload list_controls(parent: nil, page_size: nil, page_token: nil, filter: nil) - # Pass arguments to `list_controls` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. The catalog resource name. Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - # @param page_size [::Integer] - # Optional. Maximum number of results to return. If unspecified, defaults - # to 50. Max allowed value is 1000. - # @param page_token [::String] - # Optional. A page token, received from a previous `ListControls` call. - # Provide this to retrieve the subsequent page. - # @param filter [::String] - # Optional. A filter to apply on the list results. Supported features: - # - # * List all the products under the parent branch if - # {::Google::Cloud::Retail::V2::ListControlsRequest#filter filter} is unset. - # * List controls that are used in a single ServingConfig: - # 'serving_config = "boosted_home_page_cvr"' - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Retail::V2::Control>] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::PagedEnumerable<::Google::Cloud::Retail::V2::Control>] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ControlService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::ListControlsRequest.new - # - # # Call the list_controls method. - # result = client.list_controls request - # - # # The returned object is of type Gapic::PagedEnumerable. You can iterate - # # over elements, and API calls will be issued to fetch pages as needed. - # result.each do |item| - # # Each element is of type ::Google::Cloud::Retail::V2::Control. - # p item - # end - # - def list_controls request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ListControlsRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.list_controls.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.parent - header_params["parent"] = request.parent - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.list_controls.timeout, - metadata: metadata, - retry_policy: @config.rpcs.list_controls.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @control_service_stub.call_rpc :list_controls, request, options: options do |response, operation| - response = ::Gapic::PagedEnumerable.new @control_service_stub, :list_controls, request, response, operation, options - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Configuration class for the ControlService API. - # - # This class represents the configuration for ControlService, - # providing control over timeouts, retry behavior, logging, transport - # parameters, and other low-level controls. Certain parameters can also be - # applied individually to specific RPCs. See - # {::Google::Cloud::Retail::V2::ControlService::Client::Configuration::Rpcs} - # for a list of RPCs that can be configured independently. - # - # Configuration can be applied globally to all clients, or to a single client - # on construction. - # - # @example - # - # # Modify the global config, setting the timeout for - # # create_control to 20 seconds, - # # and all remaining timeouts to 10 seconds. - # ::Google::Cloud::Retail::V2::ControlService::Client.configure do |config| - # config.timeout = 10.0 - # config.rpcs.create_control.timeout = 20.0 - # end - # - # # Apply the above configuration only to a new client. - # client = ::Google::Cloud::Retail::V2::ControlService::Client.new do |config| - # config.timeout = 10.0 - # config.rpcs.create_control.timeout = 20.0 - # end - # - # @!attribute [rw] endpoint - # A custom service endpoint, as a hostname or hostname:port. The default is - # nil, indicating to use the default endpoint in the current universe domain. - # @return [::String,nil] - # @!attribute [rw] credentials - # Credentials to send with calls. You may provide any of the following types: - # * (`Google::Auth::Credentials`) A googleauth credentials object - # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) - # * (`Signet::OAuth2::Client`) A signet oauth2 client object - # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) - # * (`GRPC::Core::Channel`) a gRPC channel with included credentials - # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object - # * (`nil`) indicating no credentials - # - # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials - # is deprecated. Providing an unvalidated credential configuration to - # Google APIs can compromise the security of your systems and data. - # - # @example - # - # # The recommended way to provide credentials is to use the `make_creds` method - # # on the appropriate credentials class for your environment. - # - # require "googleauth" - # - # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds( - # json_key_io: ::File.open("/path/to/keyfile.json") - # ) - # - # client = ::Google::Cloud::Retail::V2::ControlService::Client.new do |config| - # config.credentials = credentials - # end - # - # @note Warning: If you accept a credential configuration (JSON file or Hash) from an - # external source for authentication to Google Cloud, you must validate it before - # providing it to a Google API client library. Providing an unvalidated credential - # configuration to Google APIs can compromise the security of your systems and data. - # For more information, refer to [Validate credential configurations from external - # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). - # @return [::Object] - # @!attribute [rw] scope - # The OAuth scopes - # @return [::Array<::String>] - # @!attribute [rw] lib_name - # The library name as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] lib_version - # The library version as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] channel_args - # Extra parameters passed to the gRPC channel. Note: this is ignored if a - # `GRPC::Core::Channel` object is provided as the credential. - # @return [::Hash] - # @!attribute [rw] interceptors - # An array of interceptors that are run before calls are executed. - # @return [::Array<::GRPC::ClientInterceptor>] - # @!attribute [rw] timeout - # The call timeout in seconds. - # @return [::Numeric] - # @!attribute [rw] metadata - # Additional gRPC headers to be sent with the call. - # @return [::Hash{::Symbol=>::String}] - # @!attribute [rw] retry_policy - # The retry policy. The value is a hash with the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # @return [::Hash] - # @!attribute [rw] quota_project - # A separate project against which to charge quota. - # @return [::String] - # @!attribute [rw] universe_domain - # The universe domain within which to make requests. This determines the - # default endpoint URL. The default value of nil uses the environment - # universe (usually the default "googleapis.com" universe). - # @return [::String,nil] - # @!attribute [rw] logger - # A custom logger to use for request/response debug logging, or the value - # `:default` (the default) to construct a default logger, or `nil` to - # explicitly disable logging. - # @return [::Logger,:default,nil] - # - class Configuration - extend ::Gapic::Config - - # @private - # The endpoint specific to the default "googleapis.com" universe. Deprecated. - DEFAULT_ENDPOINT = "retail.googleapis.com" - - config_attr :endpoint, nil, ::String, nil - config_attr :credentials, nil do |value| - allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] - allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel - allowed.any? { |klass| klass === value } - end - config_attr :scope, nil, ::String, ::Array, nil - config_attr :lib_name, nil, ::String, nil - config_attr :lib_version, nil, ::String, nil - config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) - config_attr :interceptors, nil, ::Array, nil - config_attr :timeout, nil, ::Numeric, nil - config_attr :metadata, nil, ::Hash, nil - config_attr :retry_policy, nil, ::Hash, ::Proc, nil - config_attr :quota_project, nil, ::String, nil - config_attr :universe_domain, nil, ::String, nil - config_attr :logger, :default, ::Logger, nil, :default - - # @private - def initialize parent_config = nil - @parent_config = parent_config unless parent_config.nil? - - yield self if block_given? - end - - ## - # Configurations for individual RPCs - # @return [Rpcs] - # - def rpcs - @rpcs ||= begin - parent_rpcs = nil - parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) - Rpcs.new parent_rpcs - end - end - - ## - # Configuration for the channel pool - # @return [::Gapic::ServiceStub::ChannelPool::Configuration] - # - def channel_pool - @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new - end - - ## - # Configuration RPC class for the ControlService API. - # - # Includes fields providing the configuration for each RPC in this service. - # Each configuration object is of type `Gapic::Config::Method` and includes - # the following configuration fields: - # - # * `timeout` (*type:* `Numeric`) - The call timeout in seconds - # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers - # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields - # include the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # - class Rpcs - ## - # RPC-specific configuration for `create_control` - # @return [::Gapic::Config::Method] - # - attr_reader :create_control - ## - # RPC-specific configuration for `delete_control` - # @return [::Gapic::Config::Method] - # - attr_reader :delete_control - ## - # RPC-specific configuration for `update_control` - # @return [::Gapic::Config::Method] - # - attr_reader :update_control - ## - # RPC-specific configuration for `get_control` - # @return [::Gapic::Config::Method] - # - attr_reader :get_control - ## - # RPC-specific configuration for `list_controls` - # @return [::Gapic::Config::Method] - # - attr_reader :list_controls - - # @private - def initialize parent_rpcs = nil - create_control_config = parent_rpcs.create_control if parent_rpcs.respond_to? :create_control - @create_control = ::Gapic::Config::Method.new create_control_config - delete_control_config = parent_rpcs.delete_control if parent_rpcs.respond_to? :delete_control - @delete_control = ::Gapic::Config::Method.new delete_control_config - update_control_config = parent_rpcs.update_control if parent_rpcs.respond_to? :update_control - @update_control = ::Gapic::Config::Method.new update_control_config - get_control_config = parent_rpcs.get_control if parent_rpcs.respond_to? :get_control - @get_control = ::Gapic::Config::Method.new get_control_config - list_controls_config = parent_rpcs.list_controls if parent_rpcs.respond_to? :list_controls - @list_controls = ::Gapic::Config::Method.new list_controls_config - - yield self if block_given? - end - end - end - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/credentials.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/credentials.rb deleted file mode 100644 index 127904154fe5..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/credentials.rb +++ /dev/null @@ -1,51 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "googleauth" - -module Google - module Cloud - module Retail - module V2 - module ControlService - # Credentials for the ControlService API. - class Credentials < ::Google::Auth::Credentials - self.scope = [ - "https://www.googleapis.com/auth/cloud-platform" - ] - self.env_vars = [ - "RETAIL_CREDENTIALS", - "RETAIL_KEYFILE", - "GOOGLE_CLOUD_CREDENTIALS", - "GOOGLE_CLOUD_KEYFILE", - "GCLOUD_KEYFILE", - "RETAIL_CREDENTIALS_JSON", - "RETAIL_KEYFILE_JSON", - "GOOGLE_CLOUD_CREDENTIALS_JSON", - "GOOGLE_CLOUD_KEYFILE_JSON", - "GCLOUD_KEYFILE_JSON" - ] - self.paths = [ - "~/.config/google_cloud/application_default_credentials.json" - ] - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/paths.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/paths.rb deleted file mode 100644 index 464e5d03b5ba..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/paths.rb +++ /dev/null @@ -1,73 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Cloud - module Retail - module V2 - module ControlService - # Path helper methods for the ControlService API. - module Paths - ## - # Create a fully-qualified Catalog resource string. - # - # The resource will be in the following format: - # - # `projects/{project}/locations/{location}/catalogs/{catalog}` - # - # @param project [String] - # @param location [String] - # @param catalog [String] - # - # @return [::String] - def catalog_path project:, location:, catalog: - raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" - raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" - - "projects/#{project}/locations/#{location}/catalogs/#{catalog}" - end - - ## - # Create a fully-qualified Control resource string. - # - # The resource will be in the following format: - # - # `projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}` - # - # @param project [String] - # @param location [String] - # @param catalog [String] - # @param control [String] - # - # @return [::String] - def control_path project:, location:, catalog:, control: - raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" - raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" - raise ::ArgumentError, "catalog cannot contain /" if catalog.to_s.include? "/" - - "projects/#{project}/locations/#{location}/catalogs/#{catalog}/controls/#{control}" - end - - extend self - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/rest.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/rest.rb deleted file mode 100644 index 31828796abd0..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/rest.rb +++ /dev/null @@ -1,52 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "gapic/rest" -require "gapic/config" -require "gapic/config/method" - -require "google/cloud/retail/v2/version" - -require "google/cloud/retail/v2/control_service/credentials" -require "google/cloud/retail/v2/control_service/paths" -require "google/cloud/retail/v2/control_service/rest/client" - -module Google - module Cloud - module Retail - module V2 - ## - # Service for modifying Control. - # - # To load this service and instantiate a REST client: - # - # require "google/cloud/retail/v2/control_service/rest" - # client = ::Google::Cloud::Retail::V2::ControlService::Rest::Client.new - # - module ControlService - # Client for the REST transport - module Rest - end - end - end - end - end -end - -helper_path = ::File.join __dir__, "rest", "helpers.rb" -require "google/cloud/retail/v2/control_service/rest/helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/rest/client.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/rest/client.rb deleted file mode 100644 index 8d4d1c1b8f6f..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/rest/client.rb +++ /dev/null @@ -1,833 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "google/cloud/errors" -require "google/cloud/retail/v2/control_service_pb" -require "google/cloud/retail/v2/control_service/rest/service_stub" -require "google/cloud/location/rest" - -module Google - module Cloud - module Retail - module V2 - module ControlService - module Rest - ## - # REST client for the ControlService service. - # - # Service for modifying Control. - # - class Client - # @private - API_VERSION = "" - - # @private - DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" - - include Paths - - # @private - attr_reader :control_service_stub - - ## - # Configure the ControlService Client class. - # - # See {::Google::Cloud::Retail::V2::ControlService::Rest::Client::Configuration} - # for a description of the configuration fields. - # - # @example - # - # # Modify the configuration for all ControlService clients - # ::Google::Cloud::Retail::V2::ControlService::Rest::Client.configure do |config| - # config.timeout = 10.0 - # end - # - # @yield [config] Configure the Client client. - # @yieldparam config [Client::Configuration] - # - # @return [Client::Configuration] - # - def self.configure - @configure ||= begin - namespace = ["Google", "Cloud", "Retail", "V2"] - parent_config = while namespace.any? - parent_name = namespace.join "::" - parent_const = const_get parent_name - break parent_const.configure if parent_const.respond_to? :configure - namespace.pop - end - default_config = Client::Configuration.new parent_config - - default_config - end - yield @configure if block_given? - @configure - end - - ## - # Configure the ControlService Client instance. - # - # The configuration is set to the derived mode, meaning that values can be changed, - # but structural changes (adding new fields, etc.) are not allowed. Structural changes - # should be made on {Client.configure}. - # - # See {::Google::Cloud::Retail::V2::ControlService::Rest::Client::Configuration} - # for a description of the configuration fields. - # - # @yield [config] Configure the Client client. - # @yieldparam config [Client::Configuration] - # - # @return [Client::Configuration] - # - def configure - yield @config if block_given? - @config - end - - ## - # The effective universe domain - # - # @return [String] - # - def universe_domain - @control_service_stub.universe_domain - end - - ## - # Create a new ControlService REST client object. - # - # @example - # - # # Create a client using the default configuration - # client = ::Google::Cloud::Retail::V2::ControlService::Rest::Client.new - # - # # Create a client using a custom configuration - # client = ::Google::Cloud::Retail::V2::ControlService::Rest::Client.new do |config| - # config.timeout = 10.0 - # end - # - # @yield [config] Configure the ControlService client. - # @yieldparam config [Client::Configuration] - # - def initialize - # Create the configuration object - @config = Configuration.new Client.configure - - # Yield the configuration if needed - yield @config if block_given? - - # Create credentials - credentials = @config.credentials - # Use self-signed JWT if the endpoint is unchanged from default, - # but only if the default endpoint does not have a region prefix. - enable_self_signed_jwt = @config.endpoint.nil? || - (@config.endpoint == Configuration::DEFAULT_ENDPOINT && - !@config.endpoint.split(".").first.include?("-")) - credentials ||= Credentials.default scope: @config.scope, - enable_self_signed_jwt: enable_self_signed_jwt - if credentials.is_a?(::String) || credentials.is_a?(::Hash) - credentials = Credentials.new credentials, scope: @config.scope - end - - @quota_project_id = @config.quota_project - @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id - - @control_service_stub = ::Google::Cloud::Retail::V2::ControlService::Rest::ServiceStub.new( - endpoint: @config.endpoint, - endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, - universe_domain: @config.universe_domain, - credentials: credentials, - logger: @config.logger - ) - - @control_service_stub.logger(stub: true)&.info do |entry| - entry.set_system_name - entry.set_service - entry.message = "Created client for #{entry.service}" - entry.set_credentials_fields credentials - entry.set "customEndpoint", @config.endpoint if @config.endpoint - entry.set "defaultTimeout", @config.timeout if @config.timeout - entry.set "quotaProject", @quota_project_id if @quota_project_id - end - - @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config| - config.credentials = credentials - config.quota_project = @quota_project_id - config.endpoint = @control_service_stub.endpoint - config.universe_domain = @control_service_stub.universe_domain - config.logger = @control_service_stub.logger if config.respond_to? :logger= - end - end - - ## - # Get the associated client for mix-in of the Locations. - # - # @return [Google::Cloud::Location::Locations::Rest::Client] - # - attr_reader :location_client - - ## - # The logger used for request/response debug logging. - # - # @return [Logger] - # - def logger - @control_service_stub.logger - end - - # Service calls - - ## - # Creates a Control. - # - # If the {::Google::Cloud::Retail::V2::Control Control} to create already exists, - # an ALREADY_EXISTS error is returned. - # - # @overload create_control(request, options = nil) - # Pass arguments to `create_control` via a request object, either of type - # {::Google::Cloud::Retail::V2::CreateControlRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::CreateControlRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload create_control(parent: nil, control: nil, control_id: nil) - # Pass arguments to `create_control` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. Full resource name of parent catalog. Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - # @param control [::Google::Cloud::Retail::V2::Control, ::Hash] - # Required. The Control to create. - # @param control_id [::String] - # Required. The ID to use for the Control, which will become the final - # component of the Control's resource name. - # - # This value should be 4-63 characters, and valid characters - # are /[a-z][0-9]-_/. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::Control] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::Control] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ControlService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::CreateControlRequest.new - # - # # Call the create_control method. - # result = client.create_control request - # - # # The returned object is of type Google::Cloud::Retail::V2::Control. - # p result - # - def create_control request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::CreateControlRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.create_control.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.create_control.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.create_control.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @control_service_stub.create_control request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Deletes a Control. - # - # If the {::Google::Cloud::Retail::V2::Control Control} to delete does not exist, - # a NOT_FOUND error is returned. - # - # @overload delete_control(request, options = nil) - # Pass arguments to `delete_control` via a request object, either of type - # {::Google::Cloud::Retail::V2::DeleteControlRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::DeleteControlRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload delete_control(name: nil) - # Pass arguments to `delete_control` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # Required. The resource name of the Control to delete. Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}` - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Protobuf::Empty] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Protobuf::Empty] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ControlService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::DeleteControlRequest.new - # - # # Call the delete_control method. - # result = client.delete_control request - # - # # The returned object is of type Google::Protobuf::Empty. - # p result - # - def delete_control request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::DeleteControlRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.delete_control.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.delete_control.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.delete_control.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @control_service_stub.delete_control request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Updates a Control. - # - # {::Google::Cloud::Retail::V2::Control Control} cannot be set to a different - # oneof field, if so an INVALID_ARGUMENT is returned. If the - # {::Google::Cloud::Retail::V2::Control Control} to update does not exist, a - # NOT_FOUND error is returned. - # - # @overload update_control(request, options = nil) - # Pass arguments to `update_control` via a request object, either of type - # {::Google::Cloud::Retail::V2::UpdateControlRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::UpdateControlRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload update_control(control: nil, update_mask: nil) - # Pass arguments to `update_control` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param control [::Google::Cloud::Retail::V2::Control, ::Hash] - # Required. The Control to update. - # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] - # Indicates which fields in the provided - # {::Google::Cloud::Retail::V2::Control Control} to update. The following are NOT - # supported: - # - # * {::Google::Cloud::Retail::V2::Control#name Control.name} - # - # If not set or empty, all supported fields are updated. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::Control] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::Control] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ControlService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::UpdateControlRequest.new - # - # # Call the update_control method. - # result = client.update_control request - # - # # The returned object is of type Google::Cloud::Retail::V2::Control. - # p result - # - def update_control request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::UpdateControlRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.update_control.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.update_control.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.update_control.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @control_service_stub.update_control request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Gets a Control. - # - # @overload get_control(request, options = nil) - # Pass arguments to `get_control` via a request object, either of type - # {::Google::Cloud::Retail::V2::GetControlRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::GetControlRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload get_control(name: nil) - # Pass arguments to `get_control` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # Required. The resource name of the Control to get. Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}` - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::Control] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::Control] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ControlService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::GetControlRequest.new - # - # # Call the get_control method. - # result = client.get_control request - # - # # The returned object is of type Google::Cloud::Retail::V2::Control. - # p result - # - def get_control request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::GetControlRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.get_control.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.get_control.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.get_control.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @control_service_stub.get_control request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Lists all Controls by their parent - # {::Google::Cloud::Retail::V2::Catalog Catalog}. - # - # @overload list_controls(request, options = nil) - # Pass arguments to `list_controls` via a request object, either of type - # {::Google::Cloud::Retail::V2::ListControlsRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::ListControlsRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload list_controls(parent: nil, page_size: nil, page_token: nil, filter: nil) - # Pass arguments to `list_controls` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. The catalog resource name. Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - # @param page_size [::Integer] - # Optional. Maximum number of results to return. If unspecified, defaults - # to 50. Max allowed value is 1000. - # @param page_token [::String] - # Optional. A page token, received from a previous `ListControls` call. - # Provide this to retrieve the subsequent page. - # @param filter [::String] - # Optional. A filter to apply on the list results. Supported features: - # - # * List all the products under the parent branch if - # {::Google::Cloud::Retail::V2::ListControlsRequest#filter filter} is unset. - # * List controls that are used in a single ServingConfig: - # 'serving_config = "boosted_home_page_cvr"' - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Retail::V2::Control>] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Retail::V2::Control>] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ControlService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::ListControlsRequest.new - # - # # Call the list_controls method. - # result = client.list_controls request - # - # # The returned object is of type Gapic::PagedEnumerable. You can iterate - # # over elements, and API calls will be issued to fetch pages as needed. - # result.each do |item| - # # Each element is of type ::Google::Cloud::Retail::V2::Control. - # p item - # end - # - def list_controls request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ListControlsRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.list_controls.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.list_controls.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.list_controls.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @control_service_stub.list_controls request, options do |result, operation| - result = ::Gapic::Rest::PagedEnumerable.new @control_service_stub, :list_controls, "controls", request, result, options - yield result, operation if block_given? - throw :response, result - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Configuration class for the ControlService REST API. - # - # This class represents the configuration for ControlService REST, - # providing control over timeouts, retry behavior, logging, transport - # parameters, and other low-level controls. Certain parameters can also be - # applied individually to specific RPCs. See - # {::Google::Cloud::Retail::V2::ControlService::Rest::Client::Configuration::Rpcs} - # for a list of RPCs that can be configured independently. - # - # Configuration can be applied globally to all clients, or to a single client - # on construction. - # - # @example - # - # # Modify the global config, setting the timeout for - # # create_control to 20 seconds, - # # and all remaining timeouts to 10 seconds. - # ::Google::Cloud::Retail::V2::ControlService::Rest::Client.configure do |config| - # config.timeout = 10.0 - # config.rpcs.create_control.timeout = 20.0 - # end - # - # # Apply the above configuration only to a new client. - # client = ::Google::Cloud::Retail::V2::ControlService::Rest::Client.new do |config| - # config.timeout = 10.0 - # config.rpcs.create_control.timeout = 20.0 - # end - # - # @!attribute [rw] endpoint - # A custom service endpoint, as a hostname or hostname:port. The default is - # nil, indicating to use the default endpoint in the current universe domain. - # @return [::String,nil] - # @!attribute [rw] credentials - # Credentials to send with calls. You may provide any of the following types: - # * (`String`) The path to a service account key file in JSON format - # * (`Hash`) A service account key as a Hash - # * (`Google::Auth::Credentials`) A googleauth credentials object - # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) - # * (`Signet::OAuth2::Client`) A signet oauth2 client object - # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) - # * (`nil`) indicating no credentials - # - # Warning: If you accept a credential configuration (JSON file or Hash) from an - # external source for authentication to Google Cloud, you must validate it before - # providing it to a Google API client library. Providing an unvalidated credential - # configuration to Google APIs can compromise the security of your systems and data. - # For more information, refer to [Validate credential configurations from external - # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). - # @return [::Object] - # @!attribute [rw] scope - # The OAuth scopes - # @return [::Array<::String>] - # @!attribute [rw] lib_name - # The library name as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] lib_version - # The library version as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] timeout - # The call timeout in seconds. - # @return [::Numeric] - # @!attribute [rw] metadata - # Additional headers to be sent with the call. - # @return [::Hash{::Symbol=>::String}] - # @!attribute [rw] retry_policy - # The retry policy. The value is a hash with the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # @return [::Hash] - # @!attribute [rw] quota_project - # A separate project against which to charge quota. - # @return [::String] - # @!attribute [rw] universe_domain - # The universe domain within which to make requests. This determines the - # default endpoint URL. The default value of nil uses the environment - # universe (usually the default "googleapis.com" universe). - # @return [::String,nil] - # @!attribute [rw] logger - # A custom logger to use for request/response debug logging, or the value - # `:default` (the default) to construct a default logger, or `nil` to - # explicitly disable logging. - # @return [::Logger,:default,nil] - # - class Configuration - extend ::Gapic::Config - - # @private - # The endpoint specific to the default "googleapis.com" universe. Deprecated. - DEFAULT_ENDPOINT = "retail.googleapis.com" - - config_attr :endpoint, nil, ::String, nil - config_attr :credentials, nil do |value| - allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] - allowed.any? { |klass| klass === value } - end - config_attr :scope, nil, ::String, ::Array, nil - config_attr :lib_name, nil, ::String, nil - config_attr :lib_version, nil, ::String, nil - config_attr :timeout, nil, ::Numeric, nil - config_attr :metadata, nil, ::Hash, nil - config_attr :retry_policy, nil, ::Hash, ::Proc, nil - config_attr :quota_project, nil, ::String, nil - config_attr :universe_domain, nil, ::String, nil - config_attr :logger, :default, ::Logger, nil, :default - - # @private - def initialize parent_config = nil - @parent_config = parent_config unless parent_config.nil? - - yield self if block_given? - end - - ## - # Configurations for individual RPCs - # @return [Rpcs] - # - def rpcs - @rpcs ||= begin - parent_rpcs = nil - parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) - Rpcs.new parent_rpcs - end - end - - ## - # Configuration RPC class for the ControlService API. - # - # Includes fields providing the configuration for each RPC in this service. - # Each configuration object is of type `Gapic::Config::Method` and includes - # the following configuration fields: - # - # * `timeout` (*type:* `Numeric`) - The call timeout in seconds - # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers - # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields - # include the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # - class Rpcs - ## - # RPC-specific configuration for `create_control` - # @return [::Gapic::Config::Method] - # - attr_reader :create_control - ## - # RPC-specific configuration for `delete_control` - # @return [::Gapic::Config::Method] - # - attr_reader :delete_control - ## - # RPC-specific configuration for `update_control` - # @return [::Gapic::Config::Method] - # - attr_reader :update_control - ## - # RPC-specific configuration for `get_control` - # @return [::Gapic::Config::Method] - # - attr_reader :get_control - ## - # RPC-specific configuration for `list_controls` - # @return [::Gapic::Config::Method] - # - attr_reader :list_controls - - # @private - def initialize parent_rpcs = nil - create_control_config = parent_rpcs.create_control if parent_rpcs.respond_to? :create_control - @create_control = ::Gapic::Config::Method.new create_control_config - delete_control_config = parent_rpcs.delete_control if parent_rpcs.respond_to? :delete_control - @delete_control = ::Gapic::Config::Method.new delete_control_config - update_control_config = parent_rpcs.update_control if parent_rpcs.respond_to? :update_control - @update_control = ::Gapic::Config::Method.new update_control_config - get_control_config = parent_rpcs.get_control if parent_rpcs.respond_to? :get_control - @get_control = ::Gapic::Config::Method.new get_control_config - list_controls_config = parent_rpcs.list_controls if parent_rpcs.respond_to? :list_controls - @list_controls = ::Gapic::Config::Method.new list_controls_config - - yield self if block_given? - end - end - end - end - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/rest/service_stub.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/rest/service_stub.rb deleted file mode 100644 index 61b0a0f77df2..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service/rest/service_stub.rb +++ /dev/null @@ -1,388 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "google/cloud/retail/v2/control_service_pb" - -module Google - module Cloud - module Retail - module V2 - module ControlService - module Rest - ## - # REST service stub for the ControlService service. - # Service stub contains baseline method implementations - # including transcoding, making the REST call, and deserialing the response. - # - class ServiceStub - # @private - def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger: - # These require statements are intentionally placed here to initialize - # the REST modules only when it's required. - require "gapic/rest" - - @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, - endpoint_template: endpoint_template, - universe_domain: universe_domain, - credentials: credentials, - numeric_enums: true, - service_name: self.class, - raise_faraday_errors: false, - logger: logger - end - - ## - # The effective universe domain - # - # @return [String] - # - def universe_domain - @client_stub.universe_domain - end - - ## - # The effective endpoint - # - # @return [String] - # - def endpoint - @client_stub.endpoint - end - - ## - # The logger used for request/response debug logging. - # - # @return [Logger] - # - def logger stub: false - stub ? @client_stub.stub_logger : @client_stub.logger - end - - ## - # Baseline implementation for the create_control REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::CreateControlRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::Control] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::Control] - # A result object deserialized from the server's reply - def create_control request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_create_control_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "create_control", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Retail::V2::Control.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the delete_control REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::DeleteControlRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Protobuf::Empty] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Protobuf::Empty] - # A result object deserialized from the server's reply - def delete_control request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_delete_control_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "delete_control", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the update_control REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::UpdateControlRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::Control] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::Control] - # A result object deserialized from the server's reply - def update_control request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_update_control_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "update_control", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Retail::V2::Control.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the get_control REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::GetControlRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::Control] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::Control] - # A result object deserialized from the server's reply - def get_control request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_get_control_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "get_control", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Retail::V2::Control.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the list_controls REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::ListControlsRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::ListControlsResponse] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::ListControlsResponse] - # A result object deserialized from the server's reply - def list_controls request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_list_controls_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "list_controls", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Retail::V2::ListControlsResponse.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # @private - # - # GRPC transcoding helper method for the create_control REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::CreateControlRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_create_control_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :post, - uri_template: "/v2/{parent}/controls", - body: "control", - matches: [ - ["parent", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the delete_control REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::DeleteControlRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_delete_control_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :delete, - uri_template: "/v2/{name}", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/controls/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the update_control REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::UpdateControlRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_update_control_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :patch, - uri_template: "/v2/{control.name}", - body: "control", - matches: [ - ["control.name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/controls/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the get_control REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::GetControlRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_get_control_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :get, - uri_template: "/v2/{name}", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/controls/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the list_controls REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::ListControlsRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_list_controls_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :get, - uri_template: "/v2/{parent}/controls", - matches: [ - ["parent", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - end - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service_pb.rb deleted file mode 100644 index 4af2840862e1..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service_pb.rb +++ /dev/null @@ -1,34 +0,0 @@ -# frozen_string_literal: true -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/retail/v2/control_service.proto - -require 'google/protobuf' - -require 'google/api/annotations_pb' -require 'google/api/client_pb' -require 'google/api/field_behavior_pb' -require 'google/api/resource_pb' -require 'google/cloud/retail/v2/control_pb' -require 'google/protobuf/empty_pb' -require 'google/protobuf/field_mask_pb' - - -descriptor_data = "\n,google/cloud/retail/v2/control_service.proto\x12\x16google.cloud.retail.v2\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a$google/cloud/retail/v2/control.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\"\x9d\x01\n\x14\x43reateControlRequest\x12\x35\n\x06parent\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\n\x1dretail.googleapis.com/Catalog\x12\x35\n\x07\x63ontrol\x18\x02 \x01(\x0b\x32\x1f.google.cloud.retail.v2.ControlB\x03\xe0\x41\x02\x12\x17\n\ncontrol_id\x18\x03 \x01(\tB\x03\xe0\x41\x02\"~\n\x14UpdateControlRequest\x12\x35\n\x07\x63ontrol\x18\x01 \x01(\x0b\x32\x1f.google.cloud.retail.v2.ControlB\x03\xe0\x41\x02\x12/\n\x0bupdate_mask\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMask\"K\n\x14\x44\x65leteControlRequest\x12\x33\n\x04name\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\n\x1dretail.googleapis.com/Control\"H\n\x11GetControlRequest\x12\x33\n\x04name\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\n\x1dretail.googleapis.com/Control\"\x92\x01\n\x13ListControlsRequest\x12\x35\n\x06parent\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\n\x1dretail.googleapis.com/Catalog\x12\x16\n\tpage_size\x18\x02 \x01(\x05\x42\x03\xe0\x41\x01\x12\x17\n\npage_token\x18\x03 \x01(\tB\x03\xe0\x41\x01\x12\x13\n\x06\x66ilter\x18\x04 \x01(\tB\x03\xe0\x41\x01\"b\n\x14ListControlsResponse\x12\x31\n\x08\x63ontrols\x18\x01 \x03(\x0b\x32\x1f.google.cloud.retail.v2.Control\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t2\xe4\x07\n\x0e\x43ontrolService\x12\xc4\x01\n\rCreateControl\x12,.google.cloud.retail.v2.CreateControlRequest\x1a\x1f.google.cloud.retail.v2.Control\"d\xda\x41\x19parent,control,control_id\x82\xd3\xe4\x93\x02\x42\"7/v2/{parent=projects/*/locations/*/catalogs/*}/controls:\x07\x63ontrol\x12\x9d\x01\n\rDeleteControl\x12,.google.cloud.retail.v2.DeleteControlRequest\x1a\x16.google.protobuf.Empty\"F\xda\x41\x04name\x82\xd3\xe4\x93\x02\x39*7/v2/{name=projects/*/locations/*/catalogs/*/controls/*}\x12\xc6\x01\n\rUpdateControl\x12,.google.cloud.retail.v2.UpdateControlRequest\x1a\x1f.google.cloud.retail.v2.Control\"f\xda\x41\x13\x63ontrol,update_mask\x82\xd3\xe4\x93\x02J2?/v2/{control.name=projects/*/locations/*/catalogs/*/controls/*}:\x07\x63ontrol\x12\xa0\x01\n\nGetControl\x12).google.cloud.retail.v2.GetControlRequest\x1a\x1f.google.cloud.retail.v2.Control\"F\xda\x41\x04name\x82\xd3\xe4\x93\x02\x39\x12\x37/v2/{name=projects/*/locations/*/catalogs/*/controls/*}\x12\xb3\x01\n\x0cListControls\x12+.google.cloud.retail.v2.ListControlsRequest\x1a,.google.cloud.retail.v2.ListControlsResponse\"H\xda\x41\x06parent\x82\xd3\xe4\x93\x02\x39\x12\x37/v2/{parent=projects/*/locations/*/catalogs/*}/controls\x1aI\xca\x41\x15retail.googleapis.com\xd2\x41.https://www.googleapis.com/auth/cloud-platformB\xbe\x01\n\x1a\x63om.google.cloud.retail.v2B\x13\x43ontrolServiceProtoP\x01Z2cloud.google.com/go/retail/apiv2/retailpb;retailpb\xa2\x02\x06RETAIL\xaa\x02\x16Google.Cloud.Retail.V2\xca\x02\x16Google\\Cloud\\Retail\\V2\xea\x02\x19Google::Cloud::Retail::V2b\x06proto3" - -pool = ::Google::Protobuf::DescriptorPool.generated_pool -pool.add_serialized_file(descriptor_data) - -module Google - module Cloud - module Retail - module V2 - CreateControlRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CreateControlRequest").msgclass - UpdateControlRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.UpdateControlRequest").msgclass - DeleteControlRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.DeleteControlRequest").msgclass - GetControlRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.GetControlRequest").msgclass - ListControlsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ListControlsRequest").msgclass - ListControlsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ListControlsResponse").msgclass - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service_services_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service_services_pb.rb deleted file mode 100644 index bcef36f6b4c1..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/control_service_services_pb.rb +++ /dev/null @@ -1,65 +0,0 @@ -# Generated by the protocol buffer compiler. DO NOT EDIT! -# Source: google/cloud/retail/v2/control_service.proto for package 'Google.Cloud.Retail.V2' -# Original file comments: -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -require 'grpc' -require 'google/cloud/retail/v2/control_service_pb' - -module Google - module Cloud - module Retail - module V2 - module ControlService - # Service for modifying Control. - class Service - - include ::GRPC::GenericService - - self.marshal_class_method = :encode - self.unmarshal_class_method = :decode - self.service_name = 'google.cloud.retail.v2.ControlService' - - # Creates a Control. - # - # If the [Control][google.cloud.retail.v2.Control] to create already exists, - # an ALREADY_EXISTS error is returned. - rpc :CreateControl, ::Google::Cloud::Retail::V2::CreateControlRequest, ::Google::Cloud::Retail::V2::Control - # Deletes a Control. - # - # If the [Control][google.cloud.retail.v2.Control] to delete does not exist, - # a NOT_FOUND error is returned. - rpc :DeleteControl, ::Google::Cloud::Retail::V2::DeleteControlRequest, ::Google::Protobuf::Empty - # Updates a Control. - # - # [Control][google.cloud.retail.v2.Control] cannot be set to a different - # oneof field, if so an INVALID_ARGUMENT is returned. If the - # [Control][google.cloud.retail.v2.Control] to update does not exist, a - # NOT_FOUND error is returned. - rpc :UpdateControl, ::Google::Cloud::Retail::V2::UpdateControlRequest, ::Google::Cloud::Retail::V2::Control - # Gets a Control. - rpc :GetControl, ::Google::Cloud::Retail::V2::GetControlRequest, ::Google::Cloud::Retail::V2::Control - # Lists all Controls by their parent - # [Catalog][google.cloud.retail.v2.Catalog]. - rpc :ListControls, ::Google::Cloud::Retail::V2::ListControlsRequest, ::Google::Cloud::Retail::V2::ListControlsResponse - end - - Stub = Service.rpc_stub_class - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service.rb deleted file mode 100644 index c3b86da366b9..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service.rb +++ /dev/null @@ -1,59 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "gapic/common" -require "gapic/config" -require "gapic/config/method" - -require "google/cloud/retail/v2/version" - -require "google/cloud/retail/v2/conversational_search_service/credentials" -require "google/cloud/retail/v2/conversational_search_service/paths" -require "google/cloud/retail/v2/conversational_search_service/client" -require "google/cloud/retail/v2/conversational_search_service/rest" - -module Google - module Cloud - module Retail - module V2 - ## - # Service for retail conversational search. - # - # This feature is only available for users who have Retail Conversational - # Search enabled. Enable Retail Conversational Search on Cloud Console - # before using this feature. - # - # @example Load this service and instantiate a gRPC client - # - # require "google/cloud/retail/v2/conversational_search_service" - # client = ::Google::Cloud::Retail::V2::ConversationalSearchService::Client.new - # - # @example Load this service and instantiate a REST client - # - # require "google/cloud/retail/v2/conversational_search_service/rest" - # client = ::Google::Cloud::Retail::V2::ConversationalSearchService::Rest::Client.new - # - module ConversationalSearchService - end - end - end - end -end - -helper_path = ::File.join __dir__, "conversational_search_service", "helpers.rb" -require "google/cloud/retail/v2/conversational_search_service/helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/client.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/client.rb deleted file mode 100644 index 0a37d6165e10..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/client.rb +++ /dev/null @@ -1,576 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "google/cloud/errors" -require "google/cloud/retail/v2/conversational_search_service_pb" -require "google/cloud/location" - -module Google - module Cloud - module Retail - module V2 - module ConversationalSearchService - ## - # Client for the ConversationalSearchService service. - # - # Service for retail conversational search. - # - # This feature is only available for users who have Retail Conversational - # Search enabled. Enable Retail Conversational Search on Cloud Console - # before using this feature. - # - class Client - # @private - API_VERSION = "" - - # @private - DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" - - include Paths - - # @private - attr_reader :conversational_search_service_stub - - ## - # Configure the ConversationalSearchService Client class. - # - # See {::Google::Cloud::Retail::V2::ConversationalSearchService::Client::Configuration} - # for a description of the configuration fields. - # - # @example - # - # # Modify the configuration for all ConversationalSearchService clients - # ::Google::Cloud::Retail::V2::ConversationalSearchService::Client.configure do |config| - # config.timeout = 10.0 - # end - # - # @yield [config] Configure the Client client. - # @yieldparam config [Client::Configuration] - # - # @return [Client::Configuration] - # - def self.configure - @configure ||= begin - namespace = ["Google", "Cloud", "Retail", "V2"] - parent_config = while namespace.any? - parent_name = namespace.join "::" - parent_const = const_get parent_name - break parent_const.configure if parent_const.respond_to? :configure - namespace.pop - end - default_config = Client::Configuration.new parent_config - - default_config - end - yield @configure if block_given? - @configure - end - - ## - # Configure the ConversationalSearchService Client instance. - # - # The configuration is set to the derived mode, meaning that values can be changed, - # but structural changes (adding new fields, etc.) are not allowed. Structural changes - # should be made on {Client.configure}. - # - # See {::Google::Cloud::Retail::V2::ConversationalSearchService::Client::Configuration} - # for a description of the configuration fields. - # - # @yield [config] Configure the Client client. - # @yieldparam config [Client::Configuration] - # - # @return [Client::Configuration] - # - def configure - yield @config if block_given? - @config - end - - ## - # The effective universe domain - # - # @return [String] - # - def universe_domain - @conversational_search_service_stub.universe_domain - end - - ## - # Create a new ConversationalSearchService client object. - # - # @example - # - # # Create a client using the default configuration - # client = ::Google::Cloud::Retail::V2::ConversationalSearchService::Client.new - # - # # Create a client using a custom configuration - # client = ::Google::Cloud::Retail::V2::ConversationalSearchService::Client.new do |config| - # config.timeout = 10.0 - # end - # - # @yield [config] Configure the ConversationalSearchService client. - # @yieldparam config [Client::Configuration] - # - def initialize - # These require statements are intentionally placed here to initialize - # the gRPC module only when it's required. - # See https://github.com/googleapis/toolkit/issues/446 - require "gapic/grpc" - require "google/cloud/retail/v2/conversational_search_service_services_pb" - - # Create the configuration object - @config = Configuration.new Client.configure - - # Yield the configuration if needed - yield @config if block_given? - - # Create credentials - credentials = @config.credentials - # Use self-signed JWT if the endpoint is unchanged from default, - # but only if the default endpoint does not have a region prefix. - enable_self_signed_jwt = @config.endpoint.nil? || - (@config.endpoint == Configuration::DEFAULT_ENDPOINT && - !@config.endpoint.split(".").first.include?("-")) - credentials ||= Credentials.default scope: @config.scope, - enable_self_signed_jwt: enable_self_signed_jwt - if credentials.is_a?(::String) || credentials.is_a?(::Hash) - credentials = Credentials.new credentials, scope: @config.scope - end - @quota_project_id = @config.quota_project - @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id - - @conversational_search_service_stub = ::Gapic::ServiceStub.new( - ::Google::Cloud::Retail::V2::ConversationalSearchService::Stub, - credentials: credentials, - endpoint: @config.endpoint, - endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, - universe_domain: @config.universe_domain, - channel_args: @config.channel_args, - interceptors: @config.interceptors, - channel_pool_config: @config.channel_pool, - logger: @config.logger - ) - - @conversational_search_service_stub.stub_logger&.info do |entry| - entry.set_system_name - entry.set_service - entry.message = "Created client for #{entry.service}" - entry.set_credentials_fields credentials - entry.set "customEndpoint", @config.endpoint if @config.endpoint - entry.set "defaultTimeout", @config.timeout if @config.timeout - entry.set "quotaProject", @quota_project_id if @quota_project_id - end - - @location_client = Google::Cloud::Location::Locations::Client.new do |config| - config.credentials = credentials - config.quota_project = @quota_project_id - config.endpoint = @conversational_search_service_stub.endpoint - config.universe_domain = @conversational_search_service_stub.universe_domain - config.logger = @conversational_search_service_stub.logger if config.respond_to? :logger= - end - end - - ## - # Get the associated client for mix-in of the Locations. - # - # @return [Google::Cloud::Location::Locations::Client] - # - attr_reader :location_client - - ## - # The logger used for request/response debug logging. - # - # @return [Logger] - # - def logger - @conversational_search_service_stub.logger - end - - # Service calls - - ## - # Performs a conversational search. - # - # This feature is only available for users who have Conversational Search - # enabled. - # - # @overload conversational_search(request, options = nil) - # Pass arguments to `conversational_search` via a request object, either of type - # {::Google::Cloud::Retail::V2::ConversationalSearchRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::ConversationalSearchRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload conversational_search(placement: nil, branch: nil, query: nil, page_categories: nil, conversation_id: nil, search_params: nil, visitor_id: nil, user_info: nil, conversational_filtering_spec: nil, user_labels: nil, safety_settings: nil) - # Pass arguments to `conversational_search` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param placement [::String] - # Required. The resource name of the search engine placement, such as - # `projects/*/locations/global/catalogs/default_catalog/placements/default_search` - # or - # `projects/*/locations/global/catalogs/default_catalog/servingConfigs/default_serving_config` - # This field is used to identify the serving config name and the set - # of models that will be used to make the search. - # @param branch [::String] - # Required. The branch resource name, such as - # `projects/*/locations/global/catalogs/default_catalog/branches/0`. - # - # Use "default_branch" as the branch ID or leave this field empty, to search - # products under the default branch. - # @param query [::String] - # Optional. Raw search query to be searched for. - # - # If this field is empty, the request is considered a category browsing - # request. - # @param page_categories [::Array<::String>] - # Optional. The categories associated with a category page. Must be set for - # category navigation queries to achieve good search quality. The format - # should be the same as - # {::Google::Cloud::Retail::V2::UserEvent#page_categories UserEvent.page_categories}; - # - # To represent full path of category, use '>' sign to separate different - # hierarchies. If '>' is part of the category name, replace it with - # other character(s). - # - # Category pages include special pages such as sales or promotions. For - # instance, a special sale page may have the category hierarchy: - # "pageCategories" : ["Sales > 2017 Black Friday Deals"]. - # @param conversation_id [::String] - # Optional. This field specifies the conversation id, which maintains the - # state of the conversation between client side and server side. Use the - # value from the previous - # {::Google::Cloud::Retail::V2::ConversationalSearchResponse#conversation_id ConversationalSearchResponse.conversation_id}. - # For the initial request, this should be empty. - # @param search_params [::Google::Cloud::Retail::V2::ConversationalSearchRequest::SearchParams, ::Hash] - # Optional. Search parameters. - # @param visitor_id [::String] - # Required. A unique identifier for tracking visitors. For example, this - # could be implemented with an HTTP cookie, which should be able to uniquely - # identify a visitor on a single device. This unique identifier should not - # change if the visitor logs in or out of the website. - # - # This should be the same identifier as - # {::Google::Cloud::Retail::V2::UserEvent#visitor_id UserEvent.visitor_id}. - # - # The field must be a UTF-8 encoded string with a length limit of 128 - # characters. Otherwise, an INVALID_ARGUMENT error is returned. - # @param user_info [::Google::Cloud::Retail::V2::UserInfo, ::Hash] - # Optional. User information. - # @param conversational_filtering_spec [::Google::Cloud::Retail::V2::ConversationalSearchRequest::ConversationalFilteringSpec, ::Hash] - # Optional. This field specifies all conversational filtering related - # parameters. - # @param user_labels [::Hash{::String => ::String}] - # Optional. The user labels applied to a resource must meet the following - # requirements: - # - # * Each resource can have multiple labels, up to a maximum of 64. - # * Each label must be a key-value pair. - # * Keys have a minimum length of 1 character and a maximum length of 63 - # characters and cannot be empty. Values can be empty and have a maximum - # length of 63 characters. - # * Keys and values can contain only lowercase letters, numeric characters, - # underscores, and dashes. All characters must use UTF-8 encoding, and - # international characters are allowed. - # * The key portion of a label must be unique. However, you can use the same - # key with multiple resources. - # * Keys must start with a lowercase letter or international character. - # - # See [Google Cloud - # Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) - # for more details. - # @param safety_settings [::Array<::Google::Cloud::Retail::V2::SafetySetting, ::Hash>] - # Optional. The safety settings to be applied to the generated content. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Enumerable<::Google::Cloud::Retail::V2::ConversationalSearchResponse>] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Enumerable<::Google::Cloud::Retail::V2::ConversationalSearchResponse>] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ConversationalSearchService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::ConversationalSearchRequest.new - # - # # Call the conversational_search method to start streaming. - # output = client.conversational_search request - # - # # The returned object is a streamed enumerable yielding elements of type - # # ::Google::Cloud::Retail::V2::ConversationalSearchResponse - # output.each do |current_response| - # p current_response - # end - # - def conversational_search request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ConversationalSearchRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.conversational_search.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.placement - header_params["placement"] = request.placement - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.conversational_search.timeout, - metadata: metadata, - retry_policy: @config.rpcs.conversational_search.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @conversational_search_service_stub.call_rpc :conversational_search, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Configuration class for the ConversationalSearchService API. - # - # This class represents the configuration for ConversationalSearchService, - # providing control over timeouts, retry behavior, logging, transport - # parameters, and other low-level controls. Certain parameters can also be - # applied individually to specific RPCs. See - # {::Google::Cloud::Retail::V2::ConversationalSearchService::Client::Configuration::Rpcs} - # for a list of RPCs that can be configured independently. - # - # Configuration can be applied globally to all clients, or to a single client - # on construction. - # - # @example - # - # # Modify the global config, setting the timeout for - # # conversational_search to 20 seconds, - # # and all remaining timeouts to 10 seconds. - # ::Google::Cloud::Retail::V2::ConversationalSearchService::Client.configure do |config| - # config.timeout = 10.0 - # config.rpcs.conversational_search.timeout = 20.0 - # end - # - # # Apply the above configuration only to a new client. - # client = ::Google::Cloud::Retail::V2::ConversationalSearchService::Client.new do |config| - # config.timeout = 10.0 - # config.rpcs.conversational_search.timeout = 20.0 - # end - # - # @!attribute [rw] endpoint - # A custom service endpoint, as a hostname or hostname:port. The default is - # nil, indicating to use the default endpoint in the current universe domain. - # @return [::String,nil] - # @!attribute [rw] credentials - # Credentials to send with calls. You may provide any of the following types: - # * (`Google::Auth::Credentials`) A googleauth credentials object - # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) - # * (`Signet::OAuth2::Client`) A signet oauth2 client object - # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) - # * (`GRPC::Core::Channel`) a gRPC channel with included credentials - # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object - # * (`nil`) indicating no credentials - # - # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials - # is deprecated. Providing an unvalidated credential configuration to - # Google APIs can compromise the security of your systems and data. - # - # @example - # - # # The recommended way to provide credentials is to use the `make_creds` method - # # on the appropriate credentials class for your environment. - # - # require "googleauth" - # - # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds( - # json_key_io: ::File.open("/path/to/keyfile.json") - # ) - # - # client = ::Google::Cloud::Retail::V2::ConversationalSearchService::Client.new do |config| - # config.credentials = credentials - # end - # - # @note Warning: If you accept a credential configuration (JSON file or Hash) from an - # external source for authentication to Google Cloud, you must validate it before - # providing it to a Google API client library. Providing an unvalidated credential - # configuration to Google APIs can compromise the security of your systems and data. - # For more information, refer to [Validate credential configurations from external - # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). - # @return [::Object] - # @!attribute [rw] scope - # The OAuth scopes - # @return [::Array<::String>] - # @!attribute [rw] lib_name - # The library name as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] lib_version - # The library version as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] channel_args - # Extra parameters passed to the gRPC channel. Note: this is ignored if a - # `GRPC::Core::Channel` object is provided as the credential. - # @return [::Hash] - # @!attribute [rw] interceptors - # An array of interceptors that are run before calls are executed. - # @return [::Array<::GRPC::ClientInterceptor>] - # @!attribute [rw] timeout - # The call timeout in seconds. - # @return [::Numeric] - # @!attribute [rw] metadata - # Additional gRPC headers to be sent with the call. - # @return [::Hash{::Symbol=>::String}] - # @!attribute [rw] retry_policy - # The retry policy. The value is a hash with the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # @return [::Hash] - # @!attribute [rw] quota_project - # A separate project against which to charge quota. - # @return [::String] - # @!attribute [rw] universe_domain - # The universe domain within which to make requests. This determines the - # default endpoint URL. The default value of nil uses the environment - # universe (usually the default "googleapis.com" universe). - # @return [::String,nil] - # @!attribute [rw] logger - # A custom logger to use for request/response debug logging, or the value - # `:default` (the default) to construct a default logger, or `nil` to - # explicitly disable logging. - # @return [::Logger,:default,nil] - # - class Configuration - extend ::Gapic::Config - - # @private - # The endpoint specific to the default "googleapis.com" universe. Deprecated. - DEFAULT_ENDPOINT = "retail.googleapis.com" - - config_attr :endpoint, nil, ::String, nil - config_attr :credentials, nil do |value| - allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] - allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel - allowed.any? { |klass| klass === value } - end - config_attr :scope, nil, ::String, ::Array, nil - config_attr :lib_name, nil, ::String, nil - config_attr :lib_version, nil, ::String, nil - config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) - config_attr :interceptors, nil, ::Array, nil - config_attr :timeout, nil, ::Numeric, nil - config_attr :metadata, nil, ::Hash, nil - config_attr :retry_policy, nil, ::Hash, ::Proc, nil - config_attr :quota_project, nil, ::String, nil - config_attr :universe_domain, nil, ::String, nil - config_attr :logger, :default, ::Logger, nil, :default - - # @private - def initialize parent_config = nil - @parent_config = parent_config unless parent_config.nil? - - yield self if block_given? - end - - ## - # Configurations for individual RPCs - # @return [Rpcs] - # - def rpcs - @rpcs ||= begin - parent_rpcs = nil - parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) - Rpcs.new parent_rpcs - end - end - - ## - # Configuration for the channel pool - # @return [::Gapic::ServiceStub::ChannelPool::Configuration] - # - def channel_pool - @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new - end - - ## - # Configuration RPC class for the ConversationalSearchService API. - # - # Includes fields providing the configuration for each RPC in this service. - # Each configuration object is of type `Gapic::Config::Method` and includes - # the following configuration fields: - # - # * `timeout` (*type:* `Numeric`) - The call timeout in seconds - # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers - # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields - # include the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # - class Rpcs - ## - # RPC-specific configuration for `conversational_search` - # @return [::Gapic::Config::Method] - # - attr_reader :conversational_search - - # @private - def initialize parent_rpcs = nil - conversational_search_config = parent_rpcs.conversational_search if parent_rpcs.respond_to? :conversational_search - @conversational_search = ::Gapic::Config::Method.new conversational_search_config - - yield self if block_given? - end - end - end - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/credentials.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/credentials.rb deleted file mode 100644 index ccd5e02152d8..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/credentials.rb +++ /dev/null @@ -1,51 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "googleauth" - -module Google - module Cloud - module Retail - module V2 - module ConversationalSearchService - # Credentials for the ConversationalSearchService API. - class Credentials < ::Google::Auth::Credentials - self.scope = [ - "https://www.googleapis.com/auth/cloud-platform" - ] - self.env_vars = [ - "RETAIL_CREDENTIALS", - "RETAIL_KEYFILE", - "GOOGLE_CLOUD_CREDENTIALS", - "GOOGLE_CLOUD_KEYFILE", - "GCLOUD_KEYFILE", - "RETAIL_CREDENTIALS_JSON", - "RETAIL_KEYFILE_JSON", - "GOOGLE_CLOUD_CREDENTIALS_JSON", - "GOOGLE_CLOUD_KEYFILE_JSON", - "GCLOUD_KEYFILE_JSON" - ] - self.paths = [ - "~/.config/google_cloud/application_default_credentials.json" - ] - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/paths.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/paths.rb deleted file mode 100644 index f19dca726f47..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/paths.rb +++ /dev/null @@ -1,54 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Cloud - module Retail - module V2 - module ConversationalSearchService - # Path helper methods for the ConversationalSearchService API. - module Paths - ## - # Create a fully-qualified Branch resource string. - # - # The resource will be in the following format: - # - # `projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}` - # - # @param project [String] - # @param location [String] - # @param catalog [String] - # @param branch [String] - # - # @return [::String] - def branch_path project:, location:, catalog:, branch: - raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" - raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" - raise ::ArgumentError, "catalog cannot contain /" if catalog.to_s.include? "/" - - "projects/#{project}/locations/#{location}/catalogs/#{catalog}/branches/#{branch}" - end - - extend self - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/rest.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/rest.rb deleted file mode 100644 index 2177b82399f5..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/rest.rb +++ /dev/null @@ -1,56 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "gapic/rest" -require "gapic/config" -require "gapic/config/method" - -require "google/cloud/retail/v2/version" - -require "google/cloud/retail/v2/conversational_search_service/credentials" -require "google/cloud/retail/v2/conversational_search_service/paths" -require "google/cloud/retail/v2/conversational_search_service/rest/client" - -module Google - module Cloud - module Retail - module V2 - ## - # Service for retail conversational search. - # - # This feature is only available for users who have Retail Conversational - # Search enabled. Enable Retail Conversational Search on Cloud Console - # before using this feature. - # - # To load this service and instantiate a REST client: - # - # require "google/cloud/retail/v2/conversational_search_service/rest" - # client = ::Google::Cloud::Retail::V2::ConversationalSearchService::Rest::Client.new - # - module ConversationalSearchService - # Client for the REST transport - module Rest - end - end - end - end - end -end - -helper_path = ::File.join __dir__, "rest", "helpers.rb" -require "google/cloud/retail/v2/conversational_search_service/rest/helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/rest/client.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/rest/client.rb deleted file mode 100644 index a4a6d12e6df2..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/rest/client.rb +++ /dev/null @@ -1,528 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "google/cloud/errors" -require "google/cloud/retail/v2/conversational_search_service_pb" -require "google/cloud/retail/v2/conversational_search_service/rest/service_stub" -require "google/cloud/location/rest" - -module Google - module Cloud - module Retail - module V2 - module ConversationalSearchService - module Rest - ## - # REST client for the ConversationalSearchService service. - # - # Service for retail conversational search. - # - # This feature is only available for users who have Retail Conversational - # Search enabled. Enable Retail Conversational Search on Cloud Console - # before using this feature. - # - class Client - # @private - API_VERSION = "" - - # @private - DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" - - include Paths - - # @private - attr_reader :conversational_search_service_stub - - ## - # Configure the ConversationalSearchService Client class. - # - # See {::Google::Cloud::Retail::V2::ConversationalSearchService::Rest::Client::Configuration} - # for a description of the configuration fields. - # - # @example - # - # # Modify the configuration for all ConversationalSearchService clients - # ::Google::Cloud::Retail::V2::ConversationalSearchService::Rest::Client.configure do |config| - # config.timeout = 10.0 - # end - # - # @yield [config] Configure the Client client. - # @yieldparam config [Client::Configuration] - # - # @return [Client::Configuration] - # - def self.configure - @configure ||= begin - namespace = ["Google", "Cloud", "Retail", "V2"] - parent_config = while namespace.any? - parent_name = namespace.join "::" - parent_const = const_get parent_name - break parent_const.configure if parent_const.respond_to? :configure - namespace.pop - end - default_config = Client::Configuration.new parent_config - - default_config - end - yield @configure if block_given? - @configure - end - - ## - # Configure the ConversationalSearchService Client instance. - # - # The configuration is set to the derived mode, meaning that values can be changed, - # but structural changes (adding new fields, etc.) are not allowed. Structural changes - # should be made on {Client.configure}. - # - # See {::Google::Cloud::Retail::V2::ConversationalSearchService::Rest::Client::Configuration} - # for a description of the configuration fields. - # - # @yield [config] Configure the Client client. - # @yieldparam config [Client::Configuration] - # - # @return [Client::Configuration] - # - def configure - yield @config if block_given? - @config - end - - ## - # The effective universe domain - # - # @return [String] - # - def universe_domain - @conversational_search_service_stub.universe_domain - end - - ## - # Create a new ConversationalSearchService REST client object. - # - # @example - # - # # Create a client using the default configuration - # client = ::Google::Cloud::Retail::V2::ConversationalSearchService::Rest::Client.new - # - # # Create a client using a custom configuration - # client = ::Google::Cloud::Retail::V2::ConversationalSearchService::Rest::Client.new do |config| - # config.timeout = 10.0 - # end - # - # @yield [config] Configure the ConversationalSearchService client. - # @yieldparam config [Client::Configuration] - # - def initialize - # Create the configuration object - @config = Configuration.new Client.configure - - # Yield the configuration if needed - yield @config if block_given? - - # Create credentials - credentials = @config.credentials - # Use self-signed JWT if the endpoint is unchanged from default, - # but only if the default endpoint does not have a region prefix. - enable_self_signed_jwt = @config.endpoint.nil? || - (@config.endpoint == Configuration::DEFAULT_ENDPOINT && - !@config.endpoint.split(".").first.include?("-")) - credentials ||= Credentials.default scope: @config.scope, - enable_self_signed_jwt: enable_self_signed_jwt - if credentials.is_a?(::String) || credentials.is_a?(::Hash) - credentials = Credentials.new credentials, scope: @config.scope - end - - @quota_project_id = @config.quota_project - @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id - - @conversational_search_service_stub = ::Google::Cloud::Retail::V2::ConversationalSearchService::Rest::ServiceStub.new( - endpoint: @config.endpoint, - endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, - universe_domain: @config.universe_domain, - credentials: credentials, - logger: @config.logger - ) - - @conversational_search_service_stub.logger(stub: true)&.info do |entry| - entry.set_system_name - entry.set_service - entry.message = "Created client for #{entry.service}" - entry.set_credentials_fields credentials - entry.set "customEndpoint", @config.endpoint if @config.endpoint - entry.set "defaultTimeout", @config.timeout if @config.timeout - entry.set "quotaProject", @quota_project_id if @quota_project_id - end - - @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config| - config.credentials = credentials - config.quota_project = @quota_project_id - config.endpoint = @conversational_search_service_stub.endpoint - config.universe_domain = @conversational_search_service_stub.universe_domain - config.logger = @conversational_search_service_stub.logger if config.respond_to? :logger= - end - end - - ## - # Get the associated client for mix-in of the Locations. - # - # @return [Google::Cloud::Location::Locations::Rest::Client] - # - attr_reader :location_client - - ## - # The logger used for request/response debug logging. - # - # @return [Logger] - # - def logger - @conversational_search_service_stub.logger - end - - # Service calls - - ## - # Performs a conversational search. - # - # This feature is only available for users who have Conversational Search - # enabled. - # - # @overload conversational_search(request, options = nil) - # Pass arguments to `conversational_search` via a request object, either of type - # {::Google::Cloud::Retail::V2::ConversationalSearchRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::ConversationalSearchRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload conversational_search(placement: nil, branch: nil, query: nil, page_categories: nil, conversation_id: nil, search_params: nil, visitor_id: nil, user_info: nil, conversational_filtering_spec: nil, user_labels: nil, safety_settings: nil) - # Pass arguments to `conversational_search` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param placement [::String] - # Required. The resource name of the search engine placement, such as - # `projects/*/locations/global/catalogs/default_catalog/placements/default_search` - # or - # `projects/*/locations/global/catalogs/default_catalog/servingConfigs/default_serving_config` - # This field is used to identify the serving config name and the set - # of models that will be used to make the search. - # @param branch [::String] - # Required. The branch resource name, such as - # `projects/*/locations/global/catalogs/default_catalog/branches/0`. - # - # Use "default_branch" as the branch ID or leave this field empty, to search - # products under the default branch. - # @param query [::String] - # Optional. Raw search query to be searched for. - # - # If this field is empty, the request is considered a category browsing - # request. - # @param page_categories [::Array<::String>] - # Optional. The categories associated with a category page. Must be set for - # category navigation queries to achieve good search quality. The format - # should be the same as - # {::Google::Cloud::Retail::V2::UserEvent#page_categories UserEvent.page_categories}; - # - # To represent full path of category, use '>' sign to separate different - # hierarchies. If '>' is part of the category name, replace it with - # other character(s). - # - # Category pages include special pages such as sales or promotions. For - # instance, a special sale page may have the category hierarchy: - # "pageCategories" : ["Sales > 2017 Black Friday Deals"]. - # @param conversation_id [::String] - # Optional. This field specifies the conversation id, which maintains the - # state of the conversation between client side and server side. Use the - # value from the previous - # {::Google::Cloud::Retail::V2::ConversationalSearchResponse#conversation_id ConversationalSearchResponse.conversation_id}. - # For the initial request, this should be empty. - # @param search_params [::Google::Cloud::Retail::V2::ConversationalSearchRequest::SearchParams, ::Hash] - # Optional. Search parameters. - # @param visitor_id [::String] - # Required. A unique identifier for tracking visitors. For example, this - # could be implemented with an HTTP cookie, which should be able to uniquely - # identify a visitor on a single device. This unique identifier should not - # change if the visitor logs in or out of the website. - # - # This should be the same identifier as - # {::Google::Cloud::Retail::V2::UserEvent#visitor_id UserEvent.visitor_id}. - # - # The field must be a UTF-8 encoded string with a length limit of 128 - # characters. Otherwise, an INVALID_ARGUMENT error is returned. - # @param user_info [::Google::Cloud::Retail::V2::UserInfo, ::Hash] - # Optional. User information. - # @param conversational_filtering_spec [::Google::Cloud::Retail::V2::ConversationalSearchRequest::ConversationalFilteringSpec, ::Hash] - # Optional. This field specifies all conversational filtering related - # parameters. - # @param user_labels [::Hash{::String => ::String}] - # Optional. The user labels applied to a resource must meet the following - # requirements: - # - # * Each resource can have multiple labels, up to a maximum of 64. - # * Each label must be a key-value pair. - # * Keys have a minimum length of 1 character and a maximum length of 63 - # characters and cannot be empty. Values can be empty and have a maximum - # length of 63 characters. - # * Keys and values can contain only lowercase letters, numeric characters, - # underscores, and dashes. All characters must use UTF-8 encoding, and - # international characters are allowed. - # * The key portion of a label must be unique. However, you can use the same - # key with multiple resources. - # * Keys must start with a lowercase letter or international character. - # - # See [Google Cloud - # Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) - # for more details. - # @param safety_settings [::Array<::Google::Cloud::Retail::V2::SafetySetting, ::Hash>] - # Optional. The safety settings to be applied to the generated content. - # @return [::Enumerable<::Google::Cloud::Retail::V2::ConversationalSearchResponse>] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ConversationalSearchService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::ConversationalSearchRequest.new - # - # # Call the conversational_search method to start streaming. - # output = client.conversational_search request - # - # # The returned object is a streamed enumerable yielding elements of type - # # ::Google::Cloud::Retail::V2::ConversationalSearchResponse - # output.each do |current_response| - # p current_response - # end - # - def conversational_search request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ConversationalSearchRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.conversational_search.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.conversational_search.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.conversational_search.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - ::Gapic::Rest::ServerStream.new( - ::Google::Cloud::Retail::V2::ConversationalSearchResponse, - ::Gapic::Rest::ThreadedEnumerator.new do |in_q, out_q| - @conversational_search_service_stub.conversational_search request, options do |chunk| - in_q.deq - out_q.enq chunk - end - end - ) - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Configuration class for the ConversationalSearchService REST API. - # - # This class represents the configuration for ConversationalSearchService REST, - # providing control over timeouts, retry behavior, logging, transport - # parameters, and other low-level controls. Certain parameters can also be - # applied individually to specific RPCs. See - # {::Google::Cloud::Retail::V2::ConversationalSearchService::Rest::Client::Configuration::Rpcs} - # for a list of RPCs that can be configured independently. - # - # Configuration can be applied globally to all clients, or to a single client - # on construction. - # - # @example - # - # # Modify the global config, setting the timeout for - # # conversational_search to 20 seconds, - # # and all remaining timeouts to 10 seconds. - # ::Google::Cloud::Retail::V2::ConversationalSearchService::Rest::Client.configure do |config| - # config.timeout = 10.0 - # config.rpcs.conversational_search.timeout = 20.0 - # end - # - # # Apply the above configuration only to a new client. - # client = ::Google::Cloud::Retail::V2::ConversationalSearchService::Rest::Client.new do |config| - # config.timeout = 10.0 - # config.rpcs.conversational_search.timeout = 20.0 - # end - # - # @!attribute [rw] endpoint - # A custom service endpoint, as a hostname or hostname:port. The default is - # nil, indicating to use the default endpoint in the current universe domain. - # @return [::String,nil] - # @!attribute [rw] credentials - # Credentials to send with calls. You may provide any of the following types: - # * (`String`) The path to a service account key file in JSON format - # * (`Hash`) A service account key as a Hash - # * (`Google::Auth::Credentials`) A googleauth credentials object - # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) - # * (`Signet::OAuth2::Client`) A signet oauth2 client object - # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) - # * (`nil`) indicating no credentials - # - # Warning: If you accept a credential configuration (JSON file or Hash) from an - # external source for authentication to Google Cloud, you must validate it before - # providing it to a Google API client library. Providing an unvalidated credential - # configuration to Google APIs can compromise the security of your systems and data. - # For more information, refer to [Validate credential configurations from external - # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). - # @return [::Object] - # @!attribute [rw] scope - # The OAuth scopes - # @return [::Array<::String>] - # @!attribute [rw] lib_name - # The library name as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] lib_version - # The library version as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] timeout - # The call timeout in seconds. - # @return [::Numeric] - # @!attribute [rw] metadata - # Additional headers to be sent with the call. - # @return [::Hash{::Symbol=>::String}] - # @!attribute [rw] retry_policy - # The retry policy. The value is a hash with the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # @return [::Hash] - # @!attribute [rw] quota_project - # A separate project against which to charge quota. - # @return [::String] - # @!attribute [rw] universe_domain - # The universe domain within which to make requests. This determines the - # default endpoint URL. The default value of nil uses the environment - # universe (usually the default "googleapis.com" universe). - # @return [::String,nil] - # @!attribute [rw] logger - # A custom logger to use for request/response debug logging, or the value - # `:default` (the default) to construct a default logger, or `nil` to - # explicitly disable logging. - # @return [::Logger,:default,nil] - # - class Configuration - extend ::Gapic::Config - - # @private - # The endpoint specific to the default "googleapis.com" universe. Deprecated. - DEFAULT_ENDPOINT = "retail.googleapis.com" - - config_attr :endpoint, nil, ::String, nil - config_attr :credentials, nil do |value| - allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] - allowed.any? { |klass| klass === value } - end - config_attr :scope, nil, ::String, ::Array, nil - config_attr :lib_name, nil, ::String, nil - config_attr :lib_version, nil, ::String, nil - config_attr :timeout, nil, ::Numeric, nil - config_attr :metadata, nil, ::Hash, nil - config_attr :retry_policy, nil, ::Hash, ::Proc, nil - config_attr :quota_project, nil, ::String, nil - config_attr :universe_domain, nil, ::String, nil - config_attr :logger, :default, ::Logger, nil, :default - - # @private - def initialize parent_config = nil - @parent_config = parent_config unless parent_config.nil? - - yield self if block_given? - end - - ## - # Configurations for individual RPCs - # @return [Rpcs] - # - def rpcs - @rpcs ||= begin - parent_rpcs = nil - parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) - Rpcs.new parent_rpcs - end - end - - ## - # Configuration RPC class for the ConversationalSearchService API. - # - # Includes fields providing the configuration for each RPC in this service. - # Each configuration object is of type `Gapic::Config::Method` and includes - # the following configuration fields: - # - # * `timeout` (*type:* `Numeric`) - The call timeout in seconds - # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers - # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields - # include the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # - class Rpcs - ## - # RPC-specific configuration for `conversational_search` - # @return [::Gapic::Config::Method] - # - attr_reader :conversational_search - - # @private - def initialize parent_rpcs = nil - conversational_search_config = parent_rpcs.conversational_search if parent_rpcs.respond_to? :conversational_search - @conversational_search = ::Gapic::Config::Method.new conversational_search_config - - yield self if block_given? - end - end - end - end - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/rest/service_stub.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/rest/service_stub.rb deleted file mode 100644 index 45338f592c0b..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service/rest/service_stub.rb +++ /dev/null @@ -1,145 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "google/cloud/retail/v2/conversational_search_service_pb" - -module Google - module Cloud - module Retail - module V2 - module ConversationalSearchService - module Rest - ## - # REST service stub for the ConversationalSearchService service. - # Service stub contains baseline method implementations - # including transcoding, making the REST call, and deserialing the response. - # - class ServiceStub - # @private - def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger: - # These require statements are intentionally placed here to initialize - # the REST modules only when it's required. - require "gapic/rest" - - @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, - endpoint_template: endpoint_template, - universe_domain: universe_domain, - credentials: credentials, - numeric_enums: true, - service_name: self.class, - raise_faraday_errors: false, - logger: logger - end - - ## - # The effective universe domain - # - # @return [String] - # - def universe_domain - @client_stub.universe_domain - end - - ## - # The effective endpoint - # - # @return [String] - # - def endpoint - @client_stub.endpoint - end - - ## - # The logger used for request/response debug logging. - # - # @return [Logger] - # - def logger stub: false - stub ? @client_stub.stub_logger : @client_stub.logger - end - - ## - # Baseline implementation for the conversational_search REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::ConversationalSearchRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yieldparam chunk [::String] The chunk of data received during server streaming. - # - # @return [::Gapic::Rest::TransportOperation] - def conversational_search(request_pb, options = nil, &) - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_conversational_search_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "conversational_search", - options: options, - is_server_streaming: true, - & - ) - ::Gapic::Rest::TransportOperation.new response - end - - ## - # @private - # - # GRPC transcoding helper method for the conversational_search REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::ConversationalSearchRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_conversational_search_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :post, - uri_template: "/v2/{placement}:conversationalSearch", - body: "*", - matches: [ - ["placement", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/placements/[^/]+/?$}, false] - ] - ) - .with_bindings( - uri_method: :post, - uri_template: "/v2/{placement}:conversationalSearch", - body: "*", - matches: [ - ["placement", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/servingConfigs/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - end - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service_pb.rb deleted file mode 100644 index 9bdaad5fdf84..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service_pb.rb +++ /dev/null @@ -1,41 +0,0 @@ -# frozen_string_literal: true -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/retail/v2/conversational_search_service.proto - -require 'google/protobuf' - -require 'google/api/annotations_pb' -require 'google/api/client_pb' -require 'google/api/field_behavior_pb' -require 'google/api/resource_pb' -require 'google/cloud/retail/v2/common_pb' -require 'google/cloud/retail/v2/safety_pb' -require 'google/cloud/retail/v2/search_service_pb' - - -descriptor_data = "\n:google/cloud/retail/v2/conversational_search_service.proto\x12\x16google.cloud.retail.v2\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a#google/cloud/retail/v2/common.proto\x1a#google/cloud/retail/v2/safety.proto\x1a+google/cloud/retail/v2/search_service.proto\"\xef\x0b\n\x1b\x43onversationalSearchRequest\x12\x16\n\tplacement\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x34\n\x06\x62ranch\x18\x02 \x01(\tB$\xe0\x41\x02\xfa\x41\x1e\n\x1cretail.googleapis.com/Branch\x12\x12\n\x05query\x18\x03 \x01(\tB\x03\xe0\x41\x01\x12\x1c\n\x0fpage_categories\x18\x04 \x03(\tB\x03\xe0\x41\x01\x12\x1c\n\x0f\x63onversation_id\x18\x05 \x01(\tB\x03\xe0\x41\x01\x12\\\n\rsearch_params\x18\x06 \x01(\x0b\x32@.google.cloud.retail.v2.ConversationalSearchRequest.SearchParamsB\x03\xe0\x41\x01\x12\x17\n\nvisitor_id\x18\t \x01(\tB\x03\xe0\x41\x02\x12\x38\n\tuser_info\x18\x07 \x01(\x0b\x32 .google.cloud.retail.v2.UserInfoB\x03\xe0\x41\x01\x12{\n\x1d\x63onversational_filtering_spec\x18\x08 \x01(\x0b\x32O.google.cloud.retail.v2.ConversationalSearchRequest.ConversationalFilteringSpecB\x03\xe0\x41\x01\x12]\n\x0buser_labels\x18\x0c \x03(\x0b\x32\x43.google.cloud.retail.v2.ConversationalSearchRequest.UserLabelsEntryB\x03\xe0\x41\x01\x12\x43\n\x0fsafety_settings\x18\x0e \x03(\x0b\x32%.google.cloud.retail.v2.SafetySettingB\x03\xe0\x41\x01\x1a\xa2\x01\n\x0cSearchParams\x12\x13\n\x06\x66ilter\x18\x01 \x01(\tB\x03\xe0\x41\x01\x12\x1d\n\x10\x63\x61nonical_filter\x18\x02 \x01(\tB\x03\xe0\x41\x01\x12\x14\n\x07sort_by\x18\x03 \x01(\tB\x03\xe0\x41\x01\x12H\n\nboost_spec\x18\x04 \x01(\x0b\x32/.google.cloud.retail.v2.SearchRequest.BoostSpecB\x03\xe0\x41\x01\x1a\x81\x02\n\nUserAnswer\x12\x15\n\x0btext_answer\x18\x01 \x01(\tH\x00\x12m\n\x0fselected_answer\x18\x02 \x01(\x0b\x32M.google.cloud.retail.v2.ConversationalSearchRequest.UserAnswer.SelectedAnswerB\x03\xe0\x41\x01H\x00\x1a\x65\n\x0eSelectedAnswer\x12S\n\x17product_attribute_value\x18\x01 \x01(\x0b\x32-.google.cloud.retail.v2.ProductAttributeValueB\x03\xe0\x41\x01\x42\x06\n\x04type\x1a\x83\x03\n\x1b\x43onversationalFilteringSpec\x12.\n\x1f\x65nable_conversational_filtering\x18\x01 \x01(\x08\x42\x05\x18\x01\xe0\x41\x01\x12X\n\x0buser_answer\x18\x02 \x01(\x0b\x32>.google.cloud.retail.v2.ConversationalSearchRequest.UserAnswerB\x03\xe0\x41\x01\x12\x80\x01\n\x1d\x63onversational_filtering_mode\x18\x04 \x01(\x0e\x32T.google.cloud.retail.v2.ConversationalSearchRequest.ConversationalFilteringSpec.ModeB\x03\xe0\x41\x01\"W\n\x04Mode\x12\x14\n\x10MODE_UNSPECIFIED\x10\x00\x12\x0c\n\x08\x44ISABLED\x10\x01\x12\x0b\n\x07\x45NABLED\x10\x02\x12\x1e\n\x1a\x43ONVERSATIONAL_FILTER_ONLY\x10\x03\x1a\x31\n\x0fUserLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"\xcd\t\n\x1c\x43onversationalSearchResponse\x12\x18\n\x10user_query_types\x18\n \x03(\t\x12$\n\x1c\x63onversational_text_response\x18\x02 \x01(\t\x12`\n\x11\x66ollowup_question\x18\x03 \x01(\x0b\x32\x45.google.cloud.retail.v2.ConversationalSearchResponse.FollowupQuestion\x12\x17\n\x0f\x63onversation_id\x18\x04 \x01(\t\x12Z\n\x0erefined_search\x18\x06 \x03(\x0b\x32\x42.google.cloud.retail.v2.ConversationalSearchResponse.RefinedSearch\x12{\n\x1f\x63onversational_filtering_result\x18\x07 \x01(\x0b\x32R.google.cloud.retail.v2.ConversationalSearchResponse.ConversationalFilteringResult\x12N\n\x05state\x18\t \x01(\x0e\x32:.google.cloud.retail.v2.ConversationalSearchResponse.StateB\x03\xe0\x41\x03\x1a\x82\x02\n\x10\x46ollowupQuestion\x12\x19\n\x11\x66ollowup_question\x18\x01 \x01(\t\x12p\n\x11suggested_answers\x18\x02 \x03(\x0b\x32U.google.cloud.retail.v2.ConversationalSearchResponse.FollowupQuestion.SuggestedAnswer\x1a\x61\n\x0fSuggestedAnswer\x12N\n\x17product_attribute_value\x18\x01 \x01(\x0b\x32-.google.cloud.retail.v2.ProductAttributeValue\x1a\x1e\n\rRefinedSearch\x12\r\n\x05query\x18\x01 \x01(\t\x1a\xe5\x02\n\x1d\x43onversationalFilteringResult\x12`\n\x11\x66ollowup_question\x18\x01 \x01(\x0b\x32\x45.google.cloud.retail.v2.ConversationalSearchResponse.FollowupQuestion\x12~\n\x11\x61\x64\x64itional_filter\x18\x02 \x01(\x0b\x32\x63.google.cloud.retail.v2.ConversationalSearchResponse.ConversationalFilteringResult.AdditionalFilter\x1a\x62\n\x10\x41\x64\x64itionalFilter\x12N\n\x17product_attribute_value\x18\x01 \x01(\x0b\x32-.google.cloud.retail.v2.ProductAttributeValue\"<\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\r\n\tSTREAMING\x10\x01\x12\r\n\tSUCCEEDED\x10\x02\x32\xae\x03\n\x1b\x43onversationalSearchService\x12\xc3\x02\n\x14\x43onversationalSearch\x12\x33.google.cloud.retail.v2.ConversationalSearchRequest\x1a\x34.google.cloud.retail.v2.ConversationalSearchResponse\"\xbd\x01\x82\xd3\xe4\x93\x02\xb6\x01\"S/v2/{placement=projects/*/locations/*/catalogs/*/placements/*}:conversationalSearch:\x01*Z\\\"W/v2/{placement=projects/*/locations/*/catalogs/*/servingConfigs/*}:conversationalSearch:\x01*0\x01\x1aI\xca\x41\x15retail.googleapis.com\xd2\x41.https://www.googleapis.com/auth/cloud-platformB\xcb\x01\n\x1a\x63om.google.cloud.retail.v2B ConversationalSearchServiceProtoP\x01Z2cloud.google.com/go/retail/apiv2/retailpb;retailpb\xa2\x02\x06RETAIL\xaa\x02\x16Google.Cloud.Retail.V2\xca\x02\x16Google\\Cloud\\Retail\\V2\xea\x02\x19Google::Cloud::Retail::V2b\x06proto3" - -pool = ::Google::Protobuf::DescriptorPool.generated_pool -pool.add_serialized_file(descriptor_data) - -module Google - module Cloud - module Retail - module V2 - ConversationalSearchRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ConversationalSearchRequest").msgclass - ConversationalSearchRequest::SearchParams = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ConversationalSearchRequest.SearchParams").msgclass - ConversationalSearchRequest::UserAnswer = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ConversationalSearchRequest.UserAnswer").msgclass - ConversationalSearchRequest::UserAnswer::SelectedAnswer = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ConversationalSearchRequest.UserAnswer.SelectedAnswer").msgclass - ConversationalSearchRequest::ConversationalFilteringSpec = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ConversationalSearchRequest.ConversationalFilteringSpec").msgclass - ConversationalSearchRequest::ConversationalFilteringSpec::Mode = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ConversationalSearchRequest.ConversationalFilteringSpec.Mode").enummodule - ConversationalSearchResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ConversationalSearchResponse").msgclass - ConversationalSearchResponse::FollowupQuestion = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ConversationalSearchResponse.FollowupQuestion").msgclass - ConversationalSearchResponse::FollowupQuestion::SuggestedAnswer = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ConversationalSearchResponse.FollowupQuestion.SuggestedAnswer").msgclass - ConversationalSearchResponse::RefinedSearch = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ConversationalSearchResponse.RefinedSearch").msgclass - ConversationalSearchResponse::ConversationalFilteringResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ConversationalSearchResponse.ConversationalFilteringResult").msgclass - ConversationalSearchResponse::ConversationalFilteringResult::AdditionalFilter = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ConversationalSearchResponse.ConversationalFilteringResult.AdditionalFilter").msgclass - ConversationalSearchResponse::State = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ConversationalSearchResponse.State").enummodule - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service_services_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service_services_pb.rb deleted file mode 100644 index f89ba3e94889..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/conversational_search_service_services_pb.rb +++ /dev/null @@ -1,52 +0,0 @@ -# Generated by the protocol buffer compiler. DO NOT EDIT! -# Source: google/cloud/retail/v2/conversational_search_service.proto for package 'Google.Cloud.Retail.V2' -# Original file comments: -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -require 'grpc' -require 'google/cloud/retail/v2/conversational_search_service_pb' - -module Google - module Cloud - module Retail - module V2 - module ConversationalSearchService - # Service for retail conversational search. - # - # This feature is only available for users who have Retail Conversational - # Search enabled. Enable Retail Conversational Search on Cloud Console - # before using this feature. - class Service - - include ::GRPC::GenericService - - self.marshal_class_method = :encode - self.unmarshal_class_method = :decode - self.service_name = 'google.cloud.retail.v2.ConversationalSearchService' - - # Performs a conversational search. - # - # This feature is only available for users who have Conversational Search - # enabled. - rpc :ConversationalSearch, ::Google::Cloud::Retail::V2::ConversationalSearchRequest, stream(::Google::Cloud::Retail::V2::ConversationalSearchResponse) - end - - Stub = Service.rpc_stub_class - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/export_config_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/export_config_pb.rb deleted file mode 100644 index 0799bfb12534..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/export_config_pb.rb +++ /dev/null @@ -1,35 +0,0 @@ -# frozen_string_literal: true -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/retail/v2/export_config.proto - -require 'google/protobuf' - -require 'google/api/field_behavior_pb' -require 'google/api/resource_pb' -require 'google/protobuf/timestamp_pb' -require 'google/rpc/status_pb' - - -descriptor_data = "\n*google/cloud/retail/v2/export_config.proto\x12\x16google.cloud.retail.v2\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x17google/rpc/status.proto\"\xe0\x02\n\x0cOutputConfig\x12N\n\x0fgcs_destination\x18\x01 \x01(\x0b\x32\x33.google.cloud.retail.v2.OutputConfig.GcsDestinationH\x00\x12X\n\x14\x62igquery_destination\x18\x02 \x01(\x0b\x32\x38.google.cloud.retail.v2.OutputConfig.BigQueryDestinationH\x00\x1a\x30\n\x0eGcsDestination\x12\x1e\n\x11output_uri_prefix\x18\x01 \x01(\tB\x03\xe0\x41\x02\x1a\x65\n\x13\x42igQueryDestination\x12\x17\n\ndataset_id\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x1c\n\x0ftable_id_prefix\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\x17\n\ntable_type\x18\x03 \x01(\tB\x03\xe0\x41\x02\x42\r\n\x0b\x64\x65stination\"9\n\x12\x45xportErrorsConfig\x12\x14\n\ngcs_prefix\x18\x01 \x01(\tH\x00\x42\r\n\x0b\x64\x65stination\"\x87\x01\n\x1d\x45xportAnalyticsMetricsRequest\x12\x14\n\x07\x63\x61talog\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12@\n\routput_config\x18\x02 \x01(\x0b\x32$.google.cloud.retail.v2.OutputConfigB\x03\xe0\x41\x02\x12\x0e\n\x06\x66ilter\x18\x03 \x01(\t\"r\n\x0e\x45xportMetadata\x12/\n\x0b\x63reate_time\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12/\n\x0bupdate_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"\xcb\x01\n\x1e\x45xportAnalyticsMetricsResponse\x12)\n\rerror_samples\x18\x01 \x03(\x0b\x32\x12.google.rpc.Status\x12\x41\n\rerrors_config\x18\x02 \x01(\x0b\x32*.google.cloud.retail.v2.ExportErrorsConfig\x12;\n\routput_result\x18\x03 \x01(\x0b\x32$.google.cloud.retail.v2.OutputResult\"\x92\x01\n\x0cOutputResult\x12\x45\n\x0f\x62igquery_result\x18\x01 \x03(\x0b\x32,.google.cloud.retail.v2.BigQueryOutputResult\x12;\n\ngcs_result\x18\x02 \x03(\x0b\x32\'.google.cloud.retail.v2.GcsOutputResult\"<\n\x14\x42igQueryOutputResult\x12\x12\n\ndataset_id\x18\x01 \x01(\t\x12\x10\n\x08table_id\x18\x02 \x01(\t\"%\n\x0fGcsOutputResult\x12\x12\n\noutput_uri\x18\x01 \x01(\tB\xbc\x01\n\x1a\x63om.google.cloud.retail.v2B\x11\x45xportConfigProtoP\x01Z2cloud.google.com/go/retail/apiv2/retailpb;retailpb\xa2\x02\x06RETAIL\xaa\x02\x16Google.Cloud.Retail.V2\xca\x02\x16Google\\Cloud\\Retail\\V2\xea\x02\x19Google::Cloud::Retail::V2b\x06proto3" - -pool = ::Google::Protobuf::DescriptorPool.generated_pool -pool.add_serialized_file(descriptor_data) - -module Google - module Cloud - module Retail - module V2 - OutputConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.OutputConfig").msgclass - OutputConfig::GcsDestination = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.OutputConfig.GcsDestination").msgclass - OutputConfig::BigQueryDestination = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.OutputConfig.BigQueryDestination").msgclass - ExportErrorsConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ExportErrorsConfig").msgclass - ExportAnalyticsMetricsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ExportAnalyticsMetricsRequest").msgclass - ExportMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ExportMetadata").msgclass - ExportAnalyticsMetricsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ExportAnalyticsMetricsResponse").msgclass - OutputResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.OutputResult").msgclass - BigQueryOutputResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.BigQueryOutputResult").msgclass - GcsOutputResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.GcsOutputResult").msgclass - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_pb.rb deleted file mode 100644 index 39063cf59e06..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_pb.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/retail/v2/generative_question.proto - -require 'google/protobuf' - -require 'google/api/field_behavior_pb' - - -descriptor_data = "\n0google/cloud/retail/v2/generative_question.proto\x12\x16google.cloud.retail.v2\x1a\x1fgoogle/api/field_behavior.proto\"u\n GenerativeQuestionsFeatureConfig\x12\x14\n\x07\x63\x61talog\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x1c\n\x0f\x66\x65\x61ture_enabled\x18\x02 \x01(\x08\x42\x03\xe0\x41\x01\x12\x1d\n\x10minimum_products\x18\x03 \x01(\x05\x42\x03\xe0\x41\x01\"\xdd\x01\n\x18GenerativeQuestionConfig\x12\x14\n\x07\x63\x61talog\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x12\n\x05\x66\x61\x63\x65t\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\x1f\n\x12generated_question\x18\x03 \x01(\tB\x03\xe0\x41\x03\x12\x1b\n\x0e\x66inal_question\x18\x04 \x01(\tB\x03\xe0\x41\x01\x12\x1b\n\x0e\x65xample_values\x18\x05 \x03(\tB\x03\xe0\x41\x03\x12\x16\n\tfrequency\x18\x06 \x01(\x02\x42\x03\xe0\x41\x03\x12$\n\x17\x61llowed_in_conversation\x18\x07 \x01(\x08\x42\x03\xe0\x41\x01\x42\xc2\x01\n\x1a\x63om.google.cloud.retail.v2B\x17GenerativeQuestionProtoP\x01Z2cloud.google.com/go/retail/apiv2/retailpb;retailpb\xa2\x02\x06RETAIL\xaa\x02\x16Google.Cloud.Retail.V2\xca\x02\x16Google\\Cloud\\Retail\\V2\xea\x02\x19Google::Cloud::Retail::V2b\x06proto3" - -pool = ::Google::Protobuf::DescriptorPool.generated_pool -pool.add_serialized_file(descriptor_data) - -module Google - module Cloud - module Retail - module V2 - GenerativeQuestionsFeatureConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.GenerativeQuestionsFeatureConfig").msgclass - GenerativeQuestionConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.GenerativeQuestionConfig").msgclass - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service.rb deleted file mode 100644 index 820d713f4e45..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service.rb +++ /dev/null @@ -1,55 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "gapic/common" -require "gapic/config" -require "gapic/config/method" - -require "google/cloud/retail/v2/version" - -require "google/cloud/retail/v2/generative_question_service/credentials" -require "google/cloud/retail/v2/generative_question_service/paths" -require "google/cloud/retail/v2/generative_question_service/client" -require "google/cloud/retail/v2/generative_question_service/rest" - -module Google - module Cloud - module Retail - module V2 - ## - # Service for managing LLM generated questions in search serving. - # - # @example Load this service and instantiate a gRPC client - # - # require "google/cloud/retail/v2/generative_question_service" - # client = ::Google::Cloud::Retail::V2::GenerativeQuestionService::Client.new - # - # @example Load this service and instantiate a REST client - # - # require "google/cloud/retail/v2/generative_question_service/rest" - # client = ::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client.new - # - module GenerativeQuestionService - end - end - end - end -end - -helper_path = ::File.join __dir__, "generative_question_service", "helpers.rb" -require "google/cloud/retail/v2/generative_question_service/helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/client.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/client.rb deleted file mode 100644 index de3a2a9764ad..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/client.rb +++ /dev/null @@ -1,879 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "google/cloud/errors" -require "google/cloud/retail/v2/generative_question_service_pb" -require "google/cloud/location" - -module Google - module Cloud - module Retail - module V2 - module GenerativeQuestionService - ## - # Client for the GenerativeQuestionService service. - # - # Service for managing LLM generated questions in search serving. - # - class Client - # @private - API_VERSION = "" - - # @private - DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" - - include Paths - - # @private - attr_reader :generative_question_service_stub - - ## - # Configure the GenerativeQuestionService Client class. - # - # See {::Google::Cloud::Retail::V2::GenerativeQuestionService::Client::Configuration} - # for a description of the configuration fields. - # - # @example - # - # # Modify the configuration for all GenerativeQuestionService clients - # ::Google::Cloud::Retail::V2::GenerativeQuestionService::Client.configure do |config| - # config.timeout = 10.0 - # end - # - # @yield [config] Configure the Client client. - # @yieldparam config [Client::Configuration] - # - # @return [Client::Configuration] - # - def self.configure - @configure ||= begin - namespace = ["Google", "Cloud", "Retail", "V2"] - parent_config = while namespace.any? - parent_name = namespace.join "::" - parent_const = const_get parent_name - break parent_const.configure if parent_const.respond_to? :configure - namespace.pop - end - default_config = Client::Configuration.new parent_config - - default_config - end - yield @configure if block_given? - @configure - end - - ## - # Configure the GenerativeQuestionService Client instance. - # - # The configuration is set to the derived mode, meaning that values can be changed, - # but structural changes (adding new fields, etc.) are not allowed. Structural changes - # should be made on {Client.configure}. - # - # See {::Google::Cloud::Retail::V2::GenerativeQuestionService::Client::Configuration} - # for a description of the configuration fields. - # - # @yield [config] Configure the Client client. - # @yieldparam config [Client::Configuration] - # - # @return [Client::Configuration] - # - def configure - yield @config if block_given? - @config - end - - ## - # The effective universe domain - # - # @return [String] - # - def universe_domain - @generative_question_service_stub.universe_domain - end - - ## - # Create a new GenerativeQuestionService client object. - # - # @example - # - # # Create a client using the default configuration - # client = ::Google::Cloud::Retail::V2::GenerativeQuestionService::Client.new - # - # # Create a client using a custom configuration - # client = ::Google::Cloud::Retail::V2::GenerativeQuestionService::Client.new do |config| - # config.timeout = 10.0 - # end - # - # @yield [config] Configure the GenerativeQuestionService client. - # @yieldparam config [Client::Configuration] - # - def initialize - # These require statements are intentionally placed here to initialize - # the gRPC module only when it's required. - # See https://github.com/googleapis/toolkit/issues/446 - require "gapic/grpc" - require "google/cloud/retail/v2/generative_question_service_services_pb" - - # Create the configuration object - @config = Configuration.new Client.configure - - # Yield the configuration if needed - yield @config if block_given? - - # Create credentials - credentials = @config.credentials - # Use self-signed JWT if the endpoint is unchanged from default, - # but only if the default endpoint does not have a region prefix. - enable_self_signed_jwt = @config.endpoint.nil? || - (@config.endpoint == Configuration::DEFAULT_ENDPOINT && - !@config.endpoint.split(".").first.include?("-")) - credentials ||= Credentials.default scope: @config.scope, - enable_self_signed_jwt: enable_self_signed_jwt - if credentials.is_a?(::String) || credentials.is_a?(::Hash) - credentials = Credentials.new credentials, scope: @config.scope - end - @quota_project_id = @config.quota_project - @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id - - @generative_question_service_stub = ::Gapic::ServiceStub.new( - ::Google::Cloud::Retail::V2::GenerativeQuestionService::Stub, - credentials: credentials, - endpoint: @config.endpoint, - endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, - universe_domain: @config.universe_domain, - channel_args: @config.channel_args, - interceptors: @config.interceptors, - channel_pool_config: @config.channel_pool, - logger: @config.logger - ) - - @generative_question_service_stub.stub_logger&.info do |entry| - entry.set_system_name - entry.set_service - entry.message = "Created client for #{entry.service}" - entry.set_credentials_fields credentials - entry.set "customEndpoint", @config.endpoint if @config.endpoint - entry.set "defaultTimeout", @config.timeout if @config.timeout - entry.set "quotaProject", @quota_project_id if @quota_project_id - end - - @location_client = Google::Cloud::Location::Locations::Client.new do |config| - config.credentials = credentials - config.quota_project = @quota_project_id - config.endpoint = @generative_question_service_stub.endpoint - config.universe_domain = @generative_question_service_stub.universe_domain - config.logger = @generative_question_service_stub.logger if config.respond_to? :logger= - end - end - - ## - # Get the associated client for mix-in of the Locations. - # - # @return [Google::Cloud::Location::Locations::Client] - # - attr_reader :location_client - - ## - # The logger used for request/response debug logging. - # - # @return [Logger] - # - def logger - @generative_question_service_stub.logger - end - - # Service calls - - ## - # Manages overal generative question feature state -- enables toggling - # feature on and off. - # - # @overload update_generative_questions_feature_config(request, options = nil) - # Pass arguments to `update_generative_questions_feature_config` via a request object, either of type - # {::Google::Cloud::Retail::V2::UpdateGenerativeQuestionsFeatureConfigRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::UpdateGenerativeQuestionsFeatureConfigRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload update_generative_questions_feature_config(generative_questions_feature_config: nil, update_mask: nil) - # Pass arguments to `update_generative_questions_feature_config` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param generative_questions_feature_config [::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig, ::Hash] - # Required. The configuration managing the feature state. - # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] - # Optional. Indicates which fields in the provided - # {::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig GenerativeQuestionsFeatureConfig} - # to update. If not set or empty, all supported fields are updated. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::GenerativeQuestionService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::UpdateGenerativeQuestionsFeatureConfigRequest.new - # - # # Call the update_generative_questions_feature_config method. - # result = client.update_generative_questions_feature_config request - # - # # The returned object is of type Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig. - # p result - # - def update_generative_questions_feature_config request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::UpdateGenerativeQuestionsFeatureConfigRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.update_generative_questions_feature_config.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.generative_questions_feature_config&.catalog - header_params["generative_questions_feature_config.catalog"] = request.generative_questions_feature_config.catalog - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.update_generative_questions_feature_config.timeout, - metadata: metadata, - retry_policy: @config.rpcs.update_generative_questions_feature_config.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @generative_question_service_stub.call_rpc :update_generative_questions_feature_config, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Manages overal generative question feature state -- enables toggling - # feature on and off. - # - # @overload get_generative_questions_feature_config(request, options = nil) - # Pass arguments to `get_generative_questions_feature_config` via a request object, either of type - # {::Google::Cloud::Retail::V2::GetGenerativeQuestionsFeatureConfigRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::GetGenerativeQuestionsFeatureConfigRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload get_generative_questions_feature_config(catalog: nil) - # Pass arguments to `get_generative_questions_feature_config` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param catalog [::String] - # Required. Resource name of the parent catalog. - # Format: projects/\\{project}/locations/\\{location}/catalogs/\\{catalog} - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::GenerativeQuestionService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::GetGenerativeQuestionsFeatureConfigRequest.new - # - # # Call the get_generative_questions_feature_config method. - # result = client.get_generative_questions_feature_config request - # - # # The returned object is of type Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig. - # p result - # - def get_generative_questions_feature_config request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::GetGenerativeQuestionsFeatureConfigRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.get_generative_questions_feature_config.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.catalog - header_params["catalog"] = request.catalog - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.get_generative_questions_feature_config.timeout, - metadata: metadata, - retry_policy: @config.rpcs.get_generative_questions_feature_config.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @generative_question_service_stub.call_rpc :get_generative_questions_feature_config, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Returns all questions for a given catalog. - # - # @overload list_generative_question_configs(request, options = nil) - # Pass arguments to `list_generative_question_configs` via a request object, either of type - # {::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload list_generative_question_configs(parent: nil) - # Pass arguments to `list_generative_question_configs` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. Resource name of the parent catalog. - # Format: projects/\\{project}/locations/\\{location}/catalogs/\\{catalog} - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsResponse] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsResponse] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::GenerativeQuestionService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsRequest.new - # - # # Call the list_generative_question_configs method. - # result = client.list_generative_question_configs request - # - # # The returned object is of type Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsResponse. - # p result - # - def list_generative_question_configs request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.list_generative_question_configs.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.parent - header_params["parent"] = request.parent - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.list_generative_question_configs.timeout, - metadata: metadata, - retry_policy: @config.rpcs.list_generative_question_configs.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @generative_question_service_stub.call_rpc :list_generative_question_configs, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Allows management of individual questions. - # - # @overload update_generative_question_config(request, options = nil) - # Pass arguments to `update_generative_question_config` via a request object, either of type - # {::Google::Cloud::Retail::V2::UpdateGenerativeQuestionConfigRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::UpdateGenerativeQuestionConfigRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload update_generative_question_config(generative_question_config: nil, update_mask: nil) - # Pass arguments to `update_generative_question_config` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param generative_question_config [::Google::Cloud::Retail::V2::GenerativeQuestionConfig, ::Hash] - # Required. The question to update. - # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] - # Optional. Indicates which fields in the provided - # {::Google::Cloud::Retail::V2::GenerativeQuestionConfig GenerativeQuestionConfig} - # to update. The following are NOT supported: - # - # * {::Google::Cloud::Retail::V2::GenerativeQuestionConfig#frequency GenerativeQuestionConfig.frequency} - # - # If not set or empty, all supported fields are updated. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Cloud::Retail::V2::GenerativeQuestionConfig] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Cloud::Retail::V2::GenerativeQuestionConfig] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::GenerativeQuestionService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::UpdateGenerativeQuestionConfigRequest.new - # - # # Call the update_generative_question_config method. - # result = client.update_generative_question_config request - # - # # The returned object is of type Google::Cloud::Retail::V2::GenerativeQuestionConfig. - # p result - # - def update_generative_question_config request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::UpdateGenerativeQuestionConfigRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.update_generative_question_config.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.generative_question_config&.catalog - header_params["generative_question_config.catalog"] = request.generative_question_config.catalog - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.update_generative_question_config.timeout, - metadata: metadata, - retry_policy: @config.rpcs.update_generative_question_config.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @generative_question_service_stub.call_rpc :update_generative_question_config, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Allows management of multiple questions. - # - # @overload batch_update_generative_question_configs(request, options = nil) - # Pass arguments to `batch_update_generative_question_configs` via a request object, either of type - # {::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload batch_update_generative_question_configs(parent: nil, requests: nil) - # Pass arguments to `batch_update_generative_question_configs` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Optional. Resource name of the parent catalog. - # Format: projects/\\{project}/locations/\\{location}/catalogs/\\{catalog} - # @param requests [::Array<::Google::Cloud::Retail::V2::UpdateGenerativeQuestionConfigRequest, ::Hash>] - # Required. The updates question configs. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsResponse] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsResponse] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::GenerativeQuestionService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsRequest.new - # - # # Call the batch_update_generative_question_configs method. - # result = client.batch_update_generative_question_configs request - # - # # The returned object is of type Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsResponse. - # p result - # - def batch_update_generative_question_configs request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.batch_update_generative_question_configs.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.parent - header_params["parent"] = request.parent - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.batch_update_generative_question_configs.timeout, - metadata: metadata, - retry_policy: @config.rpcs.batch_update_generative_question_configs.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @generative_question_service_stub.call_rpc :batch_update_generative_question_configs, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Configuration class for the GenerativeQuestionService API. - # - # This class represents the configuration for GenerativeQuestionService, - # providing control over timeouts, retry behavior, logging, transport - # parameters, and other low-level controls. Certain parameters can also be - # applied individually to specific RPCs. See - # {::Google::Cloud::Retail::V2::GenerativeQuestionService::Client::Configuration::Rpcs} - # for a list of RPCs that can be configured independently. - # - # Configuration can be applied globally to all clients, or to a single client - # on construction. - # - # @example - # - # # Modify the global config, setting the timeout for - # # update_generative_questions_feature_config to 20 seconds, - # # and all remaining timeouts to 10 seconds. - # ::Google::Cloud::Retail::V2::GenerativeQuestionService::Client.configure do |config| - # config.timeout = 10.0 - # config.rpcs.update_generative_questions_feature_config.timeout = 20.0 - # end - # - # # Apply the above configuration only to a new client. - # client = ::Google::Cloud::Retail::V2::GenerativeQuestionService::Client.new do |config| - # config.timeout = 10.0 - # config.rpcs.update_generative_questions_feature_config.timeout = 20.0 - # end - # - # @!attribute [rw] endpoint - # A custom service endpoint, as a hostname or hostname:port. The default is - # nil, indicating to use the default endpoint in the current universe domain. - # @return [::String,nil] - # @!attribute [rw] credentials - # Credentials to send with calls. You may provide any of the following types: - # * (`Google::Auth::Credentials`) A googleauth credentials object - # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) - # * (`Signet::OAuth2::Client`) A signet oauth2 client object - # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) - # * (`GRPC::Core::Channel`) a gRPC channel with included credentials - # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object - # * (`nil`) indicating no credentials - # - # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials - # is deprecated. Providing an unvalidated credential configuration to - # Google APIs can compromise the security of your systems and data. - # - # @example - # - # # The recommended way to provide credentials is to use the `make_creds` method - # # on the appropriate credentials class for your environment. - # - # require "googleauth" - # - # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds( - # json_key_io: ::File.open("/path/to/keyfile.json") - # ) - # - # client = ::Google::Cloud::Retail::V2::GenerativeQuestionService::Client.new do |config| - # config.credentials = credentials - # end - # - # @note Warning: If you accept a credential configuration (JSON file or Hash) from an - # external source for authentication to Google Cloud, you must validate it before - # providing it to a Google API client library. Providing an unvalidated credential - # configuration to Google APIs can compromise the security of your systems and data. - # For more information, refer to [Validate credential configurations from external - # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). - # @return [::Object] - # @!attribute [rw] scope - # The OAuth scopes - # @return [::Array<::String>] - # @!attribute [rw] lib_name - # The library name as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] lib_version - # The library version as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] channel_args - # Extra parameters passed to the gRPC channel. Note: this is ignored if a - # `GRPC::Core::Channel` object is provided as the credential. - # @return [::Hash] - # @!attribute [rw] interceptors - # An array of interceptors that are run before calls are executed. - # @return [::Array<::GRPC::ClientInterceptor>] - # @!attribute [rw] timeout - # The call timeout in seconds. - # @return [::Numeric] - # @!attribute [rw] metadata - # Additional gRPC headers to be sent with the call. - # @return [::Hash{::Symbol=>::String}] - # @!attribute [rw] retry_policy - # The retry policy. The value is a hash with the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # @return [::Hash] - # @!attribute [rw] quota_project - # A separate project against which to charge quota. - # @return [::String] - # @!attribute [rw] universe_domain - # The universe domain within which to make requests. This determines the - # default endpoint URL. The default value of nil uses the environment - # universe (usually the default "googleapis.com" universe). - # @return [::String,nil] - # @!attribute [rw] logger - # A custom logger to use for request/response debug logging, or the value - # `:default` (the default) to construct a default logger, or `nil` to - # explicitly disable logging. - # @return [::Logger,:default,nil] - # - class Configuration - extend ::Gapic::Config - - # @private - # The endpoint specific to the default "googleapis.com" universe. Deprecated. - DEFAULT_ENDPOINT = "retail.googleapis.com" - - config_attr :endpoint, nil, ::String, nil - config_attr :credentials, nil do |value| - allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] - allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel - allowed.any? { |klass| klass === value } - end - config_attr :scope, nil, ::String, ::Array, nil - config_attr :lib_name, nil, ::String, nil - config_attr :lib_version, nil, ::String, nil - config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) - config_attr :interceptors, nil, ::Array, nil - config_attr :timeout, nil, ::Numeric, nil - config_attr :metadata, nil, ::Hash, nil - config_attr :retry_policy, nil, ::Hash, ::Proc, nil - config_attr :quota_project, nil, ::String, nil - config_attr :universe_domain, nil, ::String, nil - config_attr :logger, :default, ::Logger, nil, :default - - # @private - def initialize parent_config = nil - @parent_config = parent_config unless parent_config.nil? - - yield self if block_given? - end - - ## - # Configurations for individual RPCs - # @return [Rpcs] - # - def rpcs - @rpcs ||= begin - parent_rpcs = nil - parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) - Rpcs.new parent_rpcs - end - end - - ## - # Configuration for the channel pool - # @return [::Gapic::ServiceStub::ChannelPool::Configuration] - # - def channel_pool - @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new - end - - ## - # Configuration RPC class for the GenerativeQuestionService API. - # - # Includes fields providing the configuration for each RPC in this service. - # Each configuration object is of type `Gapic::Config::Method` and includes - # the following configuration fields: - # - # * `timeout` (*type:* `Numeric`) - The call timeout in seconds - # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers - # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields - # include the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # - class Rpcs - ## - # RPC-specific configuration for `update_generative_questions_feature_config` - # @return [::Gapic::Config::Method] - # - attr_reader :update_generative_questions_feature_config - ## - # RPC-specific configuration for `get_generative_questions_feature_config` - # @return [::Gapic::Config::Method] - # - attr_reader :get_generative_questions_feature_config - ## - # RPC-specific configuration for `list_generative_question_configs` - # @return [::Gapic::Config::Method] - # - attr_reader :list_generative_question_configs - ## - # RPC-specific configuration for `update_generative_question_config` - # @return [::Gapic::Config::Method] - # - attr_reader :update_generative_question_config - ## - # RPC-specific configuration for `batch_update_generative_question_configs` - # @return [::Gapic::Config::Method] - # - attr_reader :batch_update_generative_question_configs - - # @private - def initialize parent_rpcs = nil - update_generative_questions_feature_config_config = parent_rpcs.update_generative_questions_feature_config if parent_rpcs.respond_to? :update_generative_questions_feature_config - @update_generative_questions_feature_config = ::Gapic::Config::Method.new update_generative_questions_feature_config_config - get_generative_questions_feature_config_config = parent_rpcs.get_generative_questions_feature_config if parent_rpcs.respond_to? :get_generative_questions_feature_config - @get_generative_questions_feature_config = ::Gapic::Config::Method.new get_generative_questions_feature_config_config - list_generative_question_configs_config = parent_rpcs.list_generative_question_configs if parent_rpcs.respond_to? :list_generative_question_configs - @list_generative_question_configs = ::Gapic::Config::Method.new list_generative_question_configs_config - update_generative_question_config_config = parent_rpcs.update_generative_question_config if parent_rpcs.respond_to? :update_generative_question_config - @update_generative_question_config = ::Gapic::Config::Method.new update_generative_question_config_config - batch_update_generative_question_configs_config = parent_rpcs.batch_update_generative_question_configs if parent_rpcs.respond_to? :batch_update_generative_question_configs - @batch_update_generative_question_configs = ::Gapic::Config::Method.new batch_update_generative_question_configs_config - - yield self if block_given? - end - end - end - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/credentials.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/credentials.rb deleted file mode 100644 index 15af3d895c06..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/credentials.rb +++ /dev/null @@ -1,51 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "googleauth" - -module Google - module Cloud - module Retail - module V2 - module GenerativeQuestionService - # Credentials for the GenerativeQuestionService API. - class Credentials < ::Google::Auth::Credentials - self.scope = [ - "https://www.googleapis.com/auth/cloud-platform" - ] - self.env_vars = [ - "RETAIL_CREDENTIALS", - "RETAIL_KEYFILE", - "GOOGLE_CLOUD_CREDENTIALS", - "GOOGLE_CLOUD_KEYFILE", - "GCLOUD_KEYFILE", - "RETAIL_CREDENTIALS_JSON", - "RETAIL_KEYFILE_JSON", - "GOOGLE_CLOUD_CREDENTIALS_JSON", - "GOOGLE_CLOUD_KEYFILE_JSON", - "GCLOUD_KEYFILE_JSON" - ] - self.paths = [ - "~/.config/google_cloud/application_default_credentials.json" - ] - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/paths.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/paths.rb deleted file mode 100644 index a01a45d7d88f..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/paths.rb +++ /dev/null @@ -1,52 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Cloud - module Retail - module V2 - module GenerativeQuestionService - # Path helper methods for the GenerativeQuestionService API. - module Paths - ## - # Create a fully-qualified Catalog resource string. - # - # The resource will be in the following format: - # - # `projects/{project}/locations/{location}/catalogs/{catalog}` - # - # @param project [String] - # @param location [String] - # @param catalog [String] - # - # @return [::String] - def catalog_path project:, location:, catalog: - raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" - raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" - - "projects/#{project}/locations/#{location}/catalogs/#{catalog}" - end - - extend self - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/rest.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/rest.rb deleted file mode 100644 index a4599e934284..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/rest.rb +++ /dev/null @@ -1,52 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "gapic/rest" -require "gapic/config" -require "gapic/config/method" - -require "google/cloud/retail/v2/version" - -require "google/cloud/retail/v2/generative_question_service/credentials" -require "google/cloud/retail/v2/generative_question_service/paths" -require "google/cloud/retail/v2/generative_question_service/rest/client" - -module Google - module Cloud - module Retail - module V2 - ## - # Service for managing LLM generated questions in search serving. - # - # To load this service and instantiate a REST client: - # - # require "google/cloud/retail/v2/generative_question_service/rest" - # client = ::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client.new - # - module GenerativeQuestionService - # Client for the REST transport - module Rest - end - end - end - end - end -end - -helper_path = ::File.join __dir__, "rest", "helpers.rb" -require "google/cloud/retail/v2/generative_question_service/rest/helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/rest/client.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/rest/client.rb deleted file mode 100644 index 414fa2beac8b..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/rest/client.rb +++ /dev/null @@ -1,801 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "google/cloud/errors" -require "google/cloud/retail/v2/generative_question_service_pb" -require "google/cloud/retail/v2/generative_question_service/rest/service_stub" -require "google/cloud/location/rest" - -module Google - module Cloud - module Retail - module V2 - module GenerativeQuestionService - module Rest - ## - # REST client for the GenerativeQuestionService service. - # - # Service for managing LLM generated questions in search serving. - # - class Client - # @private - API_VERSION = "" - - # @private - DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" - - include Paths - - # @private - attr_reader :generative_question_service_stub - - ## - # Configure the GenerativeQuestionService Client class. - # - # See {::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client::Configuration} - # for a description of the configuration fields. - # - # @example - # - # # Modify the configuration for all GenerativeQuestionService clients - # ::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client.configure do |config| - # config.timeout = 10.0 - # end - # - # @yield [config] Configure the Client client. - # @yieldparam config [Client::Configuration] - # - # @return [Client::Configuration] - # - def self.configure - @configure ||= begin - namespace = ["Google", "Cloud", "Retail", "V2"] - parent_config = while namespace.any? - parent_name = namespace.join "::" - parent_const = const_get parent_name - break parent_const.configure if parent_const.respond_to? :configure - namespace.pop - end - default_config = Client::Configuration.new parent_config - - default_config - end - yield @configure if block_given? - @configure - end - - ## - # Configure the GenerativeQuestionService Client instance. - # - # The configuration is set to the derived mode, meaning that values can be changed, - # but structural changes (adding new fields, etc.) are not allowed. Structural changes - # should be made on {Client.configure}. - # - # See {::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client::Configuration} - # for a description of the configuration fields. - # - # @yield [config] Configure the Client client. - # @yieldparam config [Client::Configuration] - # - # @return [Client::Configuration] - # - def configure - yield @config if block_given? - @config - end - - ## - # The effective universe domain - # - # @return [String] - # - def universe_domain - @generative_question_service_stub.universe_domain - end - - ## - # Create a new GenerativeQuestionService REST client object. - # - # @example - # - # # Create a client using the default configuration - # client = ::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client.new - # - # # Create a client using a custom configuration - # client = ::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client.new do |config| - # config.timeout = 10.0 - # end - # - # @yield [config] Configure the GenerativeQuestionService client. - # @yieldparam config [Client::Configuration] - # - def initialize - # Create the configuration object - @config = Configuration.new Client.configure - - # Yield the configuration if needed - yield @config if block_given? - - # Create credentials - credentials = @config.credentials - # Use self-signed JWT if the endpoint is unchanged from default, - # but only if the default endpoint does not have a region prefix. - enable_self_signed_jwt = @config.endpoint.nil? || - (@config.endpoint == Configuration::DEFAULT_ENDPOINT && - !@config.endpoint.split(".").first.include?("-")) - credentials ||= Credentials.default scope: @config.scope, - enable_self_signed_jwt: enable_self_signed_jwt - if credentials.is_a?(::String) || credentials.is_a?(::Hash) - credentials = Credentials.new credentials, scope: @config.scope - end - - @quota_project_id = @config.quota_project - @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id - - @generative_question_service_stub = ::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::ServiceStub.new( - endpoint: @config.endpoint, - endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, - universe_domain: @config.universe_domain, - credentials: credentials, - logger: @config.logger - ) - - @generative_question_service_stub.logger(stub: true)&.info do |entry| - entry.set_system_name - entry.set_service - entry.message = "Created client for #{entry.service}" - entry.set_credentials_fields credentials - entry.set "customEndpoint", @config.endpoint if @config.endpoint - entry.set "defaultTimeout", @config.timeout if @config.timeout - entry.set "quotaProject", @quota_project_id if @quota_project_id - end - - @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config| - config.credentials = credentials - config.quota_project = @quota_project_id - config.endpoint = @generative_question_service_stub.endpoint - config.universe_domain = @generative_question_service_stub.universe_domain - config.logger = @generative_question_service_stub.logger if config.respond_to? :logger= - end - end - - ## - # Get the associated client for mix-in of the Locations. - # - # @return [Google::Cloud::Location::Locations::Rest::Client] - # - attr_reader :location_client - - ## - # The logger used for request/response debug logging. - # - # @return [Logger] - # - def logger - @generative_question_service_stub.logger - end - - # Service calls - - ## - # Manages overal generative question feature state -- enables toggling - # feature on and off. - # - # @overload update_generative_questions_feature_config(request, options = nil) - # Pass arguments to `update_generative_questions_feature_config` via a request object, either of type - # {::Google::Cloud::Retail::V2::UpdateGenerativeQuestionsFeatureConfigRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::UpdateGenerativeQuestionsFeatureConfigRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload update_generative_questions_feature_config(generative_questions_feature_config: nil, update_mask: nil) - # Pass arguments to `update_generative_questions_feature_config` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param generative_questions_feature_config [::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig, ::Hash] - # Required. The configuration managing the feature state. - # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] - # Optional. Indicates which fields in the provided - # {::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig GenerativeQuestionsFeatureConfig} - # to update. If not set or empty, all supported fields are updated. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::UpdateGenerativeQuestionsFeatureConfigRequest.new - # - # # Call the update_generative_questions_feature_config method. - # result = client.update_generative_questions_feature_config request - # - # # The returned object is of type Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig. - # p result - # - def update_generative_questions_feature_config request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::UpdateGenerativeQuestionsFeatureConfigRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.update_generative_questions_feature_config.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.update_generative_questions_feature_config.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.update_generative_questions_feature_config.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @generative_question_service_stub.update_generative_questions_feature_config request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Manages overal generative question feature state -- enables toggling - # feature on and off. - # - # @overload get_generative_questions_feature_config(request, options = nil) - # Pass arguments to `get_generative_questions_feature_config` via a request object, either of type - # {::Google::Cloud::Retail::V2::GetGenerativeQuestionsFeatureConfigRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::GetGenerativeQuestionsFeatureConfigRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload get_generative_questions_feature_config(catalog: nil) - # Pass arguments to `get_generative_questions_feature_config` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param catalog [::String] - # Required. Resource name of the parent catalog. - # Format: projects/\\{project}/locations/\\{location}/catalogs/\\{catalog} - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::GetGenerativeQuestionsFeatureConfigRequest.new - # - # # Call the get_generative_questions_feature_config method. - # result = client.get_generative_questions_feature_config request - # - # # The returned object is of type Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig. - # p result - # - def get_generative_questions_feature_config request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::GetGenerativeQuestionsFeatureConfigRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.get_generative_questions_feature_config.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.get_generative_questions_feature_config.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.get_generative_questions_feature_config.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @generative_question_service_stub.get_generative_questions_feature_config request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Returns all questions for a given catalog. - # - # @overload list_generative_question_configs(request, options = nil) - # Pass arguments to `list_generative_question_configs` via a request object, either of type - # {::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload list_generative_question_configs(parent: nil) - # Pass arguments to `list_generative_question_configs` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. Resource name of the parent catalog. - # Format: projects/\\{project}/locations/\\{location}/catalogs/\\{catalog} - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsResponse] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsResponse] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsRequest.new - # - # # Call the list_generative_question_configs method. - # result = client.list_generative_question_configs request - # - # # The returned object is of type Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsResponse. - # p result - # - def list_generative_question_configs request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.list_generative_question_configs.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.list_generative_question_configs.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.list_generative_question_configs.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @generative_question_service_stub.list_generative_question_configs request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Allows management of individual questions. - # - # @overload update_generative_question_config(request, options = nil) - # Pass arguments to `update_generative_question_config` via a request object, either of type - # {::Google::Cloud::Retail::V2::UpdateGenerativeQuestionConfigRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::UpdateGenerativeQuestionConfigRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload update_generative_question_config(generative_question_config: nil, update_mask: nil) - # Pass arguments to `update_generative_question_config` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param generative_question_config [::Google::Cloud::Retail::V2::GenerativeQuestionConfig, ::Hash] - # Required. The question to update. - # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] - # Optional. Indicates which fields in the provided - # {::Google::Cloud::Retail::V2::GenerativeQuestionConfig GenerativeQuestionConfig} - # to update. The following are NOT supported: - # - # * {::Google::Cloud::Retail::V2::GenerativeQuestionConfig#frequency GenerativeQuestionConfig.frequency} - # - # If not set or empty, all supported fields are updated. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::GenerativeQuestionConfig] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::GenerativeQuestionConfig] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::UpdateGenerativeQuestionConfigRequest.new - # - # # Call the update_generative_question_config method. - # result = client.update_generative_question_config request - # - # # The returned object is of type Google::Cloud::Retail::V2::GenerativeQuestionConfig. - # p result - # - def update_generative_question_config request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::UpdateGenerativeQuestionConfigRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.update_generative_question_config.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.update_generative_question_config.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.update_generative_question_config.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @generative_question_service_stub.update_generative_question_config request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Allows management of multiple questions. - # - # @overload batch_update_generative_question_configs(request, options = nil) - # Pass arguments to `batch_update_generative_question_configs` via a request object, either of type - # {::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload batch_update_generative_question_configs(parent: nil, requests: nil) - # Pass arguments to `batch_update_generative_question_configs` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Optional. Resource name of the parent catalog. - # Format: projects/\\{project}/locations/\\{location}/catalogs/\\{catalog} - # @param requests [::Array<::Google::Cloud::Retail::V2::UpdateGenerativeQuestionConfigRequest, ::Hash>] - # Required. The updates question configs. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsResponse] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsResponse] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsRequest.new - # - # # Call the batch_update_generative_question_configs method. - # result = client.batch_update_generative_question_configs request - # - # # The returned object is of type Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsResponse. - # p result - # - def batch_update_generative_question_configs request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.batch_update_generative_question_configs.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.batch_update_generative_question_configs.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.batch_update_generative_question_configs.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @generative_question_service_stub.batch_update_generative_question_configs request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Configuration class for the GenerativeQuestionService REST API. - # - # This class represents the configuration for GenerativeQuestionService REST, - # providing control over timeouts, retry behavior, logging, transport - # parameters, and other low-level controls. Certain parameters can also be - # applied individually to specific RPCs. See - # {::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client::Configuration::Rpcs} - # for a list of RPCs that can be configured independently. - # - # Configuration can be applied globally to all clients, or to a single client - # on construction. - # - # @example - # - # # Modify the global config, setting the timeout for - # # update_generative_questions_feature_config to 20 seconds, - # # and all remaining timeouts to 10 seconds. - # ::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client.configure do |config| - # config.timeout = 10.0 - # config.rpcs.update_generative_questions_feature_config.timeout = 20.0 - # end - # - # # Apply the above configuration only to a new client. - # client = ::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client.new do |config| - # config.timeout = 10.0 - # config.rpcs.update_generative_questions_feature_config.timeout = 20.0 - # end - # - # @!attribute [rw] endpoint - # A custom service endpoint, as a hostname or hostname:port. The default is - # nil, indicating to use the default endpoint in the current universe domain. - # @return [::String,nil] - # @!attribute [rw] credentials - # Credentials to send with calls. You may provide any of the following types: - # * (`String`) The path to a service account key file in JSON format - # * (`Hash`) A service account key as a Hash - # * (`Google::Auth::Credentials`) A googleauth credentials object - # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) - # * (`Signet::OAuth2::Client`) A signet oauth2 client object - # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) - # * (`nil`) indicating no credentials - # - # Warning: If you accept a credential configuration (JSON file or Hash) from an - # external source for authentication to Google Cloud, you must validate it before - # providing it to a Google API client library. Providing an unvalidated credential - # configuration to Google APIs can compromise the security of your systems and data. - # For more information, refer to [Validate credential configurations from external - # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). - # @return [::Object] - # @!attribute [rw] scope - # The OAuth scopes - # @return [::Array<::String>] - # @!attribute [rw] lib_name - # The library name as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] lib_version - # The library version as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] timeout - # The call timeout in seconds. - # @return [::Numeric] - # @!attribute [rw] metadata - # Additional headers to be sent with the call. - # @return [::Hash{::Symbol=>::String}] - # @!attribute [rw] retry_policy - # The retry policy. The value is a hash with the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # @return [::Hash] - # @!attribute [rw] quota_project - # A separate project against which to charge quota. - # @return [::String] - # @!attribute [rw] universe_domain - # The universe domain within which to make requests. This determines the - # default endpoint URL. The default value of nil uses the environment - # universe (usually the default "googleapis.com" universe). - # @return [::String,nil] - # @!attribute [rw] logger - # A custom logger to use for request/response debug logging, or the value - # `:default` (the default) to construct a default logger, or `nil` to - # explicitly disable logging. - # @return [::Logger,:default,nil] - # - class Configuration - extend ::Gapic::Config - - # @private - # The endpoint specific to the default "googleapis.com" universe. Deprecated. - DEFAULT_ENDPOINT = "retail.googleapis.com" - - config_attr :endpoint, nil, ::String, nil - config_attr :credentials, nil do |value| - allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] - allowed.any? { |klass| klass === value } - end - config_attr :scope, nil, ::String, ::Array, nil - config_attr :lib_name, nil, ::String, nil - config_attr :lib_version, nil, ::String, nil - config_attr :timeout, nil, ::Numeric, nil - config_attr :metadata, nil, ::Hash, nil - config_attr :retry_policy, nil, ::Hash, ::Proc, nil - config_attr :quota_project, nil, ::String, nil - config_attr :universe_domain, nil, ::String, nil - config_attr :logger, :default, ::Logger, nil, :default - - # @private - def initialize parent_config = nil - @parent_config = parent_config unless parent_config.nil? - - yield self if block_given? - end - - ## - # Configurations for individual RPCs - # @return [Rpcs] - # - def rpcs - @rpcs ||= begin - parent_rpcs = nil - parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) - Rpcs.new parent_rpcs - end - end - - ## - # Configuration RPC class for the GenerativeQuestionService API. - # - # Includes fields providing the configuration for each RPC in this service. - # Each configuration object is of type `Gapic::Config::Method` and includes - # the following configuration fields: - # - # * `timeout` (*type:* `Numeric`) - The call timeout in seconds - # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers - # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields - # include the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # - class Rpcs - ## - # RPC-specific configuration for `update_generative_questions_feature_config` - # @return [::Gapic::Config::Method] - # - attr_reader :update_generative_questions_feature_config - ## - # RPC-specific configuration for `get_generative_questions_feature_config` - # @return [::Gapic::Config::Method] - # - attr_reader :get_generative_questions_feature_config - ## - # RPC-specific configuration for `list_generative_question_configs` - # @return [::Gapic::Config::Method] - # - attr_reader :list_generative_question_configs - ## - # RPC-specific configuration for `update_generative_question_config` - # @return [::Gapic::Config::Method] - # - attr_reader :update_generative_question_config - ## - # RPC-specific configuration for `batch_update_generative_question_configs` - # @return [::Gapic::Config::Method] - # - attr_reader :batch_update_generative_question_configs - - # @private - def initialize parent_rpcs = nil - update_generative_questions_feature_config_config = parent_rpcs.update_generative_questions_feature_config if parent_rpcs.respond_to? :update_generative_questions_feature_config - @update_generative_questions_feature_config = ::Gapic::Config::Method.new update_generative_questions_feature_config_config - get_generative_questions_feature_config_config = parent_rpcs.get_generative_questions_feature_config if parent_rpcs.respond_to? :get_generative_questions_feature_config - @get_generative_questions_feature_config = ::Gapic::Config::Method.new get_generative_questions_feature_config_config - list_generative_question_configs_config = parent_rpcs.list_generative_question_configs if parent_rpcs.respond_to? :list_generative_question_configs - @list_generative_question_configs = ::Gapic::Config::Method.new list_generative_question_configs_config - update_generative_question_config_config = parent_rpcs.update_generative_question_config if parent_rpcs.respond_to? :update_generative_question_config - @update_generative_question_config = ::Gapic::Config::Method.new update_generative_question_config_config - batch_update_generative_question_configs_config = parent_rpcs.batch_update_generative_question_configs if parent_rpcs.respond_to? :batch_update_generative_question_configs - @batch_update_generative_question_configs = ::Gapic::Config::Method.new batch_update_generative_question_configs_config - - yield self if block_given? - end - end - end - end - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/rest/service_stub.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/rest/service_stub.rb deleted file mode 100644 index 28bb60081ea8..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service/rest/service_stub.rb +++ /dev/null @@ -1,389 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "google/cloud/retail/v2/generative_question_service_pb" - -module Google - module Cloud - module Retail - module V2 - module GenerativeQuestionService - module Rest - ## - # REST service stub for the GenerativeQuestionService service. - # Service stub contains baseline method implementations - # including transcoding, making the REST call, and deserialing the response. - # - class ServiceStub - # @private - def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger: - # These require statements are intentionally placed here to initialize - # the REST modules only when it's required. - require "gapic/rest" - - @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, - endpoint_template: endpoint_template, - universe_domain: universe_domain, - credentials: credentials, - numeric_enums: true, - service_name: self.class, - raise_faraday_errors: false, - logger: logger - end - - ## - # The effective universe domain - # - # @return [String] - # - def universe_domain - @client_stub.universe_domain - end - - ## - # The effective endpoint - # - # @return [String] - # - def endpoint - @client_stub.endpoint - end - - ## - # The logger used for request/response debug logging. - # - # @return [Logger] - # - def logger stub: false - stub ? @client_stub.stub_logger : @client_stub.logger - end - - ## - # Baseline implementation for the update_generative_questions_feature_config REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::UpdateGenerativeQuestionsFeatureConfigRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig] - # A result object deserialized from the server's reply - def update_generative_questions_feature_config request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_update_generative_questions_feature_config_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "update_generative_questions_feature_config", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the get_generative_questions_feature_config REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::GetGenerativeQuestionsFeatureConfigRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig] - # A result object deserialized from the server's reply - def get_generative_questions_feature_config request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_get_generative_questions_feature_config_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "get_generative_questions_feature_config", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the list_generative_question_configs REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsResponse] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsResponse] - # A result object deserialized from the server's reply - def list_generative_question_configs request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_list_generative_question_configs_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "list_generative_question_configs", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsResponse.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the update_generative_question_config REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::UpdateGenerativeQuestionConfigRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::GenerativeQuestionConfig] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::GenerativeQuestionConfig] - # A result object deserialized from the server's reply - def update_generative_question_config request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_update_generative_question_config_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "update_generative_question_config", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Retail::V2::GenerativeQuestionConfig.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the batch_update_generative_question_configs REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsResponse] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsResponse] - # A result object deserialized from the server's reply - def batch_update_generative_question_configs request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_batch_update_generative_question_configs_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "batch_update_generative_question_configs", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsResponse.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # @private - # - # GRPC transcoding helper method for the update_generative_questions_feature_config REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::UpdateGenerativeQuestionsFeatureConfigRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_update_generative_questions_feature_config_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :patch, - uri_template: "/v2/{generative_questions_feature_config.catalog}/generativeQuestionFeature", - body: "generative_questions_feature_config", - matches: [ - ["generative_questions_feature_config.catalog", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the get_generative_questions_feature_config REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::GetGenerativeQuestionsFeatureConfigRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_get_generative_questions_feature_config_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :get, - uri_template: "/v2/{catalog}/generativeQuestionFeature", - matches: [ - ["catalog", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the list_generative_question_configs REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_list_generative_question_configs_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :get, - uri_template: "/v2/{parent}/generativeQuestions", - matches: [ - ["parent", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the update_generative_question_config REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::UpdateGenerativeQuestionConfigRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_update_generative_question_config_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :patch, - uri_template: "/v2/{generative_question_config.catalog}/generativeQuestion", - body: "generative_question_config", - matches: [ - ["generative_question_config.catalog", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the batch_update_generative_question_configs REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_batch_update_generative_question_configs_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :post, - uri_template: "/v2/{parent}/generativeQuestion:batchUpdate", - body: "*", - matches: [ - ["parent", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - end - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service_pb.rb deleted file mode 100644 index 36ad39b3e786..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service_pb.rb +++ /dev/null @@ -1,34 +0,0 @@ -# frozen_string_literal: true -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/retail/v2/generative_question_service.proto - -require 'google/protobuf' - -require 'google/api/annotations_pb' -require 'google/api/client_pb' -require 'google/api/field_behavior_pb' -require 'google/api/resource_pb' -require 'google/cloud/retail/v2/generative_question_pb' -require 'google/protobuf/field_mask_pb' - - -descriptor_data = "\n8google/cloud/retail/v2/generative_question_service.proto\x12\x16google.cloud.retail.v2\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x30google/cloud/retail/v2/generative_question.proto\x1a google/protobuf/field_mask.proto\"\xd1\x01\n-UpdateGenerativeQuestionsFeatureConfigRequest\x12j\n#generative_questions_feature_config\x18\x02 \x01(\x0b\x32\x38.google.cloud.retail.v2.GenerativeQuestionsFeatureConfigB\x03\xe0\x41\x02\x12\x34\n\x0bupdate_mask\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.FieldMaskB\x03\xe0\x41\x01\"d\n*GetGenerativeQuestionsFeatureConfigRequest\x12\x36\n\x07\x63\x61talog\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\n\x1dretail.googleapis.com/Catalog\"]\n$ListGenerativeQuestionConfigsRequest\x12\x35\n\x06parent\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\n\x1dretail.googleapis.com/Catalog\"~\n%ListGenerativeQuestionConfigsResponse\x12U\n\x1bgenerative_question_configs\x18\x01 \x03(\x0b\x32\x30.google.cloud.retail.v2.GenerativeQuestionConfig\"\xb8\x01\n%UpdateGenerativeQuestionConfigRequest\x12Y\n\x1agenerative_question_config\x18\x03 \x01(\x0b\x32\x30.google.cloud.retail.v2.GenerativeQuestionConfigB\x03\xe0\x41\x02\x12\x34\n\x0bupdate_mask\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.FieldMaskB\x03\xe0\x41\x01\"\xba\x01\n+BatchUpdateGenerativeQuestionConfigsRequest\x12\x35\n\x06parent\x18\x01 \x01(\tB%\xe0\x41\x01\xfa\x41\x1f\n\x1dretail.googleapis.com/Catalog\x12T\n\x08requests\x18\x02 \x03(\x0b\x32=.google.cloud.retail.v2.UpdateGenerativeQuestionConfigRequestB\x03\xe0\x41\x02\"\x8a\x01\n,BatchUpdateGenerativeQuestionConfigsResponse\x12Z\n\x1bgenerative_question_configs\x18\x01 \x03(\x0b\x32\x30.google.cloud.retail.v2.GenerativeQuestionConfigB\x03\xe0\x41\x01\x32\xba\x0c\n\x19GenerativeQuestionService\x12\xf9\x02\n&UpdateGenerativeQuestionsFeatureConfig\x12\x45.google.cloud.retail.v2.UpdateGenerativeQuestionsFeatureConfigRequest\x1a\x38.google.cloud.retail.v2.GenerativeQuestionsFeatureConfig\"\xcd\x01\xda\x41/generative_questions_feature_config,update_mask\x82\xd3\xe4\x93\x02\x94\x01\x32m/v2/{generative_questions_feature_config.catalog=projects/*/locations/*/catalogs/*}/generativeQuestionFeature:#generative_questions_feature_config\x12\x80\x02\n#GetGenerativeQuestionsFeatureConfig\x12\x42.google.cloud.retail.v2.GetGenerativeQuestionsFeatureConfigRequest\x1a\x38.google.cloud.retail.v2.GenerativeQuestionsFeatureConfig\"[\xda\x41\x07\x63\x61talog\x82\xd3\xe4\x93\x02K\x12I/v2/{catalog=projects/*/locations/*/catalogs/*}/generativeQuestionFeature\x12\xf1\x01\n\x1dListGenerativeQuestionConfigs\x12<.google.cloud.retail.v2.ListGenerativeQuestionConfigsRequest\x1a=.google.cloud.retail.v2.ListGenerativeQuestionConfigsResponse\"S\xda\x41\x06parent\x82\xd3\xe4\x93\x02\x44\x12\x42/v2/{parent=projects/*/locations/*/catalogs/*}/generativeQuestions\x12\xbe\x02\n\x1eUpdateGenerativeQuestionConfig\x12=.google.cloud.retail.v2.UpdateGenerativeQuestionConfigRequest\x1a\x30.google.cloud.retail.v2.GenerativeQuestionConfig\"\xaa\x01\xda\x41&generative_question_config,update_mask\x82\xd3\xe4\x93\x02{2]/v2/{generative_question_config.catalog=projects/*/locations/*/catalogs/*}/generativeQuestion:\x1agenerative_question_config\x12\x9d\x02\n$BatchUpdateGenerativeQuestionConfigs\x12\x43.google.cloud.retail.v2.BatchUpdateGenerativeQuestionConfigsRequest\x1a\x44.google.cloud.retail.v2.BatchUpdateGenerativeQuestionConfigsResponse\"j\xda\x41\x0fparent,requests\x82\xd3\xe4\x93\x02R\"M/v2/{parent=projects/*/locations/*/catalogs/*}/generativeQuestion:batchUpdate:\x01*\x1aI\xca\x41\x15retail.googleapis.com\xd2\x41.https://www.googleapis.com/auth/cloud-platformB\xc9\x01\n\x1a\x63om.google.cloud.retail.v2B\x1eGenerativeQuestionServiceProtoP\x01Z2cloud.google.com/go/retail/apiv2/retailpb;retailpb\xa2\x02\x06RETAIL\xaa\x02\x16Google.Cloud.Retail.V2\xca\x02\x16Google\\Cloud\\Retail\\V2\xea\x02\x19Google::Cloud::Retail::V2b\x06proto3" - -pool = ::Google::Protobuf::DescriptorPool.generated_pool -pool.add_serialized_file(descriptor_data) - -module Google - module Cloud - module Retail - module V2 - UpdateGenerativeQuestionsFeatureConfigRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.UpdateGenerativeQuestionsFeatureConfigRequest").msgclass - GetGenerativeQuestionsFeatureConfigRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.GetGenerativeQuestionsFeatureConfigRequest").msgclass - ListGenerativeQuestionConfigsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ListGenerativeQuestionConfigsRequest").msgclass - ListGenerativeQuestionConfigsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ListGenerativeQuestionConfigsResponse").msgclass - UpdateGenerativeQuestionConfigRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.UpdateGenerativeQuestionConfigRequest").msgclass - BatchUpdateGenerativeQuestionConfigsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.BatchUpdateGenerativeQuestionConfigsRequest").msgclass - BatchUpdateGenerativeQuestionConfigsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.BatchUpdateGenerativeQuestionConfigsResponse").msgclass - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service_services_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service_services_pb.rb deleted file mode 100644 index 259ede2d8557..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/generative_question_service_services_pb.rb +++ /dev/null @@ -1,55 +0,0 @@ -# Generated by the protocol buffer compiler. DO NOT EDIT! -# Source: google/cloud/retail/v2/generative_question_service.proto for package 'Google.Cloud.Retail.V2' -# Original file comments: -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -require 'grpc' -require 'google/cloud/retail/v2/generative_question_service_pb' - -module Google - module Cloud - module Retail - module V2 - module GenerativeQuestionService - # Service for managing LLM generated questions in search serving. - class Service - - include ::GRPC::GenericService - - self.marshal_class_method = :encode - self.unmarshal_class_method = :decode - self.service_name = 'google.cloud.retail.v2.GenerativeQuestionService' - - # Manages overal generative question feature state -- enables toggling - # feature on and off. - rpc :UpdateGenerativeQuestionsFeatureConfig, ::Google::Cloud::Retail::V2::UpdateGenerativeQuestionsFeatureConfigRequest, ::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig - # Manages overal generative question feature state -- enables toggling - # feature on and off. - rpc :GetGenerativeQuestionsFeatureConfig, ::Google::Cloud::Retail::V2::GetGenerativeQuestionsFeatureConfigRequest, ::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig - # Returns all questions for a given catalog. - rpc :ListGenerativeQuestionConfigs, ::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsRequest, ::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsResponse - # Allows management of individual questions. - rpc :UpdateGenerativeQuestionConfig, ::Google::Cloud::Retail::V2::UpdateGenerativeQuestionConfigRequest, ::Google::Cloud::Retail::V2::GenerativeQuestionConfig - # Allows management of multiple questions. - rpc :BatchUpdateGenerativeQuestionConfigs, ::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsRequest, ::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsResponse - end - - Stub = Service.rpc_stub_class - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/import_config_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/import_config_pb.rb deleted file mode 100644 index 8dacabe59008..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/import_config_pb.rb +++ /dev/null @@ -1,46 +0,0 @@ -# frozen_string_literal: true -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/retail/v2/import_config.proto - -require 'google/protobuf' - -require 'google/api/field_behavior_pb' -require 'google/api/resource_pb' -require 'google/cloud/retail/v2/product_pb' -require 'google/cloud/retail/v2/user_event_pb' -require 'google/protobuf/field_mask_pb' -require 'google/protobuf/timestamp_pb' -require 'google/rpc/status_pb' -require 'google/type/date_pb' - - -descriptor_data = "\n*google/cloud/retail/v2/import_config.proto\x12\x16google.cloud.retail.v2\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a$google/cloud/retail/v2/product.proto\x1a\'google/cloud/retail/v2/user_event.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x17google/rpc/status.proto\x1a\x16google/type/date.proto\"9\n\tGcsSource\x12\x17\n\ninput_uris\x18\x01 \x03(\tB\x03\xe0\x41\x02\x12\x13\n\x0b\x64\x61ta_schema\x18\x02 \x01(\t\"\xbc\x01\n\x0e\x42igQuerySource\x12+\n\x0epartition_date\x18\x06 \x01(\x0b\x32\x11.google.type.DateH\x00\x12\x12\n\nproject_id\x18\x05 \x01(\t\x12\x17\n\ndataset_id\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x15\n\x08table_id\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\x17\n\x0fgcs_staging_dir\x18\x03 \x01(\t\x12\x13\n\x0b\x64\x61ta_schema\x18\x04 \x01(\tB\x0b\n\tpartition\"M\n\x13ProductInlineSource\x12\x36\n\x08products\x18\x01 \x03(\x0b\x32\x1f.google.cloud.retail.v2.ProductB\x03\xe0\x41\x02\"T\n\x15UserEventInlineSource\x12;\n\x0buser_events\x18\x01 \x03(\x0b\x32!.google.cloud.retail.v2.UserEventB\x03\xe0\x41\x02\"9\n\x12ImportErrorsConfig\x12\x14\n\ngcs_prefix\x18\x01 \x01(\tH\x00\x42\r\n\x0b\x64\x65stination\"\xf8\x03\n\x15ImportProductsRequest\x12\x34\n\x06parent\x18\x01 \x01(\tB$\xe0\x41\x02\xfa\x41\x1e\n\x1cretail.googleapis.com/Branch\x12\x16\n\nrequest_id\x18\x06 \x01(\tB\x02\x18\x01\x12\x45\n\x0cinput_config\x18\x02 \x01(\x0b\x32*.google.cloud.retail.v2.ProductInputConfigB\x03\xe0\x41\x02\x12\x41\n\rerrors_config\x18\x03 \x01(\x0b\x32*.google.cloud.retail.v2.ImportErrorsConfig\x12/\n\x0bupdate_mask\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.FieldMask\x12]\n\x13reconciliation_mode\x18\x05 \x01(\x0e\x32@.google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode\x12!\n\x19notification_pubsub_topic\x18\x07 \x01(\t\"T\n\x12ReconciliationMode\x12#\n\x1fRECONCILIATION_MODE_UNSPECIFIED\x10\x00\x12\x0f\n\x0bINCREMENTAL\x10\x01\x12\x08\n\x04\x46ULL\x10\x02\"\xdc\x01\n\x17ImportUserEventsRequest\x12\x35\n\x06parent\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\n\x1dretail.googleapis.com/Catalog\x12G\n\x0cinput_config\x18\x02 \x01(\x0b\x32,.google.cloud.retail.v2.UserEventInputConfigB\x03\xe0\x41\x02\x12\x41\n\rerrors_config\x18\x03 \x01(\x0b\x32*.google.cloud.retail.v2.ImportErrorsConfig\"\xc5\x01\n\x1bImportCompletionDataRequest\x12\x35\n\x06parent\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\n\x1dretail.googleapis.com/Catalog\x12L\n\x0cinput_config\x18\x02 \x01(\x0b\x32\x31.google.cloud.retail.v2.CompletionDataInputConfigB\x03\xe0\x41\x02\x12!\n\x19notification_pubsub_topic\x18\x03 \x01(\t\"\xe9\x01\n\x12ProductInputConfig\x12L\n\x15product_inline_source\x18\x01 \x01(\x0b\x32+.google.cloud.retail.v2.ProductInlineSourceH\x00\x12\x37\n\ngcs_source\x18\x02 \x01(\x0b\x32!.google.cloud.retail.v2.GcsSourceH\x00\x12\x42\n\x10\x62ig_query_source\x18\x03 \x01(\x0b\x32&.google.cloud.retail.v2.BigQuerySourceH\x00\x42\x08\n\x06source\"\xff\x01\n\x14UserEventInputConfig\x12V\n\x18user_event_inline_source\x18\x01 \x01(\x0b\x32-.google.cloud.retail.v2.UserEventInlineSourceB\x03\xe0\x41\x02H\x00\x12<\n\ngcs_source\x18\x02 \x01(\x0b\x32!.google.cloud.retail.v2.GcsSourceB\x03\xe0\x41\x02H\x00\x12G\n\x10\x62ig_query_source\x18\x03 \x01(\x0b\x32&.google.cloud.retail.v2.BigQuerySourceB\x03\xe0\x41\x02H\x00\x42\x08\n\x06source\"n\n\x19\x43ompletionDataInputConfig\x12G\n\x10\x62ig_query_source\x18\x01 \x01(\x0b\x32&.google.cloud.retail.v2.BigQuerySourceB\x03\xe0\x41\x02H\x00\x42\x08\n\x06source\"\xdb\x01\n\x0eImportMetadata\x12/\n\x0b\x63reate_time\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12/\n\x0bupdate_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x15\n\rsuccess_count\x18\x03 \x01(\x03\x12\x15\n\rfailure_count\x18\x04 \x01(\x03\x12\x16\n\nrequest_id\x18\x05 \x01(\tB\x02\x18\x01\x12!\n\x19notification_pubsub_topic\x18\x06 \x01(\t\"\x86\x01\n\x16ImportProductsResponse\x12)\n\rerror_samples\x18\x01 \x03(\x0b\x32\x12.google.rpc.Status\x12\x41\n\rerrors_config\x18\x02 \x01(\x0b\x32*.google.cloud.retail.v2.ImportErrorsConfig\"\xd0\x01\n\x18ImportUserEventsResponse\x12)\n\rerror_samples\x18\x01 \x03(\x0b\x32\x12.google.rpc.Status\x12\x41\n\rerrors_config\x18\x02 \x01(\x0b\x32*.google.cloud.retail.v2.ImportErrorsConfig\x12\x46\n\x0eimport_summary\x18\x03 \x01(\x0b\x32..google.cloud.retail.v2.UserEventImportSummary\"T\n\x16UserEventImportSummary\x12\x1b\n\x13joined_events_count\x18\x01 \x01(\x03\x12\x1d\n\x15unjoined_events_count\x18\x02 \x01(\x03\"I\n\x1cImportCompletionDataResponse\x12)\n\rerror_samples\x18\x01 \x03(\x0b\x32\x12.google.rpc.StatusB\xbc\x01\n\x1a\x63om.google.cloud.retail.v2B\x11ImportConfigProtoP\x01Z2cloud.google.com/go/retail/apiv2/retailpb;retailpb\xa2\x02\x06RETAIL\xaa\x02\x16Google.Cloud.Retail.V2\xca\x02\x16Google\\Cloud\\Retail\\V2\xea\x02\x19Google::Cloud::Retail::V2b\x06proto3" - -pool = ::Google::Protobuf::DescriptorPool.generated_pool -pool.add_serialized_file(descriptor_data) - -module Google - module Cloud - module Retail - module V2 - GcsSource = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.GcsSource").msgclass - BigQuerySource = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.BigQuerySource").msgclass - ProductInlineSource = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ProductInlineSource").msgclass - UserEventInlineSource = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.UserEventInlineSource").msgclass - ImportErrorsConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ImportErrorsConfig").msgclass - ImportProductsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ImportProductsRequest").msgclass - ImportProductsRequest::ReconciliationMode = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode").enummodule - ImportUserEventsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ImportUserEventsRequest").msgclass - ImportCompletionDataRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ImportCompletionDataRequest").msgclass - ProductInputConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ProductInputConfig").msgclass - UserEventInputConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.UserEventInputConfig").msgclass - CompletionDataInputConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CompletionDataInputConfig").msgclass - ImportMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ImportMetadata").msgclass - ImportProductsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ImportProductsResponse").msgclass - ImportUserEventsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ImportUserEventsResponse").msgclass - UserEventImportSummary = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.UserEventImportSummary").msgclass - ImportCompletionDataResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ImportCompletionDataResponse").msgclass - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_pb.rb deleted file mode 100644 index 037bc3c8d29c..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_pb.rb +++ /dev/null @@ -1,34 +0,0 @@ -# frozen_string_literal: true -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/retail/v2/model.proto - -require 'google/protobuf' - -require 'google/api/field_behavior_pb' -require 'google/api/resource_pb' -require 'google/cloud/retail/v2/common_pb' -require 'google/protobuf/timestamp_pb' - - -descriptor_data = "\n\"google/cloud/retail/v2/model.proto\x12\x16google.cloud.retail.v2\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a#google/cloud/retail/v2/common.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\x97\x0e\n\x05Model\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x19\n\x0c\x64isplay_name\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12H\n\x0etraining_state\x18\x03 \x01(\x0e\x32+.google.cloud.retail.v2.Model.TrainingStateB\x03\xe0\x41\x01\x12\x46\n\rserving_state\x18\x04 \x01(\x0e\x32*.google.cloud.retail.v2.Model.ServingStateB\x03\xe0\x41\x03\x12\x34\n\x0b\x63reate_time\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x34\n\x0bupdate_time\x18\x06 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x11\n\x04type\x18\x07 \x01(\tB\x03\xe0\x41\x02\x12#\n\x16optimization_objective\x18\x08 \x01(\tB\x03\xe0\x41\x01\x12U\n\x15periodic_tuning_state\x18\x0b \x01(\x0e\x32\x31.google.cloud.retail.v2.Model.PeriodicTuningStateB\x03\xe0\x41\x01\x12\x37\n\x0elast_tune_time\x18\x0c \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x1d\n\x10tuning_operation\x18\x0f \x01(\tB\x03\xe0\x41\x03\x12@\n\ndata_state\x18\x10 \x01(\x0e\x32\'.google.cloud.retail.v2.Model.DataStateB\x03\xe0\x41\x03\x12U\n\x10\x66iltering_option\x18\x12 \x01(\x0e\x32\x36.google.cloud.retail.v2.RecommendationsFilteringOptionB\x03\xe0\x41\x01\x12R\n\x14serving_config_lists\x18\x13 \x03(\x0b\x32/.google.cloud.retail.v2.Model.ServingConfigListB\x03\xe0\x41\x03\x12U\n\x15model_features_config\x18\x16 \x01(\x0b\x32\x31.google.cloud.retail.v2.Model.ModelFeaturesConfigB\x03\xe0\x41\x01\x1a\x34\n\x11ServingConfigList\x12\x1f\n\x12serving_config_ids\x18\x01 \x03(\tB\x03\xe0\x41\x01\x1a\x7f\n&FrequentlyBoughtTogetherFeaturesConfig\x12U\n\x15\x63ontext_products_type\x18\x02 \x01(\x0e\x32\x31.google.cloud.retail.v2.Model.ContextProductsTypeB\x03\xe0\x41\x01\x1a\xa1\x01\n\x13ModelFeaturesConfig\x12q\n!frequently_bought_together_config\x18\x01 \x01(\x0b\x32\x44.google.cloud.retail.v2.Model.FrequentlyBoughtTogetherFeaturesConfigH\x00\x42\x17\n\x15type_dedicated_config\"R\n\x0cServingState\x12\x1d\n\x19SERVING_STATE_UNSPECIFIED\x10\x00\x12\x0c\n\x08INACTIVE\x10\x01\x12\n\n\x06\x41\x43TIVE\x10\x02\x12\t\n\x05TUNED\x10\x03\"I\n\rTrainingState\x12\x1e\n\x1aTRAINING_STATE_UNSPECIFIED\x10\x00\x12\n\n\x06PAUSED\x10\x01\x12\x0c\n\x08TRAINING\x10\x02\"\x90\x01\n\x13PeriodicTuningState\x12%\n!PERIODIC_TUNING_STATE_UNSPECIFIED\x10\x00\x12\x1c\n\x18PERIODIC_TUNING_DISABLED\x10\x01\x12\x17\n\x13\x41LL_TUNING_DISABLED\x10\x03\x12\x1b\n\x17PERIODIC_TUNING_ENABLED\x10\x02\"D\n\tDataState\x12\x1a\n\x16\x44\x41TA_STATE_UNSPECIFIED\x10\x00\x12\x0b\n\x07\x44\x41TA_OK\x10\x01\x12\x0e\n\nDATA_ERROR\x10\x02\"w\n\x13\x43ontextProductsType\x12%\n!CONTEXT_PRODUCTS_TYPE_UNSPECIFIED\x10\x00\x12\x1a\n\x16SINGLE_CONTEXT_PRODUCT\x10\x01\x12\x1d\n\x19MULTIPLE_CONTEXT_PRODUCTS\x10\x02:k\xea\x41h\n\x1bretail.googleapis.com/Model\x12Iprojects/{project}/locations/{location}/catalogs/{catalog}/models/{model}B\xb5\x01\n\x1a\x63om.google.cloud.retail.v2B\nModelProtoP\x01Z2cloud.google.com/go/retail/apiv2/retailpb;retailpb\xa2\x02\x06RETAIL\xaa\x02\x16Google.Cloud.Retail.V2\xca\x02\x16Google\\Cloud\\Retail\\V2\xea\x02\x19Google::Cloud::Retail::V2b\x06proto3" - -pool = ::Google::Protobuf::DescriptorPool.generated_pool -pool.add_serialized_file(descriptor_data) - -module Google - module Cloud - module Retail - module V2 - Model = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Model").msgclass - Model::ServingConfigList = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Model.ServingConfigList").msgclass - Model::FrequentlyBoughtTogetherFeaturesConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Model.FrequentlyBoughtTogetherFeaturesConfig").msgclass - Model::ModelFeaturesConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Model.ModelFeaturesConfig").msgclass - Model::ServingState = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Model.ServingState").enummodule - Model::TrainingState = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Model.TrainingState").enummodule - Model::PeriodicTuningState = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Model.PeriodicTuningState").enummodule - Model::DataState = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Model.DataState").enummodule - Model::ContextProductsType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Model.ContextProductsType").enummodule - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service.rb deleted file mode 100644 index 7494180ffbb2..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service.rb +++ /dev/null @@ -1,67 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "gapic/common" -require "gapic/config" -require "gapic/config/method" - -require "google/cloud/retail/v2/version" - -require "google/cloud/retail/v2/model_service/credentials" -require "google/cloud/retail/v2/model_service/paths" -require "google/cloud/retail/v2/model_service/operations" -require "google/cloud/retail/v2/model_service/client" -require "google/cloud/retail/v2/model_service/rest" - -module Google - module Cloud - module Retail - module V2 - ## - # Service for performing CRUD operations on models. - # Recommendation models contain all the metadata necessary to generate a set of - # models for the `Predict()` API. A model is queried - # indirectly via a ServingConfig, which associates a model with a - # given Placement (e.g. Frequently Bought Together on Home Page). - # - # This service allows you to do the following: - # - # * Initiate training of a model. - # * Pause training of an existing model. - # * List all the available models along with their metadata. - # * Control their tuning schedule. - # - # @example Load this service and instantiate a gRPC client - # - # require "google/cloud/retail/v2/model_service" - # client = ::Google::Cloud::Retail::V2::ModelService::Client.new - # - # @example Load this service and instantiate a REST client - # - # require "google/cloud/retail/v2/model_service/rest" - # client = ::Google::Cloud::Retail::V2::ModelService::Rest::Client.new - # - module ModelService - end - end - end - end -end - -helper_path = ::File.join __dir__, "model_service", "helpers.rb" -require "google/cloud/retail/v2/model_service/helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/client.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/client.rb deleted file mode 100644 index c39bfc7e2a36..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/client.rb +++ /dev/null @@ -1,1221 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "google/cloud/errors" -require "google/cloud/retail/v2/model_service_pb" -require "google/cloud/location" - -module Google - module Cloud - module Retail - module V2 - module ModelService - ## - # Client for the ModelService service. - # - # Service for performing CRUD operations on models. - # Recommendation models contain all the metadata necessary to generate a set of - # models for the `Predict()` API. A model is queried - # indirectly via a ServingConfig, which associates a model with a - # given Placement (e.g. Frequently Bought Together on Home Page). - # - # This service allows you to do the following: - # - # * Initiate training of a model. - # * Pause training of an existing model. - # * List all the available models along with their metadata. - # * Control their tuning schedule. - # - class Client - # @private - API_VERSION = "" - - # @private - DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" - - include Paths - - # @private - attr_reader :model_service_stub - - ## - # Configure the ModelService Client class. - # - # See {::Google::Cloud::Retail::V2::ModelService::Client::Configuration} - # for a description of the configuration fields. - # - # @example - # - # # Modify the configuration for all ModelService clients - # ::Google::Cloud::Retail::V2::ModelService::Client.configure do |config| - # config.timeout = 10.0 - # end - # - # @yield [config] Configure the Client client. - # @yieldparam config [Client::Configuration] - # - # @return [Client::Configuration] - # - def self.configure - @configure ||= begin - namespace = ["Google", "Cloud", "Retail", "V2"] - parent_config = while namespace.any? - parent_name = namespace.join "::" - parent_const = const_get parent_name - break parent_const.configure if parent_const.respond_to? :configure - namespace.pop - end - default_config = Client::Configuration.new parent_config - - default_config.timeout = 60.0 - default_config.retry_policy = { - initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4] - } - - default_config - end - yield @configure if block_given? - @configure - end - - ## - # Configure the ModelService Client instance. - # - # The configuration is set to the derived mode, meaning that values can be changed, - # but structural changes (adding new fields, etc.) are not allowed. Structural changes - # should be made on {Client.configure}. - # - # See {::Google::Cloud::Retail::V2::ModelService::Client::Configuration} - # for a description of the configuration fields. - # - # @yield [config] Configure the Client client. - # @yieldparam config [Client::Configuration] - # - # @return [Client::Configuration] - # - def configure - yield @config if block_given? - @config - end - - ## - # The effective universe domain - # - # @return [String] - # - def universe_domain - @model_service_stub.universe_domain - end - - ## - # Create a new ModelService client object. - # - # @example - # - # # Create a client using the default configuration - # client = ::Google::Cloud::Retail::V2::ModelService::Client.new - # - # # Create a client using a custom configuration - # client = ::Google::Cloud::Retail::V2::ModelService::Client.new do |config| - # config.timeout = 10.0 - # end - # - # @yield [config] Configure the ModelService client. - # @yieldparam config [Client::Configuration] - # - def initialize - # These require statements are intentionally placed here to initialize - # the gRPC module only when it's required. - # See https://github.com/googleapis/toolkit/issues/446 - require "gapic/grpc" - require "google/cloud/retail/v2/model_service_services_pb" - - # Create the configuration object - @config = Configuration.new Client.configure - - # Yield the configuration if needed - yield @config if block_given? - - # Create credentials - credentials = @config.credentials - # Use self-signed JWT if the endpoint is unchanged from default, - # but only if the default endpoint does not have a region prefix. - enable_self_signed_jwt = @config.endpoint.nil? || - (@config.endpoint == Configuration::DEFAULT_ENDPOINT && - !@config.endpoint.split(".").first.include?("-")) - credentials ||= Credentials.default scope: @config.scope, - enable_self_signed_jwt: enable_self_signed_jwt - if credentials.is_a?(::String) || credentials.is_a?(::Hash) - credentials = Credentials.new credentials, scope: @config.scope - end - @quota_project_id = @config.quota_project - @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id - - @operations_client = Operations.new do |config| - config.credentials = credentials - config.quota_project = @quota_project_id - config.endpoint = @config.endpoint - config.universe_domain = @config.universe_domain - end - - @model_service_stub = ::Gapic::ServiceStub.new( - ::Google::Cloud::Retail::V2::ModelService::Stub, - credentials: credentials, - endpoint: @config.endpoint, - endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, - universe_domain: @config.universe_domain, - channel_args: @config.channel_args, - interceptors: @config.interceptors, - channel_pool_config: @config.channel_pool, - logger: @config.logger - ) - - @model_service_stub.stub_logger&.info do |entry| - entry.set_system_name - entry.set_service - entry.message = "Created client for #{entry.service}" - entry.set_credentials_fields credentials - entry.set "customEndpoint", @config.endpoint if @config.endpoint - entry.set "defaultTimeout", @config.timeout if @config.timeout - entry.set "quotaProject", @quota_project_id if @quota_project_id - end - - @location_client = Google::Cloud::Location::Locations::Client.new do |config| - config.credentials = credentials - config.quota_project = @quota_project_id - config.endpoint = @model_service_stub.endpoint - config.universe_domain = @model_service_stub.universe_domain - config.logger = @model_service_stub.logger if config.respond_to? :logger= - end - end - - ## - # Get the associated client for long-running operations. - # - # @return [::Google::Cloud::Retail::V2::ModelService::Operations] - # - attr_reader :operations_client - - ## - # Get the associated client for mix-in of the Locations. - # - # @return [Google::Cloud::Location::Locations::Client] - # - attr_reader :location_client - - ## - # The logger used for request/response debug logging. - # - # @return [Logger] - # - def logger - @model_service_stub.logger - end - - # Service calls - - ## - # Creates a new model. - # - # @overload create_model(request, options = nil) - # Pass arguments to `create_model` via a request object, either of type - # {::Google::Cloud::Retail::V2::CreateModelRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::CreateModelRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload create_model(parent: nil, model: nil, dry_run: nil) - # Pass arguments to `create_model` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. The parent resource under which to create the model. Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - # @param model [::Google::Cloud::Retail::V2::Model, ::Hash] - # Required. The payload of the {::Google::Cloud::Retail::V2::Model Model} to - # create. - # @param dry_run [::Boolean] - # Optional. Whether to run a dry run to validate the request (without - # actually creating the model). - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::Operation] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ModelService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::CreateModelRequest.new - # - # # Call the create_model method. - # result = client.create_model request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def create_model request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::CreateModelRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.create_model.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.parent - header_params["parent"] = request.parent - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.create_model.timeout, - metadata: metadata, - retry_policy: @config.rpcs.create_model.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @model_service_stub.call_rpc :create_model, request, options: options do |response, operation| - response = ::Gapic::Operation.new response, @operations_client, options: options - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Gets a model. - # - # @overload get_model(request, options = nil) - # Pass arguments to `get_model` via a request object, either of type - # {::Google::Cloud::Retail::V2::GetModelRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::GetModelRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload get_model(name: nil) - # Pass arguments to `get_model` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # Required. The resource name of the {::Google::Cloud::Retail::V2::Model Model} to - # get. Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog}/models/{model_id}` - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Cloud::Retail::V2::Model] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Cloud::Retail::V2::Model] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ModelService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::GetModelRequest.new - # - # # Call the get_model method. - # result = client.get_model request - # - # # The returned object is of type Google::Cloud::Retail::V2::Model. - # p result - # - def get_model request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::GetModelRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.get_model.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.name - header_params["name"] = request.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.get_model.timeout, - metadata: metadata, - retry_policy: @config.rpcs.get_model.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @model_service_stub.call_rpc :get_model, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Pauses the training of an existing model. - # - # @overload pause_model(request, options = nil) - # Pass arguments to `pause_model` via a request object, either of type - # {::Google::Cloud::Retail::V2::PauseModelRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::PauseModelRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload pause_model(name: nil) - # Pass arguments to `pause_model` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # Required. The name of the model to pause. - # Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Cloud::Retail::V2::Model] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Cloud::Retail::V2::Model] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ModelService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::PauseModelRequest.new - # - # # Call the pause_model method. - # result = client.pause_model request - # - # # The returned object is of type Google::Cloud::Retail::V2::Model. - # p result - # - def pause_model request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::PauseModelRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.pause_model.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.name - header_params["name"] = request.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.pause_model.timeout, - metadata: metadata, - retry_policy: @config.rpcs.pause_model.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @model_service_stub.call_rpc :pause_model, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Resumes the training of an existing model. - # - # @overload resume_model(request, options = nil) - # Pass arguments to `resume_model` via a request object, either of type - # {::Google::Cloud::Retail::V2::ResumeModelRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::ResumeModelRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload resume_model(name: nil) - # Pass arguments to `resume_model` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # Required. The name of the model to resume. - # Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Cloud::Retail::V2::Model] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Cloud::Retail::V2::Model] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ModelService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::ResumeModelRequest.new - # - # # Call the resume_model method. - # result = client.resume_model request - # - # # The returned object is of type Google::Cloud::Retail::V2::Model. - # p result - # - def resume_model request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ResumeModelRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.resume_model.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.name - header_params["name"] = request.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.resume_model.timeout, - metadata: metadata, - retry_policy: @config.rpcs.resume_model.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @model_service_stub.call_rpc :resume_model, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Deletes an existing model. - # - # @overload delete_model(request, options = nil) - # Pass arguments to `delete_model` via a request object, either of type - # {::Google::Cloud::Retail::V2::DeleteModelRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::DeleteModelRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload delete_model(name: nil) - # Pass arguments to `delete_model` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # Required. The resource name of the {::Google::Cloud::Retail::V2::Model Model} to - # delete. Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Protobuf::Empty] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Protobuf::Empty] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ModelService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::DeleteModelRequest.new - # - # # Call the delete_model method. - # result = client.delete_model request - # - # # The returned object is of type Google::Protobuf::Empty. - # p result - # - def delete_model request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::DeleteModelRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.delete_model.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.name - header_params["name"] = request.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.delete_model.timeout, - metadata: metadata, - retry_policy: @config.rpcs.delete_model.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @model_service_stub.call_rpc :delete_model, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Lists all the models linked to this event store. - # - # @overload list_models(request, options = nil) - # Pass arguments to `list_models` via a request object, either of type - # {::Google::Cloud::Retail::V2::ListModelsRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::ListModelsRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload list_models(parent: nil, page_size: nil, page_token: nil) - # Pass arguments to `list_models` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. The parent for which to list models. - # Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - # @param page_size [::Integer] - # Optional. Maximum number of results to return. If unspecified, defaults - # to 50. Max allowed value is 1000. - # @param page_token [::String] - # Optional. A page token, received from a previous `ListModels` - # call. Provide this to retrieve the subsequent page. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Retail::V2::Model>] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::PagedEnumerable<::Google::Cloud::Retail::V2::Model>] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ModelService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::ListModelsRequest.new - # - # # Call the list_models method. - # result = client.list_models request - # - # # The returned object is of type Gapic::PagedEnumerable. You can iterate - # # over elements, and API calls will be issued to fetch pages as needed. - # result.each do |item| - # # Each element is of type ::Google::Cloud::Retail::V2::Model. - # p item - # end - # - def list_models request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ListModelsRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.list_models.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.parent - header_params["parent"] = request.parent - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.list_models.timeout, - metadata: metadata, - retry_policy: @config.rpcs.list_models.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @model_service_stub.call_rpc :list_models, request, options: options do |response, operation| - response = ::Gapic::PagedEnumerable.new @model_service_stub, :list_models, request, response, operation, options - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Update of model metadata. Only fields that - # currently can be updated are: `filtering_option` and - # `periodic_tuning_state`. - # If other values are provided, this API method ignores them. - # - # @overload update_model(request, options = nil) - # Pass arguments to `update_model` via a request object, either of type - # {::Google::Cloud::Retail::V2::UpdateModelRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::UpdateModelRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload update_model(model: nil, update_mask: nil) - # Pass arguments to `update_model` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param model [::Google::Cloud::Retail::V2::Model, ::Hash] - # Required. The body of the updated {::Google::Cloud::Retail::V2::Model Model}. - # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] - # Optional. Indicates which fields in the provided 'model' to - # update. If not set, by default updates all fields. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Cloud::Retail::V2::Model] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Cloud::Retail::V2::Model] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ModelService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::UpdateModelRequest.new - # - # # Call the update_model method. - # result = client.update_model request - # - # # The returned object is of type Google::Cloud::Retail::V2::Model. - # p result - # - def update_model request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::UpdateModelRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.update_model.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.model&.name - header_params["model.name"] = request.model.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.update_model.timeout, - metadata: metadata, - retry_policy: @config.rpcs.update_model.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @model_service_stub.call_rpc :update_model, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Tunes an existing model. - # - # @overload tune_model(request, options = nil) - # Pass arguments to `tune_model` via a request object, either of type - # {::Google::Cloud::Retail::V2::TuneModelRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::TuneModelRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload tune_model(name: nil) - # Pass arguments to `tune_model` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # Required. The resource name of the model to tune. - # Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::Operation] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ModelService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::TuneModelRequest.new - # - # # Call the tune_model method. - # result = client.tune_model request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def tune_model request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::TuneModelRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.tune_model.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.name - header_params["name"] = request.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.tune_model.timeout, - metadata: metadata, - retry_policy: @config.rpcs.tune_model.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @model_service_stub.call_rpc :tune_model, request, options: options do |response, operation| - response = ::Gapic::Operation.new response, @operations_client, options: options - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Configuration class for the ModelService API. - # - # This class represents the configuration for ModelService, - # providing control over timeouts, retry behavior, logging, transport - # parameters, and other low-level controls. Certain parameters can also be - # applied individually to specific RPCs. See - # {::Google::Cloud::Retail::V2::ModelService::Client::Configuration::Rpcs} - # for a list of RPCs that can be configured independently. - # - # Configuration can be applied globally to all clients, or to a single client - # on construction. - # - # @example - # - # # Modify the global config, setting the timeout for - # # create_model to 20 seconds, - # # and all remaining timeouts to 10 seconds. - # ::Google::Cloud::Retail::V2::ModelService::Client.configure do |config| - # config.timeout = 10.0 - # config.rpcs.create_model.timeout = 20.0 - # end - # - # # Apply the above configuration only to a new client. - # client = ::Google::Cloud::Retail::V2::ModelService::Client.new do |config| - # config.timeout = 10.0 - # config.rpcs.create_model.timeout = 20.0 - # end - # - # @!attribute [rw] endpoint - # A custom service endpoint, as a hostname or hostname:port. The default is - # nil, indicating to use the default endpoint in the current universe domain. - # @return [::String,nil] - # @!attribute [rw] credentials - # Credentials to send with calls. You may provide any of the following types: - # * (`Google::Auth::Credentials`) A googleauth credentials object - # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) - # * (`Signet::OAuth2::Client`) A signet oauth2 client object - # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) - # * (`GRPC::Core::Channel`) a gRPC channel with included credentials - # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object - # * (`nil`) indicating no credentials - # - # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials - # is deprecated. Providing an unvalidated credential configuration to - # Google APIs can compromise the security of your systems and data. - # - # @example - # - # # The recommended way to provide credentials is to use the `make_creds` method - # # on the appropriate credentials class for your environment. - # - # require "googleauth" - # - # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds( - # json_key_io: ::File.open("/path/to/keyfile.json") - # ) - # - # client = ::Google::Cloud::Retail::V2::ModelService::Client.new do |config| - # config.credentials = credentials - # end - # - # @note Warning: If you accept a credential configuration (JSON file or Hash) from an - # external source for authentication to Google Cloud, you must validate it before - # providing it to a Google API client library. Providing an unvalidated credential - # configuration to Google APIs can compromise the security of your systems and data. - # For more information, refer to [Validate credential configurations from external - # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). - # @return [::Object] - # @!attribute [rw] scope - # The OAuth scopes - # @return [::Array<::String>] - # @!attribute [rw] lib_name - # The library name as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] lib_version - # The library version as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] channel_args - # Extra parameters passed to the gRPC channel. Note: this is ignored if a - # `GRPC::Core::Channel` object is provided as the credential. - # @return [::Hash] - # @!attribute [rw] interceptors - # An array of interceptors that are run before calls are executed. - # @return [::Array<::GRPC::ClientInterceptor>] - # @!attribute [rw] timeout - # The call timeout in seconds. - # @return [::Numeric] - # @!attribute [rw] metadata - # Additional gRPC headers to be sent with the call. - # @return [::Hash{::Symbol=>::String}] - # @!attribute [rw] retry_policy - # The retry policy. The value is a hash with the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # @return [::Hash] - # @!attribute [rw] quota_project - # A separate project against which to charge quota. - # @return [::String] - # @!attribute [rw] universe_domain - # The universe domain within which to make requests. This determines the - # default endpoint URL. The default value of nil uses the environment - # universe (usually the default "googleapis.com" universe). - # @return [::String,nil] - # @!attribute [rw] logger - # A custom logger to use for request/response debug logging, or the value - # `:default` (the default) to construct a default logger, or `nil` to - # explicitly disable logging. - # @return [::Logger,:default,nil] - # - class Configuration - extend ::Gapic::Config - - # @private - # The endpoint specific to the default "googleapis.com" universe. Deprecated. - DEFAULT_ENDPOINT = "retail.googleapis.com" - - config_attr :endpoint, nil, ::String, nil - config_attr :credentials, nil do |value| - allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] - allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel - allowed.any? { |klass| klass === value } - end - config_attr :scope, nil, ::String, ::Array, nil - config_attr :lib_name, nil, ::String, nil - config_attr :lib_version, nil, ::String, nil - config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) - config_attr :interceptors, nil, ::Array, nil - config_attr :timeout, nil, ::Numeric, nil - config_attr :metadata, nil, ::Hash, nil - config_attr :retry_policy, nil, ::Hash, ::Proc, nil - config_attr :quota_project, nil, ::String, nil - config_attr :universe_domain, nil, ::String, nil - config_attr :logger, :default, ::Logger, nil, :default - - # @private - def initialize parent_config = nil - @parent_config = parent_config unless parent_config.nil? - - yield self if block_given? - end - - ## - # Configurations for individual RPCs - # @return [Rpcs] - # - def rpcs - @rpcs ||= begin - parent_rpcs = nil - parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) - Rpcs.new parent_rpcs - end - end - - ## - # Configuration for the channel pool - # @return [::Gapic::ServiceStub::ChannelPool::Configuration] - # - def channel_pool - @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new - end - - ## - # Configuration RPC class for the ModelService API. - # - # Includes fields providing the configuration for each RPC in this service. - # Each configuration object is of type `Gapic::Config::Method` and includes - # the following configuration fields: - # - # * `timeout` (*type:* `Numeric`) - The call timeout in seconds - # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers - # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields - # include the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # - class Rpcs - ## - # RPC-specific configuration for `create_model` - # @return [::Gapic::Config::Method] - # - attr_reader :create_model - ## - # RPC-specific configuration for `get_model` - # @return [::Gapic::Config::Method] - # - attr_reader :get_model - ## - # RPC-specific configuration for `pause_model` - # @return [::Gapic::Config::Method] - # - attr_reader :pause_model - ## - # RPC-specific configuration for `resume_model` - # @return [::Gapic::Config::Method] - # - attr_reader :resume_model - ## - # RPC-specific configuration for `delete_model` - # @return [::Gapic::Config::Method] - # - attr_reader :delete_model - ## - # RPC-specific configuration for `list_models` - # @return [::Gapic::Config::Method] - # - attr_reader :list_models - ## - # RPC-specific configuration for `update_model` - # @return [::Gapic::Config::Method] - # - attr_reader :update_model - ## - # RPC-specific configuration for `tune_model` - # @return [::Gapic::Config::Method] - # - attr_reader :tune_model - - # @private - def initialize parent_rpcs = nil - create_model_config = parent_rpcs.create_model if parent_rpcs.respond_to? :create_model - @create_model = ::Gapic::Config::Method.new create_model_config - get_model_config = parent_rpcs.get_model if parent_rpcs.respond_to? :get_model - @get_model = ::Gapic::Config::Method.new get_model_config - pause_model_config = parent_rpcs.pause_model if parent_rpcs.respond_to? :pause_model - @pause_model = ::Gapic::Config::Method.new pause_model_config - resume_model_config = parent_rpcs.resume_model if parent_rpcs.respond_to? :resume_model - @resume_model = ::Gapic::Config::Method.new resume_model_config - delete_model_config = parent_rpcs.delete_model if parent_rpcs.respond_to? :delete_model - @delete_model = ::Gapic::Config::Method.new delete_model_config - list_models_config = parent_rpcs.list_models if parent_rpcs.respond_to? :list_models - @list_models = ::Gapic::Config::Method.new list_models_config - update_model_config = parent_rpcs.update_model if parent_rpcs.respond_to? :update_model - @update_model = ::Gapic::Config::Method.new update_model_config - tune_model_config = parent_rpcs.tune_model if parent_rpcs.respond_to? :tune_model - @tune_model = ::Gapic::Config::Method.new tune_model_config - - yield self if block_given? - end - end - end - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/credentials.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/credentials.rb deleted file mode 100644 index acf6300e811b..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/credentials.rb +++ /dev/null @@ -1,51 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "googleauth" - -module Google - module Cloud - module Retail - module V2 - module ModelService - # Credentials for the ModelService API. - class Credentials < ::Google::Auth::Credentials - self.scope = [ - "https://www.googleapis.com/auth/cloud-platform" - ] - self.env_vars = [ - "RETAIL_CREDENTIALS", - "RETAIL_KEYFILE", - "GOOGLE_CLOUD_CREDENTIALS", - "GOOGLE_CLOUD_KEYFILE", - "GCLOUD_KEYFILE", - "RETAIL_CREDENTIALS_JSON", - "RETAIL_KEYFILE_JSON", - "GOOGLE_CLOUD_CREDENTIALS_JSON", - "GOOGLE_CLOUD_KEYFILE_JSON", - "GCLOUD_KEYFILE_JSON" - ] - self.paths = [ - "~/.config/google_cloud/application_default_credentials.json" - ] - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/operations.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/operations.rb deleted file mode 100644 index ae16a84e1ee1..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/operations.rb +++ /dev/null @@ -1,843 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "gapic/operation" -require "google/longrunning/operations_pb" - -module Google - module Cloud - module Retail - module V2 - module ModelService - # Service that implements Longrunning Operations API. - class Operations - # @private - API_VERSION = "" - - # @private - DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" - - # @private - attr_reader :operations_stub - - ## - # Configuration for the ModelService Operations API. - # - # @yield [config] Configure the Operations client. - # @yieldparam config [Operations::Configuration] - # - # @return [Operations::Configuration] - # - def self.configure - @configure ||= Operations::Configuration.new - yield @configure if block_given? - @configure - end - - ## - # Configure the ModelService Operations instance. - # - # The configuration is set to the derived mode, meaning that values can be changed, - # but structural changes (adding new fields, etc.) are not allowed. Structural changes - # should be made on {Operations.configure}. - # - # @yield [config] Configure the Operations client. - # @yieldparam config [Operations::Configuration] - # - # @return [Operations::Configuration] - # - def configure - yield @config if block_given? - @config - end - - ## - # The effective universe domain - # - # @return [String] - # - def universe_domain - @operations_stub.universe_domain - end - - ## - # Create a new Operations client object. - # - # @yield [config] Configure the Client client. - # @yieldparam config [Operations::Configuration] - # - def initialize - # These require statements are intentionally placed here to initialize - # the gRPC module only when it's required. - # See https://github.com/googleapis/toolkit/issues/446 - require "gapic/grpc" - require "google/longrunning/operations_services_pb" - - # Create the configuration object - @config = Configuration.new Operations.configure - - # Yield the configuration if needed - yield @config if block_given? - - # Create credentials - credentials = @config.credentials - credentials ||= Credentials.default scope: @config.scope - if credentials.is_a?(::String) || credentials.is_a?(::Hash) - credentials = Credentials.new credentials, scope: @config.scope - end - @quota_project_id = @config.quota_project - @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id - - @operations_stub = ::Gapic::ServiceStub.new( - ::Google::Longrunning::Operations::Stub, - credentials: credentials, - endpoint: @config.endpoint, - endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, - universe_domain: @config.universe_domain, - channel_args: @config.channel_args, - interceptors: @config.interceptors, - channel_pool_config: @config.channel_pool - ) - - # Used by an LRO wrapper for some methods of this service - @operations_client = self - end - - # Service calls - - ## - # Lists operations that match the specified filter in the request. If the - # server doesn't support this method, it returns `UNIMPLEMENTED`. - # - # @overload list_operations(request, options = nil) - # Pass arguments to `list_operations` via a request object, either of type - # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::ListOperationsRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload list_operations(name: nil, filter: nil, page_size: nil, page_token: nil, return_partial_success: nil) - # Pass arguments to `list_operations` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation's parent resource. - # @param filter [::String] - # The standard list filter. - # @param page_size [::Integer] - # The standard list page size. - # @param page_token [::String] - # The standard list page token. - # @param return_partial_success [::Boolean] - # When set to `true`, operations that are reachable are returned as normal, - # and those that are unreachable are returned in the - # [ListOperationsResponse.unreachable] field. - # - # This can only be `true` when reading across collections e.g. when `parent` - # is set to `"projects/example/locations/-"`. - # - # This field is not by default supported and will result in an - # `UNIMPLEMENTED` error if set unless explicitly documented otherwise in - # service or product specific documentation. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::PagedEnumerable<::Gapic::Operation>] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::PagedEnumerable<::Gapic::Operation>] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::ListOperationsRequest.new - # - # # Call the list_operations method. - # result = client.list_operations request - # - # # The returned object is of type Gapic::PagedEnumerable. You can iterate - # # over elements, and API calls will be issued to fetch pages as needed. - # result.each do |item| - # # Each element is of type ::Google::Longrunning::Operation. - # p item - # end - # - def list_operations request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::ListOperationsRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.list_operations.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.name - header_params["name"] = request.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.list_operations.timeout, - metadata: metadata, - retry_policy: @config.rpcs.list_operations.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.call_rpc :list_operations, request, options: options do |response, operation| - wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client } - response = ::Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Gets the latest state of a long-running operation. Clients can use this - # method to poll the operation result at intervals as recommended by the API - # service. - # - # @overload get_operation(request, options = nil) - # Pass arguments to `get_operation` via a request object, either of type - # {::Google::Longrunning::GetOperationRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::GetOperationRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload get_operation(name: nil) - # Pass arguments to `get_operation` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation resource. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::Operation] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::GetOperationRequest.new - # - # # Call the get_operation method. - # result = client.get_operation request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def get_operation request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::GetOperationRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.get_operation.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.name - header_params["name"] = request.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.get_operation.timeout, - metadata: metadata, - retry_policy: @config.rpcs.get_operation.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.call_rpc :get_operation, request, options: options do |response, operation| - response = ::Gapic::Operation.new response, @operations_client, options: options - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Deletes a long-running operation. This method indicates that the client is - # no longer interested in the operation result. It does not cancel the - # operation. If the server doesn't support this method, it returns - # `google.rpc.Code.UNIMPLEMENTED`. - # - # @overload delete_operation(request, options = nil) - # Pass arguments to `delete_operation` via a request object, either of type - # {::Google::Longrunning::DeleteOperationRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::DeleteOperationRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload delete_operation(name: nil) - # Pass arguments to `delete_operation` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation resource to be deleted. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Protobuf::Empty] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Protobuf::Empty] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::DeleteOperationRequest.new - # - # # Call the delete_operation method. - # result = client.delete_operation request - # - # # The returned object is of type Google::Protobuf::Empty. - # p result - # - def delete_operation request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::DeleteOperationRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.delete_operation.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.name - header_params["name"] = request.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.delete_operation.timeout, - metadata: metadata, - retry_policy: @config.rpcs.delete_operation.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.call_rpc :delete_operation, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Starts asynchronous cancellation on a long-running operation. The server - # makes a best effort to cancel the operation, but success is not - # guaranteed. If the server doesn't support this method, it returns - # `google.rpc.Code.UNIMPLEMENTED`. Clients can use - # Operations.GetOperation or - # other methods to check whether the cancellation succeeded or whether the - # operation completed despite cancellation. On successful cancellation, - # the operation is not deleted; instead, it becomes an operation with - # an {::Google::Longrunning::Operation#error Operation.error} value with a - # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to - # `Code.CANCELLED`. - # - # @overload cancel_operation(request, options = nil) - # Pass arguments to `cancel_operation` via a request object, either of type - # {::Google::Longrunning::CancelOperationRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::CancelOperationRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload cancel_operation(name: nil) - # Pass arguments to `cancel_operation` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation resource to be cancelled. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Protobuf::Empty] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Protobuf::Empty] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::CancelOperationRequest.new - # - # # Call the cancel_operation method. - # result = client.cancel_operation request - # - # # The returned object is of type Google::Protobuf::Empty. - # p result - # - def cancel_operation request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::CancelOperationRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.cancel_operation.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.name - header_params["name"] = request.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.cancel_operation.timeout, - metadata: metadata, - retry_policy: @config.rpcs.cancel_operation.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Waits until the specified long-running operation is done or reaches at most - # a specified timeout, returning the latest state. If the operation is - # already done, the latest state is immediately returned. If the timeout - # specified is greater than the default HTTP/RPC timeout, the HTTP/RPC - # timeout is used. If the server does not support this method, it returns - # `google.rpc.Code.UNIMPLEMENTED`. - # Note that this method is on a best-effort basis. It may return the latest - # state before the specified timeout (including immediately), meaning even an - # immediate response is no guarantee that the operation is done. - # - # @overload wait_operation(request, options = nil) - # Pass arguments to `wait_operation` via a request object, either of type - # {::Google::Longrunning::WaitOperationRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::WaitOperationRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload wait_operation(name: nil, timeout: nil) - # Pass arguments to `wait_operation` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation resource to wait on. - # @param timeout [::Google::Protobuf::Duration, ::Hash] - # The maximum duration to wait before timing out. If left blank, the wait - # will be at most the time permitted by the underlying HTTP/RPC protocol. - # If RPC context deadline is also specified, the shorter one will be used. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::Operation] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::WaitOperationRequest.new - # - # # Call the wait_operation method. - # result = client.wait_operation request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def wait_operation request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::WaitOperationRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.wait_operation.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.wait_operation.timeout, - metadata: metadata, - retry_policy: @config.rpcs.wait_operation.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation| - response = ::Gapic::Operation.new response, @operations_client, options: options - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Configuration class for the Operations API. - # - # This class represents the configuration for Operations, - # providing control over timeouts, retry behavior, logging, transport - # parameters, and other low-level controls. Certain parameters can also be - # applied individually to specific RPCs. See - # {::Google::Longrunning::Operations::Client::Configuration::Rpcs} - # for a list of RPCs that can be configured independently. - # - # Configuration can be applied globally to all clients, or to a single client - # on construction. - # - # @example - # - # # Modify the global config, setting the timeout for - # # list_operations to 20 seconds, - # # and all remaining timeouts to 10 seconds. - # ::Google::Longrunning::Operations::Client.configure do |config| - # config.timeout = 10.0 - # config.rpcs.list_operations.timeout = 20.0 - # end - # - # # Apply the above configuration only to a new client. - # client = ::Google::Longrunning::Operations::Client.new do |config| - # config.timeout = 10.0 - # config.rpcs.list_operations.timeout = 20.0 - # end - # - # @!attribute [rw] endpoint - # A custom service endpoint, as a hostname or hostname:port. The default is - # nil, indicating to use the default endpoint in the current universe domain. - # @return [::String,nil] - # @!attribute [rw] credentials - # Credentials to send with calls. You may provide any of the following types: - # * (`Google::Auth::Credentials`) A googleauth credentials object - # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) - # * (`Signet::OAuth2::Client`) A signet oauth2 client object - # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) - # * (`GRPC::Core::Channel`) a gRPC channel with included credentials - # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object - # * (`nil`) indicating no credentials - # - # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials - # is deprecated. Providing an unvalidated credential configuration to - # Google APIs can compromise the security of your systems and data. - # - # @example - # - # # The recommended way to provide credentials is to use the `make_creds` method - # # on the appropriate credentials class for your environment. - # - # require "googleauth" - # - # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds( - # json_key_io: ::File.open("/path/to/keyfile.json") - # ) - # - # client = ::Google::Longrunning::Operations::Client.new do |config| - # config.credentials = credentials - # end - # - # @note Warning: If you accept a credential configuration (JSON file or Hash) from an - # external source for authentication to Google Cloud, you must validate it before - # providing it to a Google API client library. Providing an unvalidated credential - # configuration to Google APIs can compromise the security of your systems and data. - # For more information, refer to [Validate credential configurations from external - # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). - # @return [::Object] - # @!attribute [rw] scope - # The OAuth scopes - # @return [::Array<::String>] - # @!attribute [rw] lib_name - # The library name as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] lib_version - # The library version as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] channel_args - # Extra parameters passed to the gRPC channel. Note: this is ignored if a - # `GRPC::Core::Channel` object is provided as the credential. - # @return [::Hash] - # @!attribute [rw] interceptors - # An array of interceptors that are run before calls are executed. - # @return [::Array<::GRPC::ClientInterceptor>] - # @!attribute [rw] timeout - # The call timeout in seconds. - # @return [::Numeric] - # @!attribute [rw] metadata - # Additional gRPC headers to be sent with the call. - # @return [::Hash{::Symbol=>::String}] - # @!attribute [rw] retry_policy - # The retry policy. The value is a hash with the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # @return [::Hash] - # @!attribute [rw] quota_project - # A separate project against which to charge quota. - # @return [::String] - # @!attribute [rw] universe_domain - # The universe domain within which to make requests. This determines the - # default endpoint URL. The default value of nil uses the environment - # universe (usually the default "googleapis.com" universe). - # @return [::String,nil] - # @!attribute [rw] logger - # A custom logger to use for request/response debug logging, or the value - # `:default` (the default) to construct a default logger, or `nil` to - # explicitly disable logging. - # @return [::Logger,:default,nil] - # - class Configuration - extend ::Gapic::Config - - # @private - # The endpoint specific to the default "googleapis.com" universe. Deprecated. - DEFAULT_ENDPOINT = "retail.googleapis.com" - - config_attr :endpoint, nil, ::String, nil - config_attr :credentials, nil do |value| - allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] - allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel - allowed.any? { |klass| klass === value } - end - config_attr :scope, nil, ::String, ::Array, nil - config_attr :lib_name, nil, ::String, nil - config_attr :lib_version, nil, ::String, nil - config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) - config_attr :interceptors, nil, ::Array, nil - config_attr :timeout, nil, ::Numeric, nil - config_attr :metadata, nil, ::Hash, nil - config_attr :retry_policy, nil, ::Hash, ::Proc, nil - config_attr :quota_project, nil, ::String, nil - config_attr :universe_domain, nil, ::String, nil - config_attr :logger, :default, ::Logger, nil, :default - - # @private - def initialize parent_config = nil - @parent_config = parent_config unless parent_config.nil? - - yield self if block_given? - end - - ## - # Configurations for individual RPCs - # @return [Rpcs] - # - def rpcs - @rpcs ||= begin - parent_rpcs = nil - parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) - Rpcs.new parent_rpcs - end - end - - ## - # Configuration for the channel pool - # @return [::Gapic::ServiceStub::ChannelPool::Configuration] - # - def channel_pool - @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new - end - - ## - # Configuration RPC class for the Operations API. - # - # Includes fields providing the configuration for each RPC in this service. - # Each configuration object is of type `Gapic::Config::Method` and includes - # the following configuration fields: - # - # * `timeout` (*type:* `Numeric`) - The call timeout in seconds - # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers - # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields - # include the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # - class Rpcs - ## - # RPC-specific configuration for `list_operations` - # @return [::Gapic::Config::Method] - # - attr_reader :list_operations - ## - # RPC-specific configuration for `get_operation` - # @return [::Gapic::Config::Method] - # - attr_reader :get_operation - ## - # RPC-specific configuration for `delete_operation` - # @return [::Gapic::Config::Method] - # - attr_reader :delete_operation - ## - # RPC-specific configuration for `cancel_operation` - # @return [::Gapic::Config::Method] - # - attr_reader :cancel_operation - ## - # RPC-specific configuration for `wait_operation` - # @return [::Gapic::Config::Method] - # - attr_reader :wait_operation - - # @private - def initialize parent_rpcs = nil - list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations - @list_operations = ::Gapic::Config::Method.new list_operations_config - get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation - @get_operation = ::Gapic::Config::Method.new get_operation_config - delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation - @delete_operation = ::Gapic::Config::Method.new delete_operation_config - cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation - @cancel_operation = ::Gapic::Config::Method.new cancel_operation_config - wait_operation_config = parent_rpcs.wait_operation if parent_rpcs.respond_to? :wait_operation - @wait_operation = ::Gapic::Config::Method.new wait_operation_config - - yield self if block_given? - end - end - end - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/paths.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/paths.rb deleted file mode 100644 index dfac159c4ef5..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/paths.rb +++ /dev/null @@ -1,73 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Cloud - module Retail - module V2 - module ModelService - # Path helper methods for the ModelService API. - module Paths - ## - # Create a fully-qualified Catalog resource string. - # - # The resource will be in the following format: - # - # `projects/{project}/locations/{location}/catalogs/{catalog}` - # - # @param project [String] - # @param location [String] - # @param catalog [String] - # - # @return [::String] - def catalog_path project:, location:, catalog: - raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" - raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" - - "projects/#{project}/locations/#{location}/catalogs/#{catalog}" - end - - ## - # Create a fully-qualified Model resource string. - # - # The resource will be in the following format: - # - # `projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}` - # - # @param project [String] - # @param location [String] - # @param catalog [String] - # @param model [String] - # - # @return [::String] - def model_path project:, location:, catalog:, model: - raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" - raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" - raise ::ArgumentError, "catalog cannot contain /" if catalog.to_s.include? "/" - - "projects/#{project}/locations/#{location}/catalogs/#{catalog}/models/#{model}" - end - - extend self - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/rest.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/rest.rb deleted file mode 100644 index 09cc5600da6e..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/rest.rb +++ /dev/null @@ -1,64 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "gapic/rest" -require "gapic/config" -require "gapic/config/method" - -require "google/cloud/retail/v2/version" - -require "google/cloud/retail/v2/model_service/credentials" -require "google/cloud/retail/v2/model_service/paths" -require "google/cloud/retail/v2/model_service/rest/operations" -require "google/cloud/retail/v2/model_service/rest/client" - -module Google - module Cloud - module Retail - module V2 - ## - # Service for performing CRUD operations on models. - # Recommendation models contain all the metadata necessary to generate a set of - # models for the `Predict()` API. A model is queried - # indirectly via a ServingConfig, which associates a model with a - # given Placement (e.g. Frequently Bought Together on Home Page). - # - # This service allows you to do the following: - # - # * Initiate training of a model. - # * Pause training of an existing model. - # * List all the available models along with their metadata. - # * Control their tuning schedule. - # - # To load this service and instantiate a REST client: - # - # require "google/cloud/retail/v2/model_service/rest" - # client = ::Google::Cloud::Retail::V2::ModelService::Rest::Client.new - # - module ModelService - # Client for the REST transport - module Rest - end - end - end - end - end -end - -helper_path = ::File.join __dir__, "rest", "helpers.rb" -require "google/cloud/retail/v2/model_service/rest/helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/rest/client.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/rest/client.rb deleted file mode 100644 index 9c772ac0f01c..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/rest/client.rb +++ /dev/null @@ -1,1122 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "google/cloud/errors" -require "google/cloud/retail/v2/model_service_pb" -require "google/cloud/retail/v2/model_service/rest/service_stub" -require "google/cloud/location/rest" - -module Google - module Cloud - module Retail - module V2 - module ModelService - module Rest - ## - # REST client for the ModelService service. - # - # Service for performing CRUD operations on models. - # Recommendation models contain all the metadata necessary to generate a set of - # models for the `Predict()` API. A model is queried - # indirectly via a ServingConfig, which associates a model with a - # given Placement (e.g. Frequently Bought Together on Home Page). - # - # This service allows you to do the following: - # - # * Initiate training of a model. - # * Pause training of an existing model. - # * List all the available models along with their metadata. - # * Control their tuning schedule. - # - class Client - # @private - API_VERSION = "" - - # @private - DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" - - include Paths - - # @private - attr_reader :model_service_stub - - ## - # Configure the ModelService Client class. - # - # See {::Google::Cloud::Retail::V2::ModelService::Rest::Client::Configuration} - # for a description of the configuration fields. - # - # @example - # - # # Modify the configuration for all ModelService clients - # ::Google::Cloud::Retail::V2::ModelService::Rest::Client.configure do |config| - # config.timeout = 10.0 - # end - # - # @yield [config] Configure the Client client. - # @yieldparam config [Client::Configuration] - # - # @return [Client::Configuration] - # - def self.configure - @configure ||= begin - namespace = ["Google", "Cloud", "Retail", "V2"] - parent_config = while namespace.any? - parent_name = namespace.join "::" - parent_const = const_get parent_name - break parent_const.configure if parent_const.respond_to? :configure - namespace.pop - end - default_config = Client::Configuration.new parent_config - - default_config.timeout = 60.0 - default_config.retry_policy = { - initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4] - } - - default_config - end - yield @configure if block_given? - @configure - end - - ## - # Configure the ModelService Client instance. - # - # The configuration is set to the derived mode, meaning that values can be changed, - # but structural changes (adding new fields, etc.) are not allowed. Structural changes - # should be made on {Client.configure}. - # - # See {::Google::Cloud::Retail::V2::ModelService::Rest::Client::Configuration} - # for a description of the configuration fields. - # - # @yield [config] Configure the Client client. - # @yieldparam config [Client::Configuration] - # - # @return [Client::Configuration] - # - def configure - yield @config if block_given? - @config - end - - ## - # The effective universe domain - # - # @return [String] - # - def universe_domain - @model_service_stub.universe_domain - end - - ## - # Create a new ModelService REST client object. - # - # @example - # - # # Create a client using the default configuration - # client = ::Google::Cloud::Retail::V2::ModelService::Rest::Client.new - # - # # Create a client using a custom configuration - # client = ::Google::Cloud::Retail::V2::ModelService::Rest::Client.new do |config| - # config.timeout = 10.0 - # end - # - # @yield [config] Configure the ModelService client. - # @yieldparam config [Client::Configuration] - # - def initialize - # Create the configuration object - @config = Configuration.new Client.configure - - # Yield the configuration if needed - yield @config if block_given? - - # Create credentials - credentials = @config.credentials - # Use self-signed JWT if the endpoint is unchanged from default, - # but only if the default endpoint does not have a region prefix. - enable_self_signed_jwt = @config.endpoint.nil? || - (@config.endpoint == Configuration::DEFAULT_ENDPOINT && - !@config.endpoint.split(".").first.include?("-")) - credentials ||= Credentials.default scope: @config.scope, - enable_self_signed_jwt: enable_self_signed_jwt - if credentials.is_a?(::String) || credentials.is_a?(::Hash) - credentials = Credentials.new credentials, scope: @config.scope - end - - @quota_project_id = @config.quota_project - @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id - - @operations_client = ::Google::Cloud::Retail::V2::ModelService::Rest::Operations.new do |config| - config.credentials = credentials - config.quota_project = @quota_project_id - config.endpoint = @config.endpoint - config.universe_domain = @config.universe_domain - end - - @model_service_stub = ::Google::Cloud::Retail::V2::ModelService::Rest::ServiceStub.new( - endpoint: @config.endpoint, - endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, - universe_domain: @config.universe_domain, - credentials: credentials, - logger: @config.logger - ) - - @model_service_stub.logger(stub: true)&.info do |entry| - entry.set_system_name - entry.set_service - entry.message = "Created client for #{entry.service}" - entry.set_credentials_fields credentials - entry.set "customEndpoint", @config.endpoint if @config.endpoint - entry.set "defaultTimeout", @config.timeout if @config.timeout - entry.set "quotaProject", @quota_project_id if @quota_project_id - end - - @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config| - config.credentials = credentials - config.quota_project = @quota_project_id - config.endpoint = @model_service_stub.endpoint - config.universe_domain = @model_service_stub.universe_domain - config.logger = @model_service_stub.logger if config.respond_to? :logger= - end - end - - ## - # Get the associated client for long-running operations. - # - # @return [::Google::Cloud::Retail::V2::ModelService::Rest::Operations] - # - attr_reader :operations_client - - ## - # Get the associated client for mix-in of the Locations. - # - # @return [Google::Cloud::Location::Locations::Rest::Client] - # - attr_reader :location_client - - ## - # The logger used for request/response debug logging. - # - # @return [Logger] - # - def logger - @model_service_stub.logger - end - - # Service calls - - ## - # Creates a new model. - # - # @overload create_model(request, options = nil) - # Pass arguments to `create_model` via a request object, either of type - # {::Google::Cloud::Retail::V2::CreateModelRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::CreateModelRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload create_model(parent: nil, model: nil, dry_run: nil) - # Pass arguments to `create_model` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. The parent resource under which to create the model. Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - # @param model [::Google::Cloud::Retail::V2::Model, ::Hash] - # Required. The payload of the {::Google::Cloud::Retail::V2::Model Model} to - # create. - # @param dry_run [::Boolean] - # Optional. Whether to run a dry run to validate the request (without - # actually creating the model). - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Gapic::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ModelService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::CreateModelRequest.new - # - # # Call the create_model method. - # result = client.create_model request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def create_model request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::CreateModelRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.create_model.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.create_model.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.create_model.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @model_service_stub.create_model request, options do |result, operation| - result = ::Gapic::Operation.new result, @operations_client, options: options - yield result, operation if block_given? - throw :response, result - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Gets a model. - # - # @overload get_model(request, options = nil) - # Pass arguments to `get_model` via a request object, either of type - # {::Google::Cloud::Retail::V2::GetModelRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::GetModelRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload get_model(name: nil) - # Pass arguments to `get_model` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # Required. The resource name of the {::Google::Cloud::Retail::V2::Model Model} to - # get. Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog}/models/{model_id}` - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::Model] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::Model] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ModelService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::GetModelRequest.new - # - # # Call the get_model method. - # result = client.get_model request - # - # # The returned object is of type Google::Cloud::Retail::V2::Model. - # p result - # - def get_model request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::GetModelRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.get_model.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.get_model.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.get_model.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @model_service_stub.get_model request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Pauses the training of an existing model. - # - # @overload pause_model(request, options = nil) - # Pass arguments to `pause_model` via a request object, either of type - # {::Google::Cloud::Retail::V2::PauseModelRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::PauseModelRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload pause_model(name: nil) - # Pass arguments to `pause_model` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # Required. The name of the model to pause. - # Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::Model] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::Model] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ModelService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::PauseModelRequest.new - # - # # Call the pause_model method. - # result = client.pause_model request - # - # # The returned object is of type Google::Cloud::Retail::V2::Model. - # p result - # - def pause_model request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::PauseModelRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.pause_model.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.pause_model.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.pause_model.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @model_service_stub.pause_model request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Resumes the training of an existing model. - # - # @overload resume_model(request, options = nil) - # Pass arguments to `resume_model` via a request object, either of type - # {::Google::Cloud::Retail::V2::ResumeModelRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::ResumeModelRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload resume_model(name: nil) - # Pass arguments to `resume_model` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # Required. The name of the model to resume. - # Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::Model] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::Model] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ModelService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::ResumeModelRequest.new - # - # # Call the resume_model method. - # result = client.resume_model request - # - # # The returned object is of type Google::Cloud::Retail::V2::Model. - # p result - # - def resume_model request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ResumeModelRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.resume_model.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.resume_model.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.resume_model.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @model_service_stub.resume_model request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Deletes an existing model. - # - # @overload delete_model(request, options = nil) - # Pass arguments to `delete_model` via a request object, either of type - # {::Google::Cloud::Retail::V2::DeleteModelRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::DeleteModelRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload delete_model(name: nil) - # Pass arguments to `delete_model` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # Required. The resource name of the {::Google::Cloud::Retail::V2::Model Model} to - # delete. Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Protobuf::Empty] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Protobuf::Empty] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ModelService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::DeleteModelRequest.new - # - # # Call the delete_model method. - # result = client.delete_model request - # - # # The returned object is of type Google::Protobuf::Empty. - # p result - # - def delete_model request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::DeleteModelRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.delete_model.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.delete_model.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.delete_model.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @model_service_stub.delete_model request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Lists all the models linked to this event store. - # - # @overload list_models(request, options = nil) - # Pass arguments to `list_models` via a request object, either of type - # {::Google::Cloud::Retail::V2::ListModelsRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::ListModelsRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload list_models(parent: nil, page_size: nil, page_token: nil) - # Pass arguments to `list_models` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. The parent for which to list models. - # Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - # @param page_size [::Integer] - # Optional. Maximum number of results to return. If unspecified, defaults - # to 50. Max allowed value is 1000. - # @param page_token [::String] - # Optional. A page token, received from a previous `ListModels` - # call. Provide this to retrieve the subsequent page. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Retail::V2::Model>] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Retail::V2::Model>] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ModelService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::ListModelsRequest.new - # - # # Call the list_models method. - # result = client.list_models request - # - # # The returned object is of type Gapic::PagedEnumerable. You can iterate - # # over elements, and API calls will be issued to fetch pages as needed. - # result.each do |item| - # # Each element is of type ::Google::Cloud::Retail::V2::Model. - # p item - # end - # - def list_models request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ListModelsRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.list_models.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.list_models.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.list_models.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @model_service_stub.list_models request, options do |result, operation| - result = ::Gapic::Rest::PagedEnumerable.new @model_service_stub, :list_models, "models", request, result, options - yield result, operation if block_given? - throw :response, result - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Update of model metadata. Only fields that - # currently can be updated are: `filtering_option` and - # `periodic_tuning_state`. - # If other values are provided, this API method ignores them. - # - # @overload update_model(request, options = nil) - # Pass arguments to `update_model` via a request object, either of type - # {::Google::Cloud::Retail::V2::UpdateModelRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::UpdateModelRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload update_model(model: nil, update_mask: nil) - # Pass arguments to `update_model` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param model [::Google::Cloud::Retail::V2::Model, ::Hash] - # Required. The body of the updated {::Google::Cloud::Retail::V2::Model Model}. - # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] - # Optional. Indicates which fields in the provided 'model' to - # update. If not set, by default updates all fields. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::Model] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::Model] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ModelService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::UpdateModelRequest.new - # - # # Call the update_model method. - # result = client.update_model request - # - # # The returned object is of type Google::Cloud::Retail::V2::Model. - # p result - # - def update_model request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::UpdateModelRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.update_model.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.update_model.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.update_model.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @model_service_stub.update_model request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Tunes an existing model. - # - # @overload tune_model(request, options = nil) - # Pass arguments to `tune_model` via a request object, either of type - # {::Google::Cloud::Retail::V2::TuneModelRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::TuneModelRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload tune_model(name: nil) - # Pass arguments to `tune_model` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # Required. The resource name of the model to tune. - # Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Gapic::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ModelService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::TuneModelRequest.new - # - # # Call the tune_model method. - # result = client.tune_model request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def tune_model request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::TuneModelRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.tune_model.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.tune_model.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.tune_model.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @model_service_stub.tune_model request, options do |result, operation| - result = ::Gapic::Operation.new result, @operations_client, options: options - yield result, operation if block_given? - throw :response, result - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Configuration class for the ModelService REST API. - # - # This class represents the configuration for ModelService REST, - # providing control over timeouts, retry behavior, logging, transport - # parameters, and other low-level controls. Certain parameters can also be - # applied individually to specific RPCs. See - # {::Google::Cloud::Retail::V2::ModelService::Rest::Client::Configuration::Rpcs} - # for a list of RPCs that can be configured independently. - # - # Configuration can be applied globally to all clients, or to a single client - # on construction. - # - # @example - # - # # Modify the global config, setting the timeout for - # # create_model to 20 seconds, - # # and all remaining timeouts to 10 seconds. - # ::Google::Cloud::Retail::V2::ModelService::Rest::Client.configure do |config| - # config.timeout = 10.0 - # config.rpcs.create_model.timeout = 20.0 - # end - # - # # Apply the above configuration only to a new client. - # client = ::Google::Cloud::Retail::V2::ModelService::Rest::Client.new do |config| - # config.timeout = 10.0 - # config.rpcs.create_model.timeout = 20.0 - # end - # - # @!attribute [rw] endpoint - # A custom service endpoint, as a hostname or hostname:port. The default is - # nil, indicating to use the default endpoint in the current universe domain. - # @return [::String,nil] - # @!attribute [rw] credentials - # Credentials to send with calls. You may provide any of the following types: - # * (`String`) The path to a service account key file in JSON format - # * (`Hash`) A service account key as a Hash - # * (`Google::Auth::Credentials`) A googleauth credentials object - # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) - # * (`Signet::OAuth2::Client`) A signet oauth2 client object - # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) - # * (`nil`) indicating no credentials - # - # Warning: If you accept a credential configuration (JSON file or Hash) from an - # external source for authentication to Google Cloud, you must validate it before - # providing it to a Google API client library. Providing an unvalidated credential - # configuration to Google APIs can compromise the security of your systems and data. - # For more information, refer to [Validate credential configurations from external - # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). - # @return [::Object] - # @!attribute [rw] scope - # The OAuth scopes - # @return [::Array<::String>] - # @!attribute [rw] lib_name - # The library name as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] lib_version - # The library version as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] timeout - # The call timeout in seconds. - # @return [::Numeric] - # @!attribute [rw] metadata - # Additional headers to be sent with the call. - # @return [::Hash{::Symbol=>::String}] - # @!attribute [rw] retry_policy - # The retry policy. The value is a hash with the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # @return [::Hash] - # @!attribute [rw] quota_project - # A separate project against which to charge quota. - # @return [::String] - # @!attribute [rw] universe_domain - # The universe domain within which to make requests. This determines the - # default endpoint URL. The default value of nil uses the environment - # universe (usually the default "googleapis.com" universe). - # @return [::String,nil] - # @!attribute [rw] logger - # A custom logger to use for request/response debug logging, or the value - # `:default` (the default) to construct a default logger, or `nil` to - # explicitly disable logging. - # @return [::Logger,:default,nil] - # - class Configuration - extend ::Gapic::Config - - # @private - # The endpoint specific to the default "googleapis.com" universe. Deprecated. - DEFAULT_ENDPOINT = "retail.googleapis.com" - - config_attr :endpoint, nil, ::String, nil - config_attr :credentials, nil do |value| - allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] - allowed.any? { |klass| klass === value } - end - config_attr :scope, nil, ::String, ::Array, nil - config_attr :lib_name, nil, ::String, nil - config_attr :lib_version, nil, ::String, nil - config_attr :timeout, nil, ::Numeric, nil - config_attr :metadata, nil, ::Hash, nil - config_attr :retry_policy, nil, ::Hash, ::Proc, nil - config_attr :quota_project, nil, ::String, nil - config_attr :universe_domain, nil, ::String, nil - config_attr :logger, :default, ::Logger, nil, :default - - # @private - def initialize parent_config = nil - @parent_config = parent_config unless parent_config.nil? - - yield self if block_given? - end - - ## - # Configurations for individual RPCs - # @return [Rpcs] - # - def rpcs - @rpcs ||= begin - parent_rpcs = nil - parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) - Rpcs.new parent_rpcs - end - end - - ## - # Configuration RPC class for the ModelService API. - # - # Includes fields providing the configuration for each RPC in this service. - # Each configuration object is of type `Gapic::Config::Method` and includes - # the following configuration fields: - # - # * `timeout` (*type:* `Numeric`) - The call timeout in seconds - # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers - # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields - # include the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # - class Rpcs - ## - # RPC-specific configuration for `create_model` - # @return [::Gapic::Config::Method] - # - attr_reader :create_model - ## - # RPC-specific configuration for `get_model` - # @return [::Gapic::Config::Method] - # - attr_reader :get_model - ## - # RPC-specific configuration for `pause_model` - # @return [::Gapic::Config::Method] - # - attr_reader :pause_model - ## - # RPC-specific configuration for `resume_model` - # @return [::Gapic::Config::Method] - # - attr_reader :resume_model - ## - # RPC-specific configuration for `delete_model` - # @return [::Gapic::Config::Method] - # - attr_reader :delete_model - ## - # RPC-specific configuration for `list_models` - # @return [::Gapic::Config::Method] - # - attr_reader :list_models - ## - # RPC-specific configuration for `update_model` - # @return [::Gapic::Config::Method] - # - attr_reader :update_model - ## - # RPC-specific configuration for `tune_model` - # @return [::Gapic::Config::Method] - # - attr_reader :tune_model - - # @private - def initialize parent_rpcs = nil - create_model_config = parent_rpcs.create_model if parent_rpcs.respond_to? :create_model - @create_model = ::Gapic::Config::Method.new create_model_config - get_model_config = parent_rpcs.get_model if parent_rpcs.respond_to? :get_model - @get_model = ::Gapic::Config::Method.new get_model_config - pause_model_config = parent_rpcs.pause_model if parent_rpcs.respond_to? :pause_model - @pause_model = ::Gapic::Config::Method.new pause_model_config - resume_model_config = parent_rpcs.resume_model if parent_rpcs.respond_to? :resume_model - @resume_model = ::Gapic::Config::Method.new resume_model_config - delete_model_config = parent_rpcs.delete_model if parent_rpcs.respond_to? :delete_model - @delete_model = ::Gapic::Config::Method.new delete_model_config - list_models_config = parent_rpcs.list_models if parent_rpcs.respond_to? :list_models - @list_models = ::Gapic::Config::Method.new list_models_config - update_model_config = parent_rpcs.update_model if parent_rpcs.respond_to? :update_model - @update_model = ::Gapic::Config::Method.new update_model_config - tune_model_config = parent_rpcs.tune_model if parent_rpcs.respond_to? :tune_model - @tune_model = ::Gapic::Config::Method.new tune_model_config - - yield self if block_given? - end - end - end - end - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/rest/operations.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/rest/operations.rb deleted file mode 100644 index ec084652ff45..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/rest/operations.rb +++ /dev/null @@ -1,962 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "gapic/operation" - -module Google - module Cloud - module Retail - module V2 - module ModelService - module Rest - # Service that implements Longrunning Operations API. - class Operations - # @private - API_VERSION = "" - - # @private - DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" - - # @private - attr_reader :operations_stub - - ## - # Configuration for the ModelService Operations API. - # - # @yield [config] Configure the Operations client. - # @yieldparam config [Operations::Configuration] - # - # @return [Operations::Configuration] - # - def self.configure - @configure ||= Operations::Configuration.new - yield @configure if block_given? - @configure - end - - ## - # Configure the ModelService Operations instance. - # - # The configuration is set to the derived mode, meaning that values can be changed, - # but structural changes (adding new fields, etc.) are not allowed. Structural changes - # should be made on {Operations.configure}. - # - # @yield [config] Configure the Operations client. - # @yieldparam config [Operations::Configuration] - # - # @return [Operations::Configuration] - # - def configure - yield @config if block_given? - @config - end - - ## - # The effective universe domain - # - # @return [String] - # - def universe_domain - @operations_stub.universe_domain - end - - ## - # Create a new Operations client object. - # - # @yield [config] Configure the Client client. - # @yieldparam config [Operations::Configuration] - # - def initialize - # Create the configuration object - @config = Configuration.new Operations.configure - - # Yield the configuration if needed - yield @config if block_given? - - # Create credentials - credentials = @config.credentials - credentials ||= Credentials.default scope: @config.scope - if credentials.is_a?(::String) || credentials.is_a?(::Hash) - credentials = Credentials.new credentials, scope: @config.scope - end - - @quota_project_id = @config.quota_project - @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id - - @operations_stub = OperationsServiceStub.new( - endpoint: @config.endpoint, - endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, - universe_domain: @config.universe_domain, - credentials: credentials - ) - - # Used by an LRO wrapper for some methods of this service - @operations_client = self - end - - # Service calls - - ## - # Lists operations that match the specified filter in the request. If the - # server doesn't support this method, it returns `UNIMPLEMENTED`. - # - # @overload list_operations(request, options = nil) - # Pass arguments to `list_operations` via a request object, either of type - # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::ListOperationsRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload list_operations(name: nil, filter: nil, page_size: nil, page_token: nil, return_partial_success: nil) - # Pass arguments to `list_operations` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation's parent resource. - # @param filter [::String] - # The standard list filter. - # @param page_size [::Integer] - # The standard list page size. - # @param page_token [::String] - # The standard list page token. - # @param return_partial_success [::Boolean] - # When set to `true`, operations that are reachable are returned as normal, - # and those that are unreachable are returned in the - # [ListOperationsResponse.unreachable] field. - # - # This can only be `true` when reading across collections e.g. when `parent` - # is set to `"projects/example/locations/-"`. - # - # This field is not by default supported and will result in an - # `UNIMPLEMENTED` error if set unless explicitly documented otherwise in - # service or product specific documentation. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Gapic::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::ListOperationsRequest.new - # - # # Call the list_operations method. - # result = client.list_operations request - # - # # The returned object is of type Gapic::PagedEnumerable. You can iterate - # # over elements, and API calls will be issued to fetch pages as needed. - # result.each do |item| - # # Each element is of type ::Google::Longrunning::Operation. - # p item - # end - # - def list_operations request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::ListOperationsRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.list_operations.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.list_operations.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.list_operations.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.list_operations request, options do |result, operation| - result = ::Gapic::Rest::PagedEnumerable.new @operations_stub, :list_operations, "operations", request, result, options - yield result, operation if block_given? - throw :response, result - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Gets the latest state of a long-running operation. Clients can use this - # method to poll the operation result at intervals as recommended by the API - # service. - # - # @overload get_operation(request, options = nil) - # Pass arguments to `get_operation` via a request object, either of type - # {::Google::Longrunning::GetOperationRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::GetOperationRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload get_operation(name: nil) - # Pass arguments to `get_operation` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation resource. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Gapic::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::GetOperationRequest.new - # - # # Call the get_operation method. - # result = client.get_operation request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def get_operation request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::GetOperationRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.get_operation.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.get_operation.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.get_operation.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.get_operation request, options do |result, operation| - result = ::Gapic::Operation.new result, @operations_client, options: options - yield result, operation if block_given? - throw :response, result - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Deletes a long-running operation. This method indicates that the client is - # no longer interested in the operation result. It does not cancel the - # operation. If the server doesn't support this method, it returns - # `google.rpc.Code.UNIMPLEMENTED`. - # - # @overload delete_operation(request, options = nil) - # Pass arguments to `delete_operation` via a request object, either of type - # {::Google::Longrunning::DeleteOperationRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::DeleteOperationRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload delete_operation(name: nil) - # Pass arguments to `delete_operation` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation resource to be deleted. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Protobuf::Empty] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Protobuf::Empty] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::DeleteOperationRequest.new - # - # # Call the delete_operation method. - # result = client.delete_operation request - # - # # The returned object is of type Google::Protobuf::Empty. - # p result - # - def delete_operation request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::DeleteOperationRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.delete_operation.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.delete_operation.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.delete_operation.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.delete_operation request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Starts asynchronous cancellation on a long-running operation. The server - # makes a best effort to cancel the operation, but success is not - # guaranteed. If the server doesn't support this method, it returns - # `google.rpc.Code.UNIMPLEMENTED`. Clients can use - # Operations.GetOperation or - # other methods to check whether the cancellation succeeded or whether the - # operation completed despite cancellation. On successful cancellation, - # the operation is not deleted; instead, it becomes an operation with - # an {::Google::Longrunning::Operation#error Operation.error} value with a - # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to - # `Code.CANCELLED`. - # - # @overload cancel_operation(request, options = nil) - # Pass arguments to `cancel_operation` via a request object, either of type - # {::Google::Longrunning::CancelOperationRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::CancelOperationRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload cancel_operation(name: nil) - # Pass arguments to `cancel_operation` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation resource to be cancelled. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Protobuf::Empty] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Protobuf::Empty] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::CancelOperationRequest.new - # - # # Call the cancel_operation method. - # result = client.cancel_operation request - # - # # The returned object is of type Google::Protobuf::Empty. - # p result - # - def cancel_operation request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::CancelOperationRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.cancel_operation.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.cancel_operation.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.cancel_operation.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.cancel_operation request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Configuration class for the Operations REST API. - # - # This class represents the configuration for Operations REST, - # providing control over timeouts, retry behavior, logging, transport - # parameters, and other low-level controls. Certain parameters can also be - # applied individually to specific RPCs. See - # {::Google::Longrunning::Operations::Rest::Client::Configuration::Rpcs} - # for a list of RPCs that can be configured independently. - # - # Configuration can be applied globally to all clients, or to a single client - # on construction. - # - # @example - # - # # Modify the global config, setting the timeout for - # # list_operations to 20 seconds, - # # and all remaining timeouts to 10 seconds. - # ::Google::Longrunning::Operations::Rest::Client.configure do |config| - # config.timeout = 10.0 - # config.rpcs.list_operations.timeout = 20.0 - # end - # - # # Apply the above configuration only to a new client. - # client = ::Google::Longrunning::Operations::Rest::Client.new do |config| - # config.timeout = 10.0 - # config.rpcs.list_operations.timeout = 20.0 - # end - # - # @!attribute [rw] endpoint - # A custom service endpoint, as a hostname or hostname:port. The default is - # nil, indicating to use the default endpoint in the current universe domain. - # @return [::String,nil] - # @!attribute [rw] credentials - # Credentials to send with calls. You may provide any of the following types: - # * (`String`) The path to a service account key file in JSON format - # * (`Hash`) A service account key as a Hash - # * (`Google::Auth::Credentials`) A googleauth credentials object - # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) - # * (`Signet::OAuth2::Client`) A signet oauth2 client object - # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) - # * (`nil`) indicating no credentials - # - # Warning: If you accept a credential configuration (JSON file or Hash) from an - # external source for authentication to Google Cloud, you must validate it before - # providing it to a Google API client library. Providing an unvalidated credential - # configuration to Google APIs can compromise the security of your systems and data. - # For more information, refer to [Validate credential configurations from external - # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). - # @return [::Object] - # @!attribute [rw] scope - # The OAuth scopes - # @return [::Array<::String>] - # @!attribute [rw] lib_name - # The library name as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] lib_version - # The library version as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] timeout - # The call timeout in seconds. - # @return [::Numeric] - # @!attribute [rw] metadata - # Additional headers to be sent with the call. - # @return [::Hash{::Symbol=>::String}] - # @!attribute [rw] retry_policy - # The retry policy. The value is a hash with the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # @return [::Hash] - # @!attribute [rw] quota_project - # A separate project against which to charge quota. - # @return [::String] - # @!attribute [rw] universe_domain - # The universe domain within which to make requests. This determines the - # default endpoint URL. The default value of nil uses the environment - # universe (usually the default "googleapis.com" universe). - # @return [::String,nil] - # @!attribute [rw] logger - # A custom logger to use for request/response debug logging, or the value - # `:default` (the default) to construct a default logger, or `nil` to - # explicitly disable logging. - # @return [::Logger,:default,nil] - # - class Configuration - extend ::Gapic::Config - - # @private - # The endpoint specific to the default "googleapis.com" universe. Deprecated. - DEFAULT_ENDPOINT = "retail.googleapis.com" - - config_attr :endpoint, nil, ::String, nil - config_attr :credentials, nil do |value| - allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] - allowed.any? { |klass| klass === value } - end - config_attr :scope, nil, ::String, ::Array, nil - config_attr :lib_name, nil, ::String, nil - config_attr :lib_version, nil, ::String, nil - config_attr :timeout, nil, ::Numeric, nil - config_attr :metadata, nil, ::Hash, nil - config_attr :retry_policy, nil, ::Hash, ::Proc, nil - config_attr :quota_project, nil, ::String, nil - config_attr :universe_domain, nil, ::String, nil - config_attr :logger, :default, ::Logger, nil, :default - - # @private - def initialize parent_config = nil - @parent_config = parent_config unless parent_config.nil? - - yield self if block_given? - end - - ## - # Configurations for individual RPCs - # @return [Rpcs] - # - def rpcs - @rpcs ||= begin - parent_rpcs = nil - parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) - Rpcs.new parent_rpcs - end - end - - ## - # Configuration RPC class for the Operations API. - # - # Includes fields providing the configuration for each RPC in this service. - # Each configuration object is of type `Gapic::Config::Method` and includes - # the following configuration fields: - # - # * `timeout` (*type:* `Numeric`) - The call timeout in seconds - # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers - # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields - # include the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # - class Rpcs - ## - # RPC-specific configuration for `list_operations` - # @return [::Gapic::Config::Method] - # - attr_reader :list_operations - ## - # RPC-specific configuration for `get_operation` - # @return [::Gapic::Config::Method] - # - attr_reader :get_operation - ## - # RPC-specific configuration for `delete_operation` - # @return [::Gapic::Config::Method] - # - attr_reader :delete_operation - ## - # RPC-specific configuration for `cancel_operation` - # @return [::Gapic::Config::Method] - # - attr_reader :cancel_operation - - # @private - def initialize parent_rpcs = nil - list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations - @list_operations = ::Gapic::Config::Method.new list_operations_config - get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation - @get_operation = ::Gapic::Config::Method.new get_operation_config - delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation - @delete_operation = ::Gapic::Config::Method.new delete_operation_config - cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation - @cancel_operation = ::Gapic::Config::Method.new cancel_operation_config - - yield self if block_given? - end - end - end - end - - ## - # @private - # REST service stub for the Longrunning Operations API. - # Service stub contains baseline method implementations - # including transcoding, making the REST call, and deserialing the response. - class OperationsServiceStub - def initialize endpoint:, endpoint_template:, universe_domain:, credentials: - # These require statements are intentionally placed here to initialize - # the REST modules only when it's required. - require "gapic/rest" - - @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, - endpoint_template: endpoint_template, - universe_domain: universe_domain, - credentials: credentials - end - - ## - # Baseline implementation for the list_operations REST call - # - # @param request_pb [::Google::Longrunning::ListOperationsRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Longrunning::ListOperationsResponse] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Longrunning::ListOperationsResponse] - # A result object deserialized from the server's reply - def list_operations request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = OperationsServiceStub.transcode_list_operations_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "list_operations", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Longrunning::ListOperationsResponse.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the get_operation REST call - # - # @param request_pb [::Google::Longrunning::GetOperationRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Longrunning::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Longrunning::Operation] - # A result object deserialized from the server's reply - def get_operation request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = OperationsServiceStub.transcode_get_operation_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "get_operation", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the delete_operation REST call - # - # @param request_pb [::Google::Longrunning::DeleteOperationRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Protobuf::Empty] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Protobuf::Empty] - # A result object deserialized from the server's reply - def delete_operation request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = OperationsServiceStub.transcode_delete_operation_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "delete_operation", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the cancel_operation REST call - # - # @param request_pb [::Google::Longrunning::CancelOperationRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Protobuf::Empty] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Protobuf::Empty] - # A result object deserialized from the server's reply - def cancel_operation request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = OperationsServiceStub.transcode_cancel_operation_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "cancel_operation", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # @private - # - # GRPC transcoding helper method for the list_operations REST call - # - # @param request_pb [::Google::Longrunning::ListOperationsRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_list_operations_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :get, - uri_template: "/v2/{name}/operations", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/?$}, false] - ] - ) - .with_bindings( - uri_method: :get, - uri_template: "/v2/{name}/operations", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] - ] - ) - .with_bindings( - uri_method: :get, - uri_template: "/v2/{name}/operations", - matches: [ - ["name", %r{^projects/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the get_operation REST call - # - # @param request_pb [::Google::Longrunning::GetOperationRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_get_operation_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :get, - uri_template: "/v2/{name}", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/operations/[^/]+/?$}, false] - ] - ) - .with_bindings( - uri_method: :get, - uri_template: "/v2/{name}", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/branches/[^/]+/operations/[^/]+/?$}, false] - ] - ) - .with_bindings( - uri_method: :get, - uri_template: "/v2/{name}", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/operations/[^/]+/?$}, false] - ] - ) - .with_bindings( - uri_method: :get, - uri_template: "/v2/{name}", - matches: [ - ["name", %r{^projects/[^/]+/operations/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the delete_operation REST call - # - # @param request_pb [::Google::Longrunning::DeleteOperationRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_delete_operation_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :delete, - uri_template: "/v1/{name}", - matches: [ - ["name", %r{^operations(?:/(?<__wildcard__>.*))?$}, true] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the cancel_operation REST call - # - # @param request_pb [::Google::Longrunning::CancelOperationRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_cancel_operation_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :post, - uri_template: "/v1/{name}:cancel", - body: "*", - matches: [ - ["name", %r{^operations(?:/(?<__wildcard__>.*))?$}, true] - ] - ) - transcoder.transcode request_pb - end - end - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/rest/service_stub.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/rest/service_stub.rb deleted file mode 100644 index fec1a150075d..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service/rest/service_stub.rb +++ /dev/null @@ -1,574 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "google/cloud/retail/v2/model_service_pb" - -module Google - module Cloud - module Retail - module V2 - module ModelService - module Rest - ## - # REST service stub for the ModelService service. - # Service stub contains baseline method implementations - # including transcoding, making the REST call, and deserialing the response. - # - class ServiceStub - # @private - def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger: - # These require statements are intentionally placed here to initialize - # the REST modules only when it's required. - require "gapic/rest" - - @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, - endpoint_template: endpoint_template, - universe_domain: universe_domain, - credentials: credentials, - numeric_enums: true, - service_name: self.class, - raise_faraday_errors: false, - logger: logger - end - - ## - # The effective universe domain - # - # @return [String] - # - def universe_domain - @client_stub.universe_domain - end - - ## - # The effective endpoint - # - # @return [String] - # - def endpoint - @client_stub.endpoint - end - - ## - # The logger used for request/response debug logging. - # - # @return [Logger] - # - def logger stub: false - stub ? @client_stub.stub_logger : @client_stub.logger - end - - ## - # Baseline implementation for the create_model REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::CreateModelRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Longrunning::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Longrunning::Operation] - # A result object deserialized from the server's reply - def create_model request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_create_model_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "create_model", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the get_model REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::GetModelRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::Model] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::Model] - # A result object deserialized from the server's reply - def get_model request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_get_model_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "get_model", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Retail::V2::Model.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the pause_model REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::PauseModelRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::Model] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::Model] - # A result object deserialized from the server's reply - def pause_model request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_pause_model_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "pause_model", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Retail::V2::Model.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the resume_model REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::ResumeModelRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::Model] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::Model] - # A result object deserialized from the server's reply - def resume_model request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_resume_model_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "resume_model", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Retail::V2::Model.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the delete_model REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::DeleteModelRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Protobuf::Empty] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Protobuf::Empty] - # A result object deserialized from the server's reply - def delete_model request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_delete_model_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "delete_model", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the list_models REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::ListModelsRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::ListModelsResponse] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::ListModelsResponse] - # A result object deserialized from the server's reply - def list_models request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_list_models_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "list_models", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Retail::V2::ListModelsResponse.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the update_model REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::UpdateModelRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::Model] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::Model] - # A result object deserialized from the server's reply - def update_model request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_update_model_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "update_model", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Retail::V2::Model.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the tune_model REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::TuneModelRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Longrunning::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Longrunning::Operation] - # A result object deserialized from the server's reply - def tune_model request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_tune_model_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "tune_model", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # @private - # - # GRPC transcoding helper method for the create_model REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::CreateModelRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_create_model_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :post, - uri_template: "/v2/{parent}/models", - body: "model", - matches: [ - ["parent", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the get_model REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::GetModelRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_get_model_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :get, - uri_template: "/v2/{name}", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/models/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the pause_model REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::PauseModelRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_pause_model_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :post, - uri_template: "/v2/{name}:pause", - body: "*", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/models/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the resume_model REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::ResumeModelRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_resume_model_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :post, - uri_template: "/v2/{name}:resume", - body: "*", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/models/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the delete_model REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::DeleteModelRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_delete_model_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :delete, - uri_template: "/v2/{name}", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/models/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the list_models REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::ListModelsRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_list_models_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :get, - uri_template: "/v2/{parent}/models", - matches: [ - ["parent", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the update_model REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::UpdateModelRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_update_model_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :patch, - uri_template: "/v2/{model.name}", - body: "model", - matches: [ - ["model.name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/models/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the tune_model REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::TuneModelRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_tune_model_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :post, - uri_template: "/v2/{name}:tune", - body: "*", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/models/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - end - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service_pb.rb deleted file mode 100644 index 5b5f20690bb3..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/model_service_pb.rb +++ /dev/null @@ -1,41 +0,0 @@ -# frozen_string_literal: true -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/retail/v2/model_service.proto - -require 'google/protobuf' - -require 'google/api/annotations_pb' -require 'google/api/client_pb' -require 'google/api/field_behavior_pb' -require 'google/api/resource_pb' -require 'google/cloud/retail/v2/model_pb' -require 'google/longrunning/operations_pb' -require 'google/protobuf/empty_pb' -require 'google/protobuf/field_mask_pb' - - -descriptor_data = "\n*google/cloud/retail/v2/model_service.proto\x12\x16google.cloud.retail.v2\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\"google/cloud/retail/v2/model.proto\x1a#google/longrunning/operations.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\"\x94\x01\n\x12\x43reateModelRequest\x12\x35\n\x06parent\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\n\x1dretail.googleapis.com/Catalog\x12\x31\n\x05model\x18\x02 \x01(\x0b\x32\x1d.google.cloud.retail.v2.ModelB\x03\xe0\x41\x02\x12\x14\n\x07\x64ry_run\x18\x03 \x01(\x08\x42\x03\xe0\x41\x01\"}\n\x12UpdateModelRequest\x12\x31\n\x05model\x18\x01 \x01(\x0b\x32\x1d.google.cloud.retail.v2.ModelB\x03\xe0\x41\x02\x12\x34\n\x0bupdate_mask\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMaskB\x03\xe0\x41\x01\"D\n\x0fGetModelRequest\x12\x31\n\x04name\x18\x01 \x01(\tB#\xe0\x41\x02\xfa\x41\x1d\n\x1bretail.googleapis.com/Model\"F\n\x11PauseModelRequest\x12\x31\n\x04name\x18\x01 \x01(\tB#\xe0\x41\x02\xfa\x41\x1d\n\x1bretail.googleapis.com/Model\"\'\n\x12ResumeModelRequest\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x02\"{\n\x11ListModelsRequest\x12\x35\n\x06parent\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\n\x1dretail.googleapis.com/Catalog\x12\x16\n\tpage_size\x18\x02 \x01(\x05\x42\x03\xe0\x41\x01\x12\x17\n\npage_token\x18\x03 \x01(\tB\x03\xe0\x41\x01\"G\n\x12\x44\x65leteModelRequest\x12\x31\n\x04name\x18\x01 \x01(\tB#\xe0\x41\x02\xfa\x41\x1d\n\x1bretail.googleapis.com/Model\"\\\n\x12ListModelsResponse\x12-\n\x06models\x18\x01 \x03(\x0b\x32\x1d.google.cloud.retail.v2.Model\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t\"E\n\x10TuneModelRequest\x12\x31\n\x04name\x18\x01 \x01(\tB#\xe0\x41\x02\xfa\x41\x1d\n\x1bretail.googleapis.com/Model\"$\n\x13\x43reateModelMetadata\x12\r\n\x05model\x18\x01 \x01(\t\"\"\n\x11TuneModelMetadata\x12\r\n\x05model\x18\x01 \x01(\t\"\x13\n\x11TuneModelResponse2\xc5\x0c\n\x0cModelService\x12\xfb\x01\n\x0b\x43reateModel\x12*.google.cloud.retail.v2.CreateModelRequest\x1a\x1d.google.longrunning.Operation\"\xa0\x01\xca\x41J\n\x1cgoogle.cloud.retail.v2.Model\x12*google.cloud.retail.v2.CreateModelMetadata\xda\x41\x0cparent,model\x82\xd3\xe4\x93\x02>\"5/v2/{parent=projects/*/locations/*/catalogs/*}/models:\x05model\x12\x98\x01\n\x08GetModel\x12\'.google.cloud.retail.v2.GetModelRequest\x1a\x1d.google.cloud.retail.v2.Model\"D\xda\x41\x04name\x82\xd3\xe4\x93\x02\x37\x12\x35/v2/{name=projects/*/locations/*/catalogs/*/models/*}\x12\xa5\x01\n\nPauseModel\x12).google.cloud.retail.v2.PauseModelRequest\x1a\x1d.google.cloud.retail.v2.Model\"M\xda\x41\x04name\x82\xd3\xe4\x93\x02@\";/v2/{name=projects/*/locations/*/catalogs/*/models/*}:pause:\x01*\x12\xa8\x01\n\x0bResumeModel\x12*.google.cloud.retail.v2.ResumeModelRequest\x1a\x1d.google.cloud.retail.v2.Model\"N\xda\x41\x04name\x82\xd3\xe4\x93\x02\x41\" ::Google::Protobuf::Value, ::Hash}] - # Additional domain specific parameters for the predictions. - # - # Allowed values: - # - # * `returnProduct`: Boolean. If set to true, the associated product - # object will be returned in the `results.metadata` field in the - # prediction response. - # * `returnScore`: Boolean. If set to true, the prediction 'score' - # corresponding to each returned product will be set in the - # `results.metadata` field in the prediction response. The given - # 'score' indicates the probability of a product being clicked/purchased - # given the user's context and history. - # * `strictFiltering`: Boolean. True by default. If set to false, the service - # will return generic (unfiltered) popular products instead of empty if - # your filter blocks all prediction results. - # * `priceRerankLevel`: String. Default empty. If set to be non-empty, then - # it needs to be one of {'no-price-reranking', 'low-price-reranking', - # 'medium-price-reranking', 'high-price-reranking'}. This gives - # request-level control and adjusts prediction results based on product - # price. - # * `diversityLevel`: String. Default empty. If set to be non-empty, then - # it needs to be one of {'no-diversity', 'low-diversity', - # 'medium-diversity', 'high-diversity', 'auto-diversity'}. This gives - # request-level control and adjusts prediction results based on product - # category. - # * `filterSyntaxV2`: Boolean. False by default. If set to true, the `filter` - # field is interpreteted according to the new, attribute-based syntax. - # @param labels [::Hash{::String => ::String}] - # The labels applied to a resource must meet the following requirements: - # - # * Each resource can have multiple labels, up to a maximum of 64. - # * Each label must be a key-value pair. - # * Keys have a minimum length of 1 character and a maximum length of 63 - # characters and cannot be empty. Values can be empty and have a maximum - # length of 63 characters. - # * Keys and values can contain only lowercase letters, numeric characters, - # underscores, and dashes. All characters must use UTF-8 encoding, and - # international characters are allowed. - # * The key portion of a label must be unique. However, you can use the same - # key with multiple resources. - # * Keys must start with a lowercase letter or international character. - # - # See [Google Cloud - # Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) - # for more details. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Cloud::Retail::V2::PredictResponse] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Cloud::Retail::V2::PredictResponse] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::PredictionService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::PredictRequest.new - # - # # Call the predict method. - # result = client.predict request - # - # # The returned object is of type Google::Cloud::Retail::V2::PredictResponse. - # p result - # - def predict request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::PredictRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.predict.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.placement - header_params["placement"] = request.placement - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.predict.timeout, - metadata: metadata, - retry_policy: @config.rpcs.predict.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @prediction_service_stub.call_rpc :predict, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Configuration class for the PredictionService API. - # - # This class represents the configuration for PredictionService, - # providing control over timeouts, retry behavior, logging, transport - # parameters, and other low-level controls. Certain parameters can also be - # applied individually to specific RPCs. See - # {::Google::Cloud::Retail::V2::PredictionService::Client::Configuration::Rpcs} - # for a list of RPCs that can be configured independently. - # - # Configuration can be applied globally to all clients, or to a single client - # on construction. - # - # @example - # - # # Modify the global config, setting the timeout for - # # predict to 20 seconds, - # # and all remaining timeouts to 10 seconds. - # ::Google::Cloud::Retail::V2::PredictionService::Client.configure do |config| - # config.timeout = 10.0 - # config.rpcs.predict.timeout = 20.0 - # end - # - # # Apply the above configuration only to a new client. - # client = ::Google::Cloud::Retail::V2::PredictionService::Client.new do |config| - # config.timeout = 10.0 - # config.rpcs.predict.timeout = 20.0 - # end - # - # @!attribute [rw] endpoint - # A custom service endpoint, as a hostname or hostname:port. The default is - # nil, indicating to use the default endpoint in the current universe domain. - # @return [::String,nil] - # @!attribute [rw] credentials - # Credentials to send with calls. You may provide any of the following types: - # * (`Google::Auth::Credentials`) A googleauth credentials object - # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) - # * (`Signet::OAuth2::Client`) A signet oauth2 client object - # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) - # * (`GRPC::Core::Channel`) a gRPC channel with included credentials - # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object - # * (`nil`) indicating no credentials - # - # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials - # is deprecated. Providing an unvalidated credential configuration to - # Google APIs can compromise the security of your systems and data. - # - # @example - # - # # The recommended way to provide credentials is to use the `make_creds` method - # # on the appropriate credentials class for your environment. - # - # require "googleauth" - # - # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds( - # json_key_io: ::File.open("/path/to/keyfile.json") - # ) - # - # client = ::Google::Cloud::Retail::V2::PredictionService::Client.new do |config| - # config.credentials = credentials - # end - # - # @note Warning: If you accept a credential configuration (JSON file or Hash) from an - # external source for authentication to Google Cloud, you must validate it before - # providing it to a Google API client library. Providing an unvalidated credential - # configuration to Google APIs can compromise the security of your systems and data. - # For more information, refer to [Validate credential configurations from external - # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). - # @return [::Object] - # @!attribute [rw] scope - # The OAuth scopes - # @return [::Array<::String>] - # @!attribute [rw] lib_name - # The library name as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] lib_version - # The library version as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] channel_args - # Extra parameters passed to the gRPC channel. Note: this is ignored if a - # `GRPC::Core::Channel` object is provided as the credential. - # @return [::Hash] - # @!attribute [rw] interceptors - # An array of interceptors that are run before calls are executed. - # @return [::Array<::GRPC::ClientInterceptor>] - # @!attribute [rw] timeout - # The call timeout in seconds. - # @return [::Numeric] - # @!attribute [rw] metadata - # Additional gRPC headers to be sent with the call. - # @return [::Hash{::Symbol=>::String}] - # @!attribute [rw] retry_policy - # The retry policy. The value is a hash with the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # @return [::Hash] - # @!attribute [rw] quota_project - # A separate project against which to charge quota. - # @return [::String] - # @!attribute [rw] universe_domain - # The universe domain within which to make requests. This determines the - # default endpoint URL. The default value of nil uses the environment - # universe (usually the default "googleapis.com" universe). - # @return [::String,nil] - # @!attribute [rw] logger - # A custom logger to use for request/response debug logging, or the value - # `:default` (the default) to construct a default logger, or `nil` to - # explicitly disable logging. - # @return [::Logger,:default,nil] - # - class Configuration - extend ::Gapic::Config - - # @private - # The endpoint specific to the default "googleapis.com" universe. Deprecated. - DEFAULT_ENDPOINT = "retail.googleapis.com" - - config_attr :endpoint, nil, ::String, nil - config_attr :credentials, nil do |value| - allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] - allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel - allowed.any? { |klass| klass === value } - end - config_attr :scope, nil, ::String, ::Array, nil - config_attr :lib_name, nil, ::String, nil - config_attr :lib_version, nil, ::String, nil - config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) - config_attr :interceptors, nil, ::Array, nil - config_attr :timeout, nil, ::Numeric, nil - config_attr :metadata, nil, ::Hash, nil - config_attr :retry_policy, nil, ::Hash, ::Proc, nil - config_attr :quota_project, nil, ::String, nil - config_attr :universe_domain, nil, ::String, nil - config_attr :logger, :default, ::Logger, nil, :default - - # @private - def initialize parent_config = nil - @parent_config = parent_config unless parent_config.nil? - - yield self if block_given? - end - - ## - # Configurations for individual RPCs - # @return [Rpcs] - # - def rpcs - @rpcs ||= begin - parent_rpcs = nil - parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) - Rpcs.new parent_rpcs - end - end - - ## - # Configuration for the channel pool - # @return [::Gapic::ServiceStub::ChannelPool::Configuration] - # - def channel_pool - @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new - end - - ## - # Configuration RPC class for the PredictionService API. - # - # Includes fields providing the configuration for each RPC in this service. - # Each configuration object is of type `Gapic::Config::Method` and includes - # the following configuration fields: - # - # * `timeout` (*type:* `Numeric`) - The call timeout in seconds - # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers - # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields - # include the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # - class Rpcs - ## - # RPC-specific configuration for `predict` - # @return [::Gapic::Config::Method] - # - attr_reader :predict - - # @private - def initialize parent_rpcs = nil - predict_config = parent_rpcs.predict if parent_rpcs.respond_to? :predict - @predict = ::Gapic::Config::Method.new predict_config - - yield self if block_given? - end - end - end - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/credentials.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/credentials.rb deleted file mode 100644 index 1da276c819f4..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/credentials.rb +++ /dev/null @@ -1,51 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "googleauth" - -module Google - module Cloud - module Retail - module V2 - module PredictionService - # Credentials for the PredictionService API. - class Credentials < ::Google::Auth::Credentials - self.scope = [ - "https://www.googleapis.com/auth/cloud-platform" - ] - self.env_vars = [ - "RETAIL_CREDENTIALS", - "RETAIL_KEYFILE", - "GOOGLE_CLOUD_CREDENTIALS", - "GOOGLE_CLOUD_KEYFILE", - "GCLOUD_KEYFILE", - "RETAIL_CREDENTIALS_JSON", - "RETAIL_KEYFILE_JSON", - "GOOGLE_CLOUD_CREDENTIALS_JSON", - "GOOGLE_CLOUD_KEYFILE_JSON", - "GCLOUD_KEYFILE_JSON" - ] - self.paths = [ - "~/.config/google_cloud/application_default_credentials.json" - ] - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/paths.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/paths.rb deleted file mode 100644 index 26277b36936a..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/paths.rb +++ /dev/null @@ -1,56 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Cloud - module Retail - module V2 - module PredictionService - # Path helper methods for the PredictionService API. - module Paths - ## - # Create a fully-qualified Product resource string. - # - # The resource will be in the following format: - # - # `projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}` - # - # @param project [String] - # @param location [String] - # @param catalog [String] - # @param branch [String] - # @param product [String] - # - # @return [::String] - def product_path project:, location:, catalog:, branch:, product: - raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" - raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" - raise ::ArgumentError, "catalog cannot contain /" if catalog.to_s.include? "/" - raise ::ArgumentError, "branch cannot contain /" if branch.to_s.include? "/" - - "projects/#{project}/locations/#{location}/catalogs/#{catalog}/branches/#{branch}/products/#{product}" - end - - extend self - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/rest.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/rest.rb deleted file mode 100644 index 351e68db6577..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/rest.rb +++ /dev/null @@ -1,52 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "gapic/rest" -require "gapic/config" -require "gapic/config/method" - -require "google/cloud/retail/v2/version" - -require "google/cloud/retail/v2/prediction_service/credentials" -require "google/cloud/retail/v2/prediction_service/paths" -require "google/cloud/retail/v2/prediction_service/rest/client" - -module Google - module Cloud - module Retail - module V2 - ## - # Service for making recommendation prediction. - # - # To load this service and instantiate a REST client: - # - # require "google/cloud/retail/v2/prediction_service/rest" - # client = ::Google::Cloud::Retail::V2::PredictionService::Rest::Client.new - # - module PredictionService - # Client for the REST transport - module Rest - end - end - end - end - end -end - -helper_path = ::File.join __dir__, "rest", "helpers.rb" -require "google/cloud/retail/v2/prediction_service/rest/helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/rest/client.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/rest/client.rb deleted file mode 100644 index 58169840c4a5..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/rest/client.rb +++ /dev/null @@ -1,573 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "google/cloud/errors" -require "google/cloud/retail/v2/prediction_service_pb" -require "google/cloud/retail/v2/prediction_service/rest/service_stub" -require "google/cloud/location/rest" - -module Google - module Cloud - module Retail - module V2 - module PredictionService - module Rest - ## - # REST client for the PredictionService service. - # - # Service for making recommendation prediction. - # - class Client - # @private - API_VERSION = "" - - # @private - DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" - - include Paths - - # @private - attr_reader :prediction_service_stub - - ## - # Configure the PredictionService Client class. - # - # See {::Google::Cloud::Retail::V2::PredictionService::Rest::Client::Configuration} - # for a description of the configuration fields. - # - # @example - # - # # Modify the configuration for all PredictionService clients - # ::Google::Cloud::Retail::V2::PredictionService::Rest::Client.configure do |config| - # config.timeout = 10.0 - # end - # - # @yield [config] Configure the Client client. - # @yieldparam config [Client::Configuration] - # - # @return [Client::Configuration] - # - def self.configure - @configure ||= begin - namespace = ["Google", "Cloud", "Retail", "V2"] - parent_config = while namespace.any? - parent_name = namespace.join "::" - parent_const = const_get parent_name - break parent_const.configure if parent_const.respond_to? :configure - namespace.pop - end - default_config = Client::Configuration.new parent_config - - default_config.timeout = 5.0 - default_config.retry_policy = { - initial_delay: 0.1, max_delay: 5.0, multiplier: 1.3, retry_codes: [14, 4] - } - - default_config - end - yield @configure if block_given? - @configure - end - - ## - # Configure the PredictionService Client instance. - # - # The configuration is set to the derived mode, meaning that values can be changed, - # but structural changes (adding new fields, etc.) are not allowed. Structural changes - # should be made on {Client.configure}. - # - # See {::Google::Cloud::Retail::V2::PredictionService::Rest::Client::Configuration} - # for a description of the configuration fields. - # - # @yield [config] Configure the Client client. - # @yieldparam config [Client::Configuration] - # - # @return [Client::Configuration] - # - def configure - yield @config if block_given? - @config - end - - ## - # The effective universe domain - # - # @return [String] - # - def universe_domain - @prediction_service_stub.universe_domain - end - - ## - # Create a new PredictionService REST client object. - # - # @example - # - # # Create a client using the default configuration - # client = ::Google::Cloud::Retail::V2::PredictionService::Rest::Client.new - # - # # Create a client using a custom configuration - # client = ::Google::Cloud::Retail::V2::PredictionService::Rest::Client.new do |config| - # config.timeout = 10.0 - # end - # - # @yield [config] Configure the PredictionService client. - # @yieldparam config [Client::Configuration] - # - def initialize - # Create the configuration object - @config = Configuration.new Client.configure - - # Yield the configuration if needed - yield @config if block_given? - - # Create credentials - credentials = @config.credentials - # Use self-signed JWT if the endpoint is unchanged from default, - # but only if the default endpoint does not have a region prefix. - enable_self_signed_jwt = @config.endpoint.nil? || - (@config.endpoint == Configuration::DEFAULT_ENDPOINT && - !@config.endpoint.split(".").first.include?("-")) - credentials ||= Credentials.default scope: @config.scope, - enable_self_signed_jwt: enable_self_signed_jwt - if credentials.is_a?(::String) || credentials.is_a?(::Hash) - credentials = Credentials.new credentials, scope: @config.scope - end - - @quota_project_id = @config.quota_project - @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id - - @prediction_service_stub = ::Google::Cloud::Retail::V2::PredictionService::Rest::ServiceStub.new( - endpoint: @config.endpoint, - endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, - universe_domain: @config.universe_domain, - credentials: credentials, - logger: @config.logger - ) - - @prediction_service_stub.logger(stub: true)&.info do |entry| - entry.set_system_name - entry.set_service - entry.message = "Created client for #{entry.service}" - entry.set_credentials_fields credentials - entry.set "customEndpoint", @config.endpoint if @config.endpoint - entry.set "defaultTimeout", @config.timeout if @config.timeout - entry.set "quotaProject", @quota_project_id if @quota_project_id - end - - @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config| - config.credentials = credentials - config.quota_project = @quota_project_id - config.endpoint = @prediction_service_stub.endpoint - config.universe_domain = @prediction_service_stub.universe_domain - config.logger = @prediction_service_stub.logger if config.respond_to? :logger= - end - end - - ## - # Get the associated client for mix-in of the Locations. - # - # @return [Google::Cloud::Location::Locations::Rest::Client] - # - attr_reader :location_client - - ## - # The logger used for request/response debug logging. - # - # @return [Logger] - # - def logger - @prediction_service_stub.logger - end - - # Service calls - - ## - # Makes a recommendation prediction. - # - # @overload predict(request, options = nil) - # Pass arguments to `predict` via a request object, either of type - # {::Google::Cloud::Retail::V2::PredictRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::PredictRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload predict(placement: nil, user_event: nil, page_size: nil, page_token: nil, filter: nil, validate_only: nil, params: nil, labels: nil) - # Pass arguments to `predict` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param placement [::String] - # Required. Full resource name of the format: - # `{placement=projects/*/locations/global/catalogs/default_catalog/servingConfigs/*}` - # or - # `{placement=projects/*/locations/global/catalogs/default_catalog/placements/*}`. - # We recommend using the `servingConfigs` resource. `placements` is a legacy - # resource. - # The ID of the Recommendations AI serving config or placement. - # Before you can request predictions from your model, you must create at - # least one serving config or placement for it. For more information, see - # [Manage serving configs] - # (https://cloud.google.com/retail/docs/manage-configs). - # - # The full list of available serving configs can be seen at - # https://console.cloud.google.com/ai/retail/catalogs/default_catalog/configs - # @param user_event [::Google::Cloud::Retail::V2::UserEvent, ::Hash] - # Required. Context about the user, what they are looking at and what action - # they took to trigger the predict request. Note that this user event detail - # won't be ingested to userEvent logs. Thus, a separate userEvent write - # request is required for event logging. - # - # Don't set - # {::Google::Cloud::Retail::V2::UserEvent#visitor_id UserEvent.visitor_id} or - # {::Google::Cloud::Retail::V2::UserInfo#user_id UserInfo.user_id} to the same - # fixed ID for different users. If you are trying to receive non-personalized - # recommendations (not recommended; this can negatively impact model - # performance), instead set - # {::Google::Cloud::Retail::V2::UserEvent#visitor_id UserEvent.visitor_id} to a - # random unique ID and leave - # {::Google::Cloud::Retail::V2::UserInfo#user_id UserInfo.user_id} unset. - # @param page_size [::Integer] - # Maximum number of results to return. Set this property to the number of - # prediction results needed. If zero, the service will choose a reasonable - # default. The maximum allowed value is 100. Values above 100 will be coerced - # to 100. - # @param page_token [::String] - # This field is not used; leave it unset. - # @param filter [::String] - # Filter for restricting prediction results with a length limit of 5,000 - # characters. Accepts values for tags and the `filterOutOfStockItems` flag. - # - # * Tag expressions. Restricts predictions to products that match all of the - # specified tags. Boolean operators `OR` and `NOT` are supported if the - # expression is enclosed in parentheses, and must be separated from the - # tag values by a space. `-"tagA"` is also supported and is equivalent to - # `NOT "tagA"`. Tag values must be double quoted UTF-8 encoded strings - # with a size limit of 1,000 characters. - # - # Note: "Recently viewed" models don't support tag filtering at the - # moment. - # - # * filterOutOfStockItems. Restricts predictions to products that do not - # have a - # stockState value of OUT_OF_STOCK. - # - # Examples: - # - # * tag=("Red" OR "Blue") tag="New-Arrival" tag=(NOT "promotional") - # * filterOutOfStockItems tag=(-"promotional") - # * filterOutOfStockItems - # - # If your filter blocks all prediction results, the API will return *no* - # results. If instead you want empty result sets to return generic - # (unfiltered) popular products, set `strictFiltering` to False in - # `PredictRequest.params`. Note that the API will never return items with - # storageStatus of "EXPIRED" or "DELETED" regardless of filter choices. - # - # If `filterSyntaxV2` is set to true under the `params` field, then - # attribute-based expressions are expected instead of the above described - # tag-based syntax. Examples: - # - # * (colors: ANY("Red", "Blue")) AND NOT (categories: ANY("Phones")) - # * (availability: ANY("IN_STOCK")) AND - # (colors: ANY("Red") OR categories: ANY("Phones")) - # - # For more information, see - # [Filter recommendations](https://cloud.google.com/retail/docs/filter-recs). - # @param validate_only [::Boolean] - # Use validate only mode for this prediction query. If set to true, a - # dummy model will be used that returns arbitrary products. - # Note that the validate only mode should only be used for testing the API, - # or if the model is not ready. - # @param params [::Hash{::String => ::Google::Protobuf::Value, ::Hash}] - # Additional domain specific parameters for the predictions. - # - # Allowed values: - # - # * `returnProduct`: Boolean. If set to true, the associated product - # object will be returned in the `results.metadata` field in the - # prediction response. - # * `returnScore`: Boolean. If set to true, the prediction 'score' - # corresponding to each returned product will be set in the - # `results.metadata` field in the prediction response. The given - # 'score' indicates the probability of a product being clicked/purchased - # given the user's context and history. - # * `strictFiltering`: Boolean. True by default. If set to false, the service - # will return generic (unfiltered) popular products instead of empty if - # your filter blocks all prediction results. - # * `priceRerankLevel`: String. Default empty. If set to be non-empty, then - # it needs to be one of {'no-price-reranking', 'low-price-reranking', - # 'medium-price-reranking', 'high-price-reranking'}. This gives - # request-level control and adjusts prediction results based on product - # price. - # * `diversityLevel`: String. Default empty. If set to be non-empty, then - # it needs to be one of {'no-diversity', 'low-diversity', - # 'medium-diversity', 'high-diversity', 'auto-diversity'}. This gives - # request-level control and adjusts prediction results based on product - # category. - # * `filterSyntaxV2`: Boolean. False by default. If set to true, the `filter` - # field is interpreteted according to the new, attribute-based syntax. - # @param labels [::Hash{::String => ::String}] - # The labels applied to a resource must meet the following requirements: - # - # * Each resource can have multiple labels, up to a maximum of 64. - # * Each label must be a key-value pair. - # * Keys have a minimum length of 1 character and a maximum length of 63 - # characters and cannot be empty. Values can be empty and have a maximum - # length of 63 characters. - # * Keys and values can contain only lowercase letters, numeric characters, - # underscores, and dashes. All characters must use UTF-8 encoding, and - # international characters are allowed. - # * The key portion of a label must be unique. However, you can use the same - # key with multiple resources. - # * Keys must start with a lowercase letter or international character. - # - # See [Google Cloud - # Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) - # for more details. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::PredictResponse] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::PredictResponse] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::PredictionService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::PredictRequest.new - # - # # Call the predict method. - # result = client.predict request - # - # # The returned object is of type Google::Cloud::Retail::V2::PredictResponse. - # p result - # - def predict request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::PredictRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.predict.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.predict.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.predict.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @prediction_service_stub.predict request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Configuration class for the PredictionService REST API. - # - # This class represents the configuration for PredictionService REST, - # providing control over timeouts, retry behavior, logging, transport - # parameters, and other low-level controls. Certain parameters can also be - # applied individually to specific RPCs. See - # {::Google::Cloud::Retail::V2::PredictionService::Rest::Client::Configuration::Rpcs} - # for a list of RPCs that can be configured independently. - # - # Configuration can be applied globally to all clients, or to a single client - # on construction. - # - # @example - # - # # Modify the global config, setting the timeout for - # # predict to 20 seconds, - # # and all remaining timeouts to 10 seconds. - # ::Google::Cloud::Retail::V2::PredictionService::Rest::Client.configure do |config| - # config.timeout = 10.0 - # config.rpcs.predict.timeout = 20.0 - # end - # - # # Apply the above configuration only to a new client. - # client = ::Google::Cloud::Retail::V2::PredictionService::Rest::Client.new do |config| - # config.timeout = 10.0 - # config.rpcs.predict.timeout = 20.0 - # end - # - # @!attribute [rw] endpoint - # A custom service endpoint, as a hostname or hostname:port. The default is - # nil, indicating to use the default endpoint in the current universe domain. - # @return [::String,nil] - # @!attribute [rw] credentials - # Credentials to send with calls. You may provide any of the following types: - # * (`String`) The path to a service account key file in JSON format - # * (`Hash`) A service account key as a Hash - # * (`Google::Auth::Credentials`) A googleauth credentials object - # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) - # * (`Signet::OAuth2::Client`) A signet oauth2 client object - # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) - # * (`nil`) indicating no credentials - # - # Warning: If you accept a credential configuration (JSON file or Hash) from an - # external source for authentication to Google Cloud, you must validate it before - # providing it to a Google API client library. Providing an unvalidated credential - # configuration to Google APIs can compromise the security of your systems and data. - # For more information, refer to [Validate credential configurations from external - # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). - # @return [::Object] - # @!attribute [rw] scope - # The OAuth scopes - # @return [::Array<::String>] - # @!attribute [rw] lib_name - # The library name as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] lib_version - # The library version as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] timeout - # The call timeout in seconds. - # @return [::Numeric] - # @!attribute [rw] metadata - # Additional headers to be sent with the call. - # @return [::Hash{::Symbol=>::String}] - # @!attribute [rw] retry_policy - # The retry policy. The value is a hash with the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # @return [::Hash] - # @!attribute [rw] quota_project - # A separate project against which to charge quota. - # @return [::String] - # @!attribute [rw] universe_domain - # The universe domain within which to make requests. This determines the - # default endpoint URL. The default value of nil uses the environment - # universe (usually the default "googleapis.com" universe). - # @return [::String,nil] - # @!attribute [rw] logger - # A custom logger to use for request/response debug logging, or the value - # `:default` (the default) to construct a default logger, or `nil` to - # explicitly disable logging. - # @return [::Logger,:default,nil] - # - class Configuration - extend ::Gapic::Config - - # @private - # The endpoint specific to the default "googleapis.com" universe. Deprecated. - DEFAULT_ENDPOINT = "retail.googleapis.com" - - config_attr :endpoint, nil, ::String, nil - config_attr :credentials, nil do |value| - allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] - allowed.any? { |klass| klass === value } - end - config_attr :scope, nil, ::String, ::Array, nil - config_attr :lib_name, nil, ::String, nil - config_attr :lib_version, nil, ::String, nil - config_attr :timeout, nil, ::Numeric, nil - config_attr :metadata, nil, ::Hash, nil - config_attr :retry_policy, nil, ::Hash, ::Proc, nil - config_attr :quota_project, nil, ::String, nil - config_attr :universe_domain, nil, ::String, nil - config_attr :logger, :default, ::Logger, nil, :default - - # @private - def initialize parent_config = nil - @parent_config = parent_config unless parent_config.nil? - - yield self if block_given? - end - - ## - # Configurations for individual RPCs - # @return [Rpcs] - # - def rpcs - @rpcs ||= begin - parent_rpcs = nil - parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) - Rpcs.new parent_rpcs - end - end - - ## - # Configuration RPC class for the PredictionService API. - # - # Includes fields providing the configuration for each RPC in this service. - # Each configuration object is of type `Gapic::Config::Method` and includes - # the following configuration fields: - # - # * `timeout` (*type:* `Numeric`) - The call timeout in seconds - # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers - # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields - # include the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # - class Rpcs - ## - # RPC-specific configuration for `predict` - # @return [::Gapic::Config::Method] - # - attr_reader :predict - - # @private - def initialize parent_rpcs = nil - predict_config = parent_rpcs.predict if parent_rpcs.respond_to? :predict - @predict = ::Gapic::Config::Method.new predict_config - - yield self if block_given? - end - end - end - end - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/rest/service_stub.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/rest/service_stub.rb deleted file mode 100644 index 4717b50f2d91..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service/rest/service_stub.rb +++ /dev/null @@ -1,151 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "google/cloud/retail/v2/prediction_service_pb" - -module Google - module Cloud - module Retail - module V2 - module PredictionService - module Rest - ## - # REST service stub for the PredictionService service. - # Service stub contains baseline method implementations - # including transcoding, making the REST call, and deserialing the response. - # - class ServiceStub - # @private - def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger: - # These require statements are intentionally placed here to initialize - # the REST modules only when it's required. - require "gapic/rest" - - @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, - endpoint_template: endpoint_template, - universe_domain: universe_domain, - credentials: credentials, - numeric_enums: true, - service_name: self.class, - raise_faraday_errors: false, - logger: logger - end - - ## - # The effective universe domain - # - # @return [String] - # - def universe_domain - @client_stub.universe_domain - end - - ## - # The effective endpoint - # - # @return [String] - # - def endpoint - @client_stub.endpoint - end - - ## - # The logger used for request/response debug logging. - # - # @return [Logger] - # - def logger stub: false - stub ? @client_stub.stub_logger : @client_stub.logger - end - - ## - # Baseline implementation for the predict REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::PredictRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::PredictResponse] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::PredictResponse] - # A result object deserialized from the server's reply - def predict request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_predict_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "predict", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Retail::V2::PredictResponse.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # @private - # - # GRPC transcoding helper method for the predict REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::PredictRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_predict_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :post, - uri_template: "/v2/{placement}:predict", - body: "*", - matches: [ - ["placement", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/placements/[^/]+/?$}, false] - ] - ) - .with_bindings( - uri_method: :post, - uri_template: "/v2/{placement}:predict", - body: "*", - matches: [ - ["placement", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/servingConfigs/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - end - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service_pb.rb deleted file mode 100644 index 5953dae20b84..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service_pb.rb +++ /dev/null @@ -1,30 +0,0 @@ -# frozen_string_literal: true -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/retail/v2/prediction_service.proto - -require 'google/protobuf' - -require 'google/api/annotations_pb' -require 'google/api/client_pb' -require 'google/api/field_behavior_pb' -require 'google/api/resource_pb' -require 'google/cloud/retail/v2/user_event_pb' -require 'google/protobuf/struct_pb' - - -descriptor_data = "\n/google/cloud/retail/v2/prediction_service.proto\x12\x16google.cloud.retail.v2\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\'google/cloud/retail/v2/user_event.proto\x1a\x1cgoogle/protobuf/struct.proto\"\xb4\x03\n\x0ePredictRequest\x12\x16\n\tplacement\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12:\n\nuser_event\x18\x02 \x01(\x0b\x32!.google.cloud.retail.v2.UserEventB\x03\xe0\x41\x02\x12\x11\n\tpage_size\x18\x03 \x01(\x05\x12\x16\n\npage_token\x18\x04 \x01(\tB\x02\x18\x01\x12\x0e\n\x06\x66ilter\x18\x05 \x01(\t\x12\x15\n\rvalidate_only\x18\x06 \x01(\x08\x12\x42\n\x06params\x18\x07 \x03(\x0b\x32\x32.google.cloud.retail.v2.PredictRequest.ParamsEntry\x12\x42\n\x06labels\x18\x08 \x03(\x0b\x32\x32.google.cloud.retail.v2.PredictRequest.LabelsEntry\x1a\x45\n\x0bParamsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12%\n\x05value\x18\x02 \x01(\x0b\x32\x16.google.protobuf.Value:\x02\x38\x01\x1a-\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"\xe7\x02\n\x0fPredictResponse\x12I\n\x07results\x18\x01 \x03(\x0b\x32\x38.google.cloud.retail.v2.PredictResponse.PredictionResult\x12\x19\n\x11\x61ttribution_token\x18\x02 \x01(\t\x12\x13\n\x0bmissing_ids\x18\x03 \x03(\t\x12\x15\n\rvalidate_only\x18\x04 \x01(\x08\x1a\xc1\x01\n\x10PredictionResult\x12\n\n\x02id\x18\x01 \x01(\t\x12X\n\x08metadata\x18\x02 \x03(\x0b\x32\x46.google.cloud.retail.v2.PredictResponse.PredictionResult.MetadataEntry\x1aG\n\rMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12%\n\x05value\x18\x02 \x01(\x0b\x32\x16.google.protobuf.Value:\x02\x38\x01\x32\xe1\x02\n\x11PredictionService\x12\x80\x02\n\x07Predict\x12&.google.cloud.retail.v2.PredictRequest\x1a\'.google.cloud.retail.v2.PredictResponse\"\xa3\x01\x82\xd3\xe4\x93\x02\x9c\x01\"F/v2/{placement=projects/*/locations/*/catalogs/*/placements/*}:predict:\x01*ZO\"J/v2/{placement=projects/*/locations/*/catalogs/*/servingConfigs/*}:predict:\x01*\x1aI\xca\x41\x15retail.googleapis.com\xd2\x41.https://www.googleapis.com/auth/cloud-platformB\xc1\x01\n\x1a\x63om.google.cloud.retail.v2B\x16PredictionServiceProtoP\x01Z2cloud.google.com/go/retail/apiv2/retailpb;retailpb\xa2\x02\x06RETAIL\xaa\x02\x16Google.Cloud.Retail.V2\xca\x02\x16Google\\Cloud\\Retail\\V2\xea\x02\x19Google::Cloud::Retail::V2b\x06proto3" - -pool = ::Google::Protobuf::DescriptorPool.generated_pool -pool.add_serialized_file(descriptor_data) - -module Google - module Cloud - module Retail - module V2 - PredictRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.PredictRequest").msgclass - PredictResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.PredictResponse").msgclass - PredictResponse::PredictionResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.PredictResponse.PredictionResult").msgclass - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service_services_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service_services_pb.rb deleted file mode 100644 index 050119438d40..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/prediction_service_services_pb.rb +++ /dev/null @@ -1,45 +0,0 @@ -# Generated by the protocol buffer compiler. DO NOT EDIT! -# Source: google/cloud/retail/v2/prediction_service.proto for package 'Google.Cloud.Retail.V2' -# Original file comments: -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -require 'grpc' -require 'google/cloud/retail/v2/prediction_service_pb' - -module Google - module Cloud - module Retail - module V2 - module PredictionService - # Service for making recommendation prediction. - class Service - - include ::GRPC::GenericService - - self.marshal_class_method = :encode - self.unmarshal_class_method = :decode - self.service_name = 'google.cloud.retail.v2.PredictionService' - - # Makes a recommendation prediction. - rpc :Predict, ::Google::Cloud::Retail::V2::PredictRequest, ::Google::Cloud::Retail::V2::PredictResponse - end - - Stub = Service.rpc_stub_class - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_pb.rb deleted file mode 100644 index fd072d651729..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_pb.rb +++ /dev/null @@ -1,32 +0,0 @@ -# frozen_string_literal: true -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/retail/v2/product.proto - -require 'google/protobuf' - -require 'google/api/field_behavior_pb' -require 'google/api/resource_pb' -require 'google/cloud/retail/v2/common_pb' -require 'google/cloud/retail/v2/promotion_pb' -require 'google/protobuf/duration_pb' -require 'google/protobuf/field_mask_pb' -require 'google/protobuf/timestamp_pb' -require 'google/protobuf/wrappers_pb' - - -descriptor_data = "\n$google/cloud/retail/v2/product.proto\x12\x16google.cloud.retail.v2\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a#google/cloud/retail/v2/common.proto\x1a&google/cloud/retail/v2/promotion.proto\x1a\x1egoogle/protobuf/duration.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1egoogle/protobuf/wrappers.proto\"\xdb\r\n\x07Product\x12\x31\n\x0b\x65xpire_time\x18\x10 \x01(\x0b\x32\x1a.google.protobuf.TimestampH\x00\x12-\n\x03ttl\x18\x11 \x01(\x0b\x32\x19.google.protobuf.DurationB\x03\xe0\x41\x04H\x00\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x05\x12\x0f\n\x02id\x18\x02 \x01(\tB\x03\xe0\x41\x05\x12\x37\n\x04type\x18\x03 \x01(\x0e\x32$.google.cloud.retail.v2.Product.TypeB\x03\xe0\x41\x05\x12\x1a\n\x12primary_product_id\x18\x04 \x01(\t\x12\x1d\n\x15\x63ollection_member_ids\x18\x05 \x03(\t\x12\x0c\n\x04gtin\x18\x06 \x01(\t\x12\x12\n\ncategories\x18\x07 \x03(\t\x12\x12\n\x05title\x18\x08 \x01(\tB\x03\xe0\x41\x02\x12\x0e\n\x06\x62rands\x18\t \x03(\t\x12\x13\n\x0b\x64\x65scription\x18\n \x01(\t\x12\x15\n\rlanguage_code\x18\x0b \x01(\t\x12\x43\n\nattributes\x18\x0c \x03(\x0b\x32/.google.cloud.retail.v2.Product.AttributesEntry\x12\x0c\n\x04tags\x18\r \x03(\t\x12\x35\n\nprice_info\x18\x0e \x01(\x0b\x32!.google.cloud.retail.v2.PriceInfo\x12.\n\x06rating\x18\x0f \x01(\x0b\x32\x1e.google.cloud.retail.v2.Rating\x12\x32\n\x0e\x61vailable_time\x18\x12 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x42\n\x0c\x61vailability\x18\x13 \x01(\x0e\x32,.google.cloud.retail.v2.Product.Availability\x12\x37\n\x12\x61vailable_quantity\x18\x14 \x01(\x0b\x32\x1b.google.protobuf.Int32Value\x12\x41\n\x10\x66ulfillment_info\x18\x15 \x03(\x0b\x32\'.google.cloud.retail.v2.FulfillmentInfo\x12\x0b\n\x03uri\x18\x16 \x01(\t\x12-\n\x06images\x18\x17 \x03(\x0b\x32\x1d.google.cloud.retail.v2.Image\x12\x32\n\x08\x61udience\x18\x18 \x01(\x0b\x32 .google.cloud.retail.v2.Audience\x12\x35\n\ncolor_info\x18\x19 \x01(\x0b\x32!.google.cloud.retail.v2.ColorInfo\x12\r\n\x05sizes\x18\x1a \x03(\t\x12\x11\n\tmaterials\x18\x1b \x03(\t\x12\x10\n\x08patterns\x18\x1c \x03(\t\x12\x12\n\nconditions\x18\x1d \x03(\t\x12\x35\n\npromotions\x18\" \x03(\x0b\x32!.google.cloud.retail.v2.Promotion\x12\x30\n\x0cpublish_time\x18! \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12:\n\x12retrievable_fields\x18\x1e \x01(\x0b\x32\x1a.google.protobuf.FieldMaskB\x02\x18\x01\x12\x36\n\x08variants\x18\x1f \x03(\x0b\x32\x1f.google.cloud.retail.v2.ProductB\x03\xe0\x41\x03\x12\x46\n\x11local_inventories\x18# \x03(\x0b\x32&.google.cloud.retail.v2.LocalInventoryB\x03\xe0\x41\x03\x1aZ\n\x0f\x41ttributesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x36\n\x05value\x18\x02 \x01(\x0b\x32\'.google.cloud.retail.v2.CustomAttribute:\x02\x38\x01\"F\n\x04Type\x12\x14\n\x10TYPE_UNSPECIFIED\x10\x00\x12\x0b\n\x07PRIMARY\x10\x01\x12\x0b\n\x07VARIANT\x10\x02\x12\x0e\n\nCOLLECTION\x10\x03\"i\n\x0c\x41vailability\x12\x1c\n\x18\x41VAILABILITY_UNSPECIFIED\x10\x00\x12\x0c\n\x08IN_STOCK\x10\x01\x12\x10\n\x0cOUT_OF_STOCK\x10\x02\x12\x0c\n\x08PREORDER\x10\x03\x12\r\n\tBACKORDER\x10\x04:\x84\x01\xea\x41\x80\x01\n\x1dretail.googleapis.com/Product\x12_projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}B\x0c\n\nexpirationB\xa6\x02\n\x1a\x63om.google.cloud.retail.v2B\x0cProductProtoP\x01Z2cloud.google.com/go/retail/apiv2/retailpb;retailpb\xa2\x02\x06RETAIL\xaa\x02\x16Google.Cloud.Retail.V2\xca\x02\x16Google\\Cloud\\Retail\\V2\xea\x02\x19Google::Cloud::Retail::V2\xea\x41l\n\x1cretail.googleapis.com/Branch\x12Lprojects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}b\x06proto3" - -pool = ::Google::Protobuf::DescriptorPool.generated_pool -pool.add_serialized_file(descriptor_data) - -module Google - module Cloud - module Retail - module V2 - Product = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Product").msgclass - Product::Type = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Product.Type").enummodule - Product::Availability = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Product.Availability").enummodule - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service.rb deleted file mode 100644 index b0bca826b962..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service.rb +++ /dev/null @@ -1,57 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "gapic/common" -require "gapic/config" -require "gapic/config/method" - -require "google/cloud/retail/v2/version" - -require "google/cloud/retail/v2/product_service/credentials" -require "google/cloud/retail/v2/product_service/paths" -require "google/cloud/retail/v2/product_service/operations" -require "google/cloud/retail/v2/product_service/client" -require "google/cloud/retail/v2/product_service/rest" - -module Google - module Cloud - module Retail - module V2 - ## - # Service for ingesting {::Google::Cloud::Retail::V2::Product Product} information - # of the customer's website. - # - # @example Load this service and instantiate a gRPC client - # - # require "google/cloud/retail/v2/product_service" - # client = ::Google::Cloud::Retail::V2::ProductService::Client.new - # - # @example Load this service and instantiate a REST client - # - # require "google/cloud/retail/v2/product_service/rest" - # client = ::Google::Cloud::Retail::V2::ProductService::Rest::Client.new - # - module ProductService - end - end - end - end -end - -helper_path = ::File.join __dir__, "product_service", "helpers.rb" -require "google/cloud/retail/v2/product_service/helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/client.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/client.rb deleted file mode 100644 index 769fcf4f1fca..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/client.rb +++ /dev/null @@ -1,2239 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "google/cloud/errors" -require "google/cloud/retail/v2/product_service_pb" -require "google/cloud/location" - -module Google - module Cloud - module Retail - module V2 - module ProductService - ## - # Client for the ProductService service. - # - # Service for ingesting {::Google::Cloud::Retail::V2::Product Product} information - # of the customer's website. - # - class Client - # @private - API_VERSION = "" - - # @private - DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" - - include Paths - - # @private - attr_reader :product_service_stub - - ## - # Configure the ProductService Client class. - # - # See {::Google::Cloud::Retail::V2::ProductService::Client::Configuration} - # for a description of the configuration fields. - # - # @example - # - # # Modify the configuration for all ProductService clients - # ::Google::Cloud::Retail::V2::ProductService::Client.configure do |config| - # config.timeout = 10.0 - # end - # - # @yield [config] Configure the Client client. - # @yieldparam config [Client::Configuration] - # - # @return [Client::Configuration] - # - def self.configure - @configure ||= begin - namespace = ["Google", "Cloud", "Retail", "V2"] - parent_config = while namespace.any? - parent_name = namespace.join "::" - parent_const = const_get parent_name - break parent_const.configure if parent_const.respond_to? :configure - namespace.pop - end - default_config = Client::Configuration.new parent_config - - default_config.timeout = 30.0 - default_config.retry_policy = { - initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [14, 4] - } - - default_config.rpcs.import_products.timeout = 300.0 - default_config.rpcs.import_products.retry_policy = { - initial_delay: 0.1, max_delay: 300.0, multiplier: 1.3, retry_codes: [14, 4] - } - - default_config - end - yield @configure if block_given? - @configure - end - - ## - # Configure the ProductService Client instance. - # - # The configuration is set to the derived mode, meaning that values can be changed, - # but structural changes (adding new fields, etc.) are not allowed. Structural changes - # should be made on {Client.configure}. - # - # See {::Google::Cloud::Retail::V2::ProductService::Client::Configuration} - # for a description of the configuration fields. - # - # @yield [config] Configure the Client client. - # @yieldparam config [Client::Configuration] - # - # @return [Client::Configuration] - # - def configure - yield @config if block_given? - @config - end - - ## - # The effective universe domain - # - # @return [String] - # - def universe_domain - @product_service_stub.universe_domain - end - - ## - # Create a new ProductService client object. - # - # @example - # - # # Create a client using the default configuration - # client = ::Google::Cloud::Retail::V2::ProductService::Client.new - # - # # Create a client using a custom configuration - # client = ::Google::Cloud::Retail::V2::ProductService::Client.new do |config| - # config.timeout = 10.0 - # end - # - # @yield [config] Configure the ProductService client. - # @yieldparam config [Client::Configuration] - # - def initialize - # These require statements are intentionally placed here to initialize - # the gRPC module only when it's required. - # See https://github.com/googleapis/toolkit/issues/446 - require "gapic/grpc" - require "google/cloud/retail/v2/product_service_services_pb" - - # Create the configuration object - @config = Configuration.new Client.configure - - # Yield the configuration if needed - yield @config if block_given? - - # Create credentials - credentials = @config.credentials - # Use self-signed JWT if the endpoint is unchanged from default, - # but only if the default endpoint does not have a region prefix. - enable_self_signed_jwt = @config.endpoint.nil? || - (@config.endpoint == Configuration::DEFAULT_ENDPOINT && - !@config.endpoint.split(".").first.include?("-")) - credentials ||= Credentials.default scope: @config.scope, - enable_self_signed_jwt: enable_self_signed_jwt - if credentials.is_a?(::String) || credentials.is_a?(::Hash) - credentials = Credentials.new credentials, scope: @config.scope - end - @quota_project_id = @config.quota_project - @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id - - @operations_client = Operations.new do |config| - config.credentials = credentials - config.quota_project = @quota_project_id - config.endpoint = @config.endpoint - config.universe_domain = @config.universe_domain - end - - @product_service_stub = ::Gapic::ServiceStub.new( - ::Google::Cloud::Retail::V2::ProductService::Stub, - credentials: credentials, - endpoint: @config.endpoint, - endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, - universe_domain: @config.universe_domain, - channel_args: @config.channel_args, - interceptors: @config.interceptors, - channel_pool_config: @config.channel_pool, - logger: @config.logger - ) - - @product_service_stub.stub_logger&.info do |entry| - entry.set_system_name - entry.set_service - entry.message = "Created client for #{entry.service}" - entry.set_credentials_fields credentials - entry.set "customEndpoint", @config.endpoint if @config.endpoint - entry.set "defaultTimeout", @config.timeout if @config.timeout - entry.set "quotaProject", @quota_project_id if @quota_project_id - end - - @location_client = Google::Cloud::Location::Locations::Client.new do |config| - config.credentials = credentials - config.quota_project = @quota_project_id - config.endpoint = @product_service_stub.endpoint - config.universe_domain = @product_service_stub.universe_domain - config.logger = @product_service_stub.logger if config.respond_to? :logger= - end - end - - ## - # Get the associated client for long-running operations. - # - # @return [::Google::Cloud::Retail::V2::ProductService::Operations] - # - attr_reader :operations_client - - ## - # Get the associated client for mix-in of the Locations. - # - # @return [Google::Cloud::Location::Locations::Client] - # - attr_reader :location_client - - ## - # The logger used for request/response debug logging. - # - # @return [Logger] - # - def logger - @product_service_stub.logger - end - - # Service calls - - ## - # Creates a {::Google::Cloud::Retail::V2::Product Product}. - # - # @overload create_product(request, options = nil) - # Pass arguments to `create_product` via a request object, either of type - # {::Google::Cloud::Retail::V2::CreateProductRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::CreateProductRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload create_product(parent: nil, product: nil, product_id: nil) - # Pass arguments to `create_product` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. The parent catalog resource name, such as - # `projects/*/locations/global/catalogs/default_catalog/branches/default_branch`. - # @param product [::Google::Cloud::Retail::V2::Product, ::Hash] - # Required. The {::Google::Cloud::Retail::V2::Product Product} to create. - # @param product_id [::String] - # Required. The ID to use for the {::Google::Cloud::Retail::V2::Product Product}, - # which will become the final component of the - # {::Google::Cloud::Retail::V2::Product#name Product.name}. - # - # If the caller does not have permission to create the - # {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it - # exists, a PERMISSION_DENIED error is returned. - # - # This field must be unique among all - # {::Google::Cloud::Retail::V2::Product Product}s with the same - # {::Google::Cloud::Retail::V2::CreateProductRequest#parent parent}. Otherwise, an - # ALREADY_EXISTS error is returned. - # - # This field must be a UTF-8 encoded string with a length limit of 128 - # characters. Otherwise, an INVALID_ARGUMENT error is returned. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Cloud::Retail::V2::Product] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Cloud::Retail::V2::Product] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ProductService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::CreateProductRequest.new - # - # # Call the create_product method. - # result = client.create_product request - # - # # The returned object is of type Google::Cloud::Retail::V2::Product. - # p result - # - def create_product request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::CreateProductRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.create_product.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.parent - header_params["parent"] = request.parent - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.create_product.timeout, - metadata: metadata, - retry_policy: @config.rpcs.create_product.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @product_service_stub.call_rpc :create_product, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Gets a {::Google::Cloud::Retail::V2::Product Product}. - # - # @overload get_product(request, options = nil) - # Pass arguments to `get_product` via a request object, either of type - # {::Google::Cloud::Retail::V2::GetProductRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::GetProductRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload get_product(name: nil) - # Pass arguments to `get_product` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # Required. Full resource name of {::Google::Cloud::Retail::V2::Product Product}, - # such as - # `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. - # - # If the caller does not have permission to access the - # {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it - # exists, a PERMISSION_DENIED error is returned. - # - # If the requested {::Google::Cloud::Retail::V2::Product Product} does not exist, - # a NOT_FOUND error is returned. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Cloud::Retail::V2::Product] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Cloud::Retail::V2::Product] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ProductService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::GetProductRequest.new - # - # # Call the get_product method. - # result = client.get_product request - # - # # The returned object is of type Google::Cloud::Retail::V2::Product. - # p result - # - def get_product request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::GetProductRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.get_product.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.name - header_params["name"] = request.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.get_product.timeout, - metadata: metadata, - retry_policy: @config.rpcs.get_product.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @product_service_stub.call_rpc :get_product, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Gets a list of {::Google::Cloud::Retail::V2::Product Product}s. - # - # @overload list_products(request, options = nil) - # Pass arguments to `list_products` via a request object, either of type - # {::Google::Cloud::Retail::V2::ListProductsRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::ListProductsRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload list_products(parent: nil, page_size: nil, page_token: nil, filter: nil, read_mask: nil) - # Pass arguments to `list_products` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. The parent branch resource name, such as - # `projects/*/locations/global/catalogs/default_catalog/branches/0`. Use - # `default_branch` as the branch ID, to list products under the default - # branch. - # - # If the caller does not have permission to list - # {::Google::Cloud::Retail::V2::Product Product}s under this branch, regardless of - # whether or not this branch exists, a PERMISSION_DENIED error is returned. - # @param page_size [::Integer] - # Maximum number of {::Google::Cloud::Retail::V2::Product Product}s to return. If - # unspecified, defaults to 100. The maximum allowed value is 1000. Values - # above 1000 will be coerced to 1000. - # - # If this field is negative, an INVALID_ARGUMENT error is returned. - # @param page_token [::String] - # A page token - # {::Google::Cloud::Retail::V2::ListProductsResponse#next_page_token ListProductsResponse.next_page_token}, - # received from a previous - # {::Google::Cloud::Retail::V2::ProductService::Client#list_products ProductService.ListProducts} - # call. Provide this to retrieve the subsequent page. - # - # When paginating, all other parameters provided to - # {::Google::Cloud::Retail::V2::ProductService::Client#list_products ProductService.ListProducts} - # must match the call that provided the page token. Otherwise, an - # INVALID_ARGUMENT error is returned. - # @param filter [::String] - # A filter to apply on the list results. Supported features: - # - # * List all the products under the parent branch if - # {::Google::Cloud::Retail::V2::ListProductsRequest#filter filter} is unset. - # * List {::Google::Cloud::Retail::V2::Product::Type::VARIANT Product.Type.VARIANT} - # {::Google::Cloud::Retail::V2::Product Product}s sharing the same - # {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Product.Type.PRIMARY} - # {::Google::Cloud::Retail::V2::Product Product}. For example: - # `primary_product_id = "some_product_id"` - # * List {::Google::Cloud::Retail::V2::Product Product}s bundled in a - # {::Google::Cloud::Retail::V2::Product::Type::COLLECTION Product.Type.COLLECTION} - # {::Google::Cloud::Retail::V2::Product Product}. - # For example: - # `collection_product_id = "some_product_id"` - # * List {::Google::Cloud::Retail::V2::Product Product}s with a partibular type. - # For example: - # `type = "PRIMARY"` - # `type = "VARIANT"` - # `type = "COLLECTION"` - # - # If the field is unrecognizable, an INVALID_ARGUMENT error is returned. - # - # If the specified - # {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Product.Type.PRIMARY} - # {::Google::Cloud::Retail::V2::Product Product} or - # {::Google::Cloud::Retail::V2::Product::Type::COLLECTION Product.Type.COLLECTION} - # {::Google::Cloud::Retail::V2::Product Product} does not exist, a NOT_FOUND error - # is returned. - # @param read_mask [::Google::Protobuf::FieldMask, ::Hash] - # The fields of {::Google::Cloud::Retail::V2::Product Product} to return in the - # responses. If not set or empty, the following fields are returned: - # - # * {::Google::Cloud::Retail::V2::Product#name Product.name} - # * {::Google::Cloud::Retail::V2::Product#id Product.id} - # * {::Google::Cloud::Retail::V2::Product#title Product.title} - # * {::Google::Cloud::Retail::V2::Product#uri Product.uri} - # * {::Google::Cloud::Retail::V2::Product#images Product.images} - # * {::Google::Cloud::Retail::V2::Product#price_info Product.price_info} - # * {::Google::Cloud::Retail::V2::Product#brands Product.brands} - # - # If "*" is provided, all fields are returned. - # {::Google::Cloud::Retail::V2::Product#name Product.name} is always returned no - # matter what mask is set. - # - # If an unsupported or unknown field is provided, an INVALID_ARGUMENT error - # is returned. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Retail::V2::Product>] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::PagedEnumerable<::Google::Cloud::Retail::V2::Product>] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ProductService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::ListProductsRequest.new - # - # # Call the list_products method. - # result = client.list_products request - # - # # The returned object is of type Gapic::PagedEnumerable. You can iterate - # # over elements, and API calls will be issued to fetch pages as needed. - # result.each do |item| - # # Each element is of type ::Google::Cloud::Retail::V2::Product. - # p item - # end - # - def list_products request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ListProductsRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.list_products.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.parent - header_params["parent"] = request.parent - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.list_products.timeout, - metadata: metadata, - retry_policy: @config.rpcs.list_products.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @product_service_stub.call_rpc :list_products, request, options: options do |response, operation| - response = ::Gapic::PagedEnumerable.new @product_service_stub, :list_products, request, response, operation, options - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Updates a {::Google::Cloud::Retail::V2::Product Product}. - # - # @overload update_product(request, options = nil) - # Pass arguments to `update_product` via a request object, either of type - # {::Google::Cloud::Retail::V2::UpdateProductRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::UpdateProductRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload update_product(product: nil, update_mask: nil, allow_missing: nil) - # Pass arguments to `update_product` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param product [::Google::Cloud::Retail::V2::Product, ::Hash] - # Required. The product to update/create. - # - # If the caller does not have permission to update the - # {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it - # exists, a PERMISSION_DENIED error is returned. - # - # If the {::Google::Cloud::Retail::V2::Product Product} to update does not exist - # and - # {::Google::Cloud::Retail::V2::UpdateProductRequest#allow_missing allow_missing} - # is not set, a NOT_FOUND error is returned. - # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] - # Indicates which fields in the provided - # {::Google::Cloud::Retail::V2::Product Product} to update. The immutable and - # output only fields are NOT supported. If not set, all supported fields (the - # fields that are neither immutable nor output only) are updated. - # - # If an unsupported or unknown field is provided, an INVALID_ARGUMENT error - # is returned. - # - # The attribute key can be updated by setting the mask path as - # "attributes.$\\{key_name}". If a key name is present in the mask but not in - # the patching product from the request, this key will be deleted after the - # update. - # @param allow_missing [::Boolean] - # If set to true, and the {::Google::Cloud::Retail::V2::Product Product} is not - # found, a new {::Google::Cloud::Retail::V2::Product Product} will be created. In - # this situation, `update_mask` is ignored. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Cloud::Retail::V2::Product] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Cloud::Retail::V2::Product] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ProductService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::UpdateProductRequest.new - # - # # Call the update_product method. - # result = client.update_product request - # - # # The returned object is of type Google::Cloud::Retail::V2::Product. - # p result - # - def update_product request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::UpdateProductRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.update_product.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.product&.name - header_params["product.name"] = request.product.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.update_product.timeout, - metadata: metadata, - retry_policy: @config.rpcs.update_product.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @product_service_stub.call_rpc :update_product, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Deletes a {::Google::Cloud::Retail::V2::Product Product}. - # - # @overload delete_product(request, options = nil) - # Pass arguments to `delete_product` via a request object, either of type - # {::Google::Cloud::Retail::V2::DeleteProductRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::DeleteProductRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload delete_product(name: nil) - # Pass arguments to `delete_product` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # Required. Full resource name of {::Google::Cloud::Retail::V2::Product Product}, - # such as - # `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. - # - # If the caller does not have permission to delete the - # {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it - # exists, a PERMISSION_DENIED error is returned. - # - # If the {::Google::Cloud::Retail::V2::Product Product} to delete does not exist, - # a NOT_FOUND error is returned. - # - # The {::Google::Cloud::Retail::V2::Product Product} to delete can neither be a - # {::Google::Cloud::Retail::V2::Product::Type::COLLECTION Product.Type.COLLECTION} - # {::Google::Cloud::Retail::V2::Product Product} member nor a - # {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Product.Type.PRIMARY} - # {::Google::Cloud::Retail::V2::Product Product} with more than one - # {::Google::Cloud::Retail::V2::Product::Type::VARIANT variants}. Otherwise, an - # INVALID_ARGUMENT error is returned. - # - # All inventory information for the named - # {::Google::Cloud::Retail::V2::Product Product} will be deleted. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Protobuf::Empty] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Protobuf::Empty] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ProductService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::DeleteProductRequest.new - # - # # Call the delete_product method. - # result = client.delete_product request - # - # # The returned object is of type Google::Protobuf::Empty. - # p result - # - def delete_product request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::DeleteProductRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.delete_product.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.name - header_params["name"] = request.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.delete_product.timeout, - metadata: metadata, - retry_policy: @config.rpcs.delete_product.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @product_service_stub.call_rpc :delete_product, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Permanently deletes all selected {::Google::Cloud::Retail::V2::Product Product}s - # under a branch. - # - # This process is asynchronous. If the request is valid, the removal will be - # enqueued and processed offline. Depending on the number of - # {::Google::Cloud::Retail::V2::Product Product}s, this operation could take hours - # to complete. Before the operation completes, some - # {::Google::Cloud::Retail::V2::Product Product}s may still be returned by - # {::Google::Cloud::Retail::V2::ProductService::Client#get_product ProductService.GetProduct} - # or - # {::Google::Cloud::Retail::V2::ProductService::Client#list_products ProductService.ListProducts}. - # - # Depending on the number of {::Google::Cloud::Retail::V2::Product Product}s, this - # operation could take hours to complete. To get a sample of - # {::Google::Cloud::Retail::V2::Product Product}s that would be deleted, set - # {::Google::Cloud::Retail::V2::PurgeProductsRequest#force PurgeProductsRequest.force} - # to false. - # - # @overload purge_products(request, options = nil) - # Pass arguments to `purge_products` via a request object, either of type - # {::Google::Cloud::Retail::V2::PurgeProductsRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::PurgeProductsRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload purge_products(parent: nil, filter: nil, force: nil) - # Pass arguments to `purge_products` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. The resource name of the branch under which the products are - # created. The format is - # `projects/${projectId}/locations/global/catalogs/${catalogId}/branches/${branchId}` - # @param filter [::String] - # Required. The filter string to specify the products to be deleted with a - # length limit of 5,000 characters. - # - # Empty string filter is not allowed. "*" implies delete all items in a - # branch. - # - # The eligible fields for filtering are: - # - # * `availability`: Double quoted - # {::Google::Cloud::Retail::V2::Product#availability Product.availability} string. - # * `create_time` : in ISO 8601 "zulu" format. - # - # Supported syntax: - # - # * Comparators (">", "<", ">=", "<=", "="). - # Examples: - # * create_time <= "2015-02-13T17:05:46Z" - # * availability = "IN_STOCK" - # - # * Conjunctions ("AND") - # Examples: - # * create_time <= "2015-02-13T17:05:46Z" AND availability = "PREORDER" - # - # * Disjunctions ("OR") - # Examples: - # * create_time <= "2015-02-13T17:05:46Z" OR availability = "IN_STOCK" - # - # * Can support nested queries. - # Examples: - # * (create_time <= "2015-02-13T17:05:46Z" AND availability = "PREORDER") - # OR (create_time >= "2015-02-14T13:03:32Z" AND availability = "IN_STOCK") - # - # * Filter Limits: - # * Filter should not contain more than 6 conditions. - # * Max nesting depth should not exceed 2 levels. - # - # Examples queries: - # * Delete back order products created before a timestamp. - # create_time <= "2015-02-13T17:05:46Z" OR availability = "BACKORDER" - # @param force [::Boolean] - # Actually perform the purge. - # If `force` is set to false, the method will return the expected purge count - # without deleting any products. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::Operation] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ProductService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::PurgeProductsRequest.new - # - # # Call the purge_products method. - # result = client.purge_products request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def purge_products request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::PurgeProductsRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.purge_products.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.parent - header_params["parent"] = request.parent - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.purge_products.timeout, - metadata: metadata, - retry_policy: @config.rpcs.purge_products.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @product_service_stub.call_rpc :purge_products, request, options: options do |response, operation| - response = ::Gapic::Operation.new response, @operations_client, options: options - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Bulk import of multiple {::Google::Cloud::Retail::V2::Product Product}s. - # - # Request processing may be synchronous. - # Non-existing items are created. - # - # Note that it is possible for a subset of the - # {::Google::Cloud::Retail::V2::Product Product}s to be successfully updated. - # - # @overload import_products(request, options = nil) - # Pass arguments to `import_products` via a request object, either of type - # {::Google::Cloud::Retail::V2::ImportProductsRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::ImportProductsRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload import_products(parent: nil, request_id: nil, input_config: nil, errors_config: nil, update_mask: nil, reconciliation_mode: nil, notification_pubsub_topic: nil) - # Pass arguments to `import_products` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. - # `projects/1234/locations/global/catalogs/default_catalog/branches/default_branch` - # - # If no updateMask is specified, requires products.create permission. - # If updateMask is specified, requires products.update permission. - # @param request_id [::String] - # Deprecated. This field has no effect. - # @param input_config [::Google::Cloud::Retail::V2::ProductInputConfig, ::Hash] - # Required. The desired input location of the data. - # @param errors_config [::Google::Cloud::Retail::V2::ImportErrorsConfig, ::Hash] - # The desired location of errors incurred during the Import. - # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] - # Indicates which fields in the provided imported `products` to update. If - # not set, all fields are updated. If provided, only the existing product - # fields are updated. Missing products will not be created. - # @param reconciliation_mode [::Google::Cloud::Retail::V2::ImportProductsRequest::ReconciliationMode] - # The mode of reconciliation between existing products and the products to be - # imported. Defaults to - # {::Google::Cloud::Retail::V2::ImportProductsRequest::ReconciliationMode::INCREMENTAL ReconciliationMode.INCREMENTAL}. - # @param notification_pubsub_topic [::String] - # Full Pub/Sub topic name for receiving notification. If this field is set, - # when the import is finished, a notification is sent to - # specified Pub/Sub topic. The message data is JSON string of a - # {::Google::Longrunning::Operation Operation}. - # - # Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. It has - # to be within the same project as - # {::Google::Cloud::Retail::V2::ImportProductsRequest#parent ImportProductsRequest.parent}. - # Make sure that both - # `cloud-retail-customer-data-access@system.gserviceaccount.com` and - # `service-@gcp-sa-retail.iam.gserviceaccount.com` - # have the `pubsub.topics.publish` IAM permission on the topic. - # - # Only supported when - # {::Google::Cloud::Retail::V2::ImportProductsRequest#reconciliation_mode ImportProductsRequest.reconciliation_mode} - # is set to `FULL`. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::Operation] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ProductService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::ImportProductsRequest.new - # - # # Call the import_products method. - # result = client.import_products request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def import_products request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ImportProductsRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.import_products.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.parent - header_params["parent"] = request.parent - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.import_products.timeout, - metadata: metadata, - retry_policy: @config.rpcs.import_products.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @product_service_stub.call_rpc :import_products, request, options: options do |response, operation| - response = ::Gapic::Operation.new response, @operations_client, options: options - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Updates inventory information for a - # {::Google::Cloud::Retail::V2::Product Product} while respecting the last update - # timestamps of each inventory field. - # - # This process is asynchronous and does not require the - # {::Google::Cloud::Retail::V2::Product Product} to exist before updating - # fulfillment information. If the request is valid, the update is enqueued - # and processed downstream. As a consequence, when a response is returned, - # updates are not immediately manifested in the - # {::Google::Cloud::Retail::V2::Product Product} queried by - # {::Google::Cloud::Retail::V2::ProductService::Client#get_product ProductService.GetProduct} - # or - # {::Google::Cloud::Retail::V2::ProductService::Client#list_products ProductService.ListProducts}. - # - # When inventory is updated with - # {::Google::Cloud::Retail::V2::ProductService::Client#create_product ProductService.CreateProduct} - # and - # {::Google::Cloud::Retail::V2::ProductService::Client#update_product ProductService.UpdateProduct}, - # the specified inventory field value(s) overwrite any existing value(s) - # while ignoring the last update time for this field. Furthermore, the last - # update times for the specified inventory fields are overwritten by the - # times of the - # {::Google::Cloud::Retail::V2::ProductService::Client#create_product ProductService.CreateProduct} - # or - # {::Google::Cloud::Retail::V2::ProductService::Client#update_product ProductService.UpdateProduct} - # request. - # - # If no inventory fields are set in - # {::Google::Cloud::Retail::V2::CreateProductRequest#product CreateProductRequest.product}, - # then any pre-existing inventory information for this product is used. - # - # If no inventory fields are set in - # {::Google::Cloud::Retail::V2::SetInventoryRequest#set_mask SetInventoryRequest.set_mask}, - # then any existing inventory information is preserved. - # - # Pre-existing inventory information can only be updated with - # {::Google::Cloud::Retail::V2::ProductService::Client#set_inventory ProductService.SetInventory}, - # {::Google::Cloud::Retail::V2::ProductService::Client#add_fulfillment_places ProductService.AddFulfillmentPlaces}, - # and - # {::Google::Cloud::Retail::V2::ProductService::Client#remove_fulfillment_places ProductService.RemoveFulfillmentPlaces}. - # - # The returned {::Google::Longrunning::Operation Operation}s is obsolete after - # one day, and the GetOperation - # API returns `NOT_FOUND` afterwards. - # - # If conflicting updates are issued, the - # {::Google::Longrunning::Operation Operation}s associated with the stale - # updates are not marked as {::Google::Longrunning::Operation#done done} until - # they are obsolete. - # - # @overload set_inventory(request, options = nil) - # Pass arguments to `set_inventory` via a request object, either of type - # {::Google::Cloud::Retail::V2::SetInventoryRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::SetInventoryRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload set_inventory(inventory: nil, set_mask: nil, set_time: nil, allow_missing: nil) - # Pass arguments to `set_inventory` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param inventory [::Google::Cloud::Retail::V2::Product, ::Hash] - # Required. The inventory information to update. The allowable fields to - # update are: - # - # * {::Google::Cloud::Retail::V2::Product#price_info Product.price_info} - # * {::Google::Cloud::Retail::V2::Product#availability Product.availability} - # * {::Google::Cloud::Retail::V2::Product#available_quantity Product.available_quantity} - # * {::Google::Cloud::Retail::V2::Product#fulfillment_info Product.fulfillment_info} - # The updated inventory fields must be specified in - # {::Google::Cloud::Retail::V2::SetInventoryRequest#set_mask SetInventoryRequest.set_mask}. - # - # If - # {::Google::Cloud::Retail::V2::Product#name SetInventoryRequest.inventory.name} - # is empty or invalid, an INVALID_ARGUMENT error is returned. - # - # If the caller does not have permission to update the - # {::Google::Cloud::Retail::V2::Product Product} named in - # {::Google::Cloud::Retail::V2::Product#name Product.name}, regardless of whether - # or not it exists, a PERMISSION_DENIED error is returned. - # - # If the {::Google::Cloud::Retail::V2::Product Product} to update does not have - # existing inventory information, the provided inventory information will be - # inserted. - # - # If the {::Google::Cloud::Retail::V2::Product Product} to update has existing - # inventory information, the provided inventory information will be merged - # while respecting the last update time for each inventory field, using the - # provided or default value for - # {::Google::Cloud::Retail::V2::SetInventoryRequest#set_time SetInventoryRequest.set_time}. - # - # The caller can replace place IDs for a subset of fulfillment types in the - # following ways: - # - # * Adds "fulfillment_info" in - # {::Google::Cloud::Retail::V2::SetInventoryRequest#set_mask SetInventoryRequest.set_mask} - # * Specifies only the desired fulfillment types and corresponding place IDs - # to update in - # {::Google::Cloud::Retail::V2::Product#fulfillment_info SetInventoryRequest.inventory.fulfillment_info} - # - # The caller can clear all place IDs from a subset of fulfillment types in - # the following ways: - # - # * Adds "fulfillment_info" in - # {::Google::Cloud::Retail::V2::SetInventoryRequest#set_mask SetInventoryRequest.set_mask} - # * Specifies only the desired fulfillment types to clear in - # {::Google::Cloud::Retail::V2::Product#fulfillment_info SetInventoryRequest.inventory.fulfillment_info} - # * Checks that only the desired fulfillment info types have empty - # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids SetInventoryRequest.inventory.fulfillment_info.place_ids} - # - # The last update time is recorded for the following inventory fields: - # * {::Google::Cloud::Retail::V2::Product#price_info Product.price_info} - # * {::Google::Cloud::Retail::V2::Product#availability Product.availability} - # * {::Google::Cloud::Retail::V2::Product#available_quantity Product.available_quantity} - # * {::Google::Cloud::Retail::V2::Product#fulfillment_info Product.fulfillment_info} - # - # If a full overwrite of inventory information while ignoring timestamps is - # needed, - # {::Google::Cloud::Retail::V2::ProductService::Client#update_product ProductService.UpdateProduct} - # should be invoked instead. - # @param set_mask [::Google::Protobuf::FieldMask, ::Hash] - # Indicates which inventory fields in the provided - # {::Google::Cloud::Retail::V2::Product Product} to update. - # - # At least one field must be provided. - # - # If an unsupported or unknown field is provided, an INVALID_ARGUMENT error - # is returned and the entire update will be ignored. - # @param set_time [::Google::Protobuf::Timestamp, ::Hash] - # The time when the request is issued, used to prevent - # out-of-order updates on inventory fields with the last update time - # recorded. If not provided, the internal system time will be used. - # @param allow_missing [::Boolean] - # If set to true, and the {::Google::Cloud::Retail::V2::Product Product} with name - # {::Google::Cloud::Retail::V2::Product#name Product.name} is not found, the - # inventory update will still be processed and retained for at most 1 day - # until the {::Google::Cloud::Retail::V2::Product Product} is created. If set to - # false, a NOT_FOUND error is returned if the - # {::Google::Cloud::Retail::V2::Product Product} is not found. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::Operation] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ProductService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::SetInventoryRequest.new - # - # # Call the set_inventory method. - # result = client.set_inventory request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def set_inventory request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::SetInventoryRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.set_inventory.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.inventory&.name - header_params["inventory.name"] = request.inventory.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.set_inventory.timeout, - metadata: metadata, - retry_policy: @config.rpcs.set_inventory.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @product_service_stub.call_rpc :set_inventory, request, options: options do |response, operation| - response = ::Gapic::Operation.new response, @operations_client, options: options - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # We recommend that you use the - # {::Google::Cloud::Retail::V2::ProductService::Client#add_local_inventories ProductService.AddLocalInventories} - # method instead of the - # {::Google::Cloud::Retail::V2::ProductService::Client#add_fulfillment_places ProductService.AddFulfillmentPlaces} - # method. - # {::Google::Cloud::Retail::V2::ProductService::Client#add_local_inventories ProductService.AddLocalInventories} - # achieves the same results but provides more fine-grained control over - # ingesting local inventory data. - # - # Incrementally adds place IDs to - # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids Product.fulfillment_info.place_ids}. - # - # This process is asynchronous and does not require the - # {::Google::Cloud::Retail::V2::Product Product} to exist before updating - # fulfillment information. If the request is valid, the update will be - # enqueued and processed downstream. As a consequence, when a response is - # returned, the added place IDs are not immediately manifested in the - # {::Google::Cloud::Retail::V2::Product Product} queried by - # {::Google::Cloud::Retail::V2::ProductService::Client#get_product ProductService.GetProduct} - # or - # {::Google::Cloud::Retail::V2::ProductService::Client#list_products ProductService.ListProducts}. - # - # The returned {::Google::Longrunning::Operation Operation}s will be obsolete - # after 1 day, and GetOperation - # API will return NOT_FOUND afterwards. - # - # If conflicting updates are issued, the - # {::Google::Longrunning::Operation Operation}s associated with the stale - # updates will not be marked as {::Google::Longrunning::Operation#done done} - # until being obsolete. - # - # @overload add_fulfillment_places(request, options = nil) - # Pass arguments to `add_fulfillment_places` via a request object, either of type - # {::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload add_fulfillment_places(product: nil, type: nil, place_ids: nil, add_time: nil, allow_missing: nil) - # Pass arguments to `add_fulfillment_places` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param product [::String] - # Required. Full resource name of {::Google::Cloud::Retail::V2::Product Product}, - # such as - # `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. - # - # If the caller does not have permission to access the - # {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it - # exists, a PERMISSION_DENIED error is returned. - # @param type [::String] - # Required. The fulfillment type, including commonly used types (such as - # pickup in store and same day delivery), and custom types. - # - # Supported values: - # - # * "pickup-in-store" - # * "ship-to-store" - # * "same-day-delivery" - # * "next-day-delivery" - # * "custom-type-1" - # * "custom-type-2" - # * "custom-type-3" - # * "custom-type-4" - # * "custom-type-5" - # - # If this field is set to an invalid value other than these, an - # INVALID_ARGUMENT error is returned. - # - # This field directly corresponds to - # {::Google::Cloud::Retail::V2::FulfillmentInfo#type Product.fulfillment_info.type}. - # @param place_ids [::Array<::String>] - # Required. The IDs for this - # {::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest#type type}, such as - # the store IDs for "pickup-in-store" or the region IDs for - # "same-day-delivery" to be added for this - # {::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest#type type}. Duplicate - # IDs will be automatically ignored. - # - # At least 1 value is required, and a maximum of 2000 values are allowed. - # Each value must be a string with a length limit of 10 characters, matching - # the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an - # INVALID_ARGUMENT error is returned. - # - # If the total number of place IDs exceeds 2000 for this - # {::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest#type type} after - # adding, then the update will be rejected. - # @param add_time [::Google::Protobuf::Timestamp, ::Hash] - # The time when the fulfillment updates are issued, used to prevent - # out-of-order updates on fulfillment information. If not provided, the - # internal system time will be used. - # @param allow_missing [::Boolean] - # If set to true, and the {::Google::Cloud::Retail::V2::Product Product} is not - # found, the fulfillment information will still be processed and retained for - # at most 1 day and processed once the - # {::Google::Cloud::Retail::V2::Product Product} is created. If set to false, a - # NOT_FOUND error is returned if the - # {::Google::Cloud::Retail::V2::Product Product} is not found. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::Operation] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ProductService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest.new - # - # # Call the add_fulfillment_places method. - # result = client.add_fulfillment_places request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def add_fulfillment_places request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.add_fulfillment_places.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.product - header_params["product"] = request.product - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.add_fulfillment_places.timeout, - metadata: metadata, - retry_policy: @config.rpcs.add_fulfillment_places.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @product_service_stub.call_rpc :add_fulfillment_places, request, options: options do |response, operation| - response = ::Gapic::Operation.new response, @operations_client, options: options - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # We recommend that you use the - # {::Google::Cloud::Retail::V2::ProductService::Client#remove_local_inventories ProductService.RemoveLocalInventories} - # method instead of the - # {::Google::Cloud::Retail::V2::ProductService::Client#remove_fulfillment_places ProductService.RemoveFulfillmentPlaces} - # method. - # {::Google::Cloud::Retail::V2::ProductService::Client#remove_local_inventories ProductService.RemoveLocalInventories} - # achieves the same results but provides more fine-grained control over - # ingesting local inventory data. - # - # Incrementally removes place IDs from a - # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids Product.fulfillment_info.place_ids}. - # - # This process is asynchronous and does not require the - # {::Google::Cloud::Retail::V2::Product Product} to exist before updating - # fulfillment information. If the request is valid, the update will be - # enqueued and processed downstream. As a consequence, when a response is - # returned, the removed place IDs are not immediately manifested in the - # {::Google::Cloud::Retail::V2::Product Product} queried by - # {::Google::Cloud::Retail::V2::ProductService::Client#get_product ProductService.GetProduct} - # or - # {::Google::Cloud::Retail::V2::ProductService::Client#list_products ProductService.ListProducts}. - # - # The returned {::Google::Longrunning::Operation Operation}s will be obsolete - # after 1 day, and GetOperation - # API will return NOT_FOUND afterwards. - # - # If conflicting updates are issued, the - # {::Google::Longrunning::Operation Operation}s associated with the stale - # updates will not be marked as {::Google::Longrunning::Operation#done done} - # until being obsolete. - # - # @overload remove_fulfillment_places(request, options = nil) - # Pass arguments to `remove_fulfillment_places` via a request object, either of type - # {::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload remove_fulfillment_places(product: nil, type: nil, place_ids: nil, remove_time: nil, allow_missing: nil) - # Pass arguments to `remove_fulfillment_places` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param product [::String] - # Required. Full resource name of {::Google::Cloud::Retail::V2::Product Product}, - # such as - # `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. - # - # If the caller does not have permission to access the - # {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it - # exists, a PERMISSION_DENIED error is returned. - # @param type [::String] - # Required. The fulfillment type, including commonly used types (such as - # pickup in store and same day delivery), and custom types. - # - # Supported values: - # - # * "pickup-in-store" - # * "ship-to-store" - # * "same-day-delivery" - # * "next-day-delivery" - # * "custom-type-1" - # * "custom-type-2" - # * "custom-type-3" - # * "custom-type-4" - # * "custom-type-5" - # - # If this field is set to an invalid value other than these, an - # INVALID_ARGUMENT error is returned. - # - # This field directly corresponds to - # {::Google::Cloud::Retail::V2::FulfillmentInfo#type Product.fulfillment_info.type}. - # @param place_ids [::Array<::String>] - # Required. The IDs for this - # {::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest#type type}, such as - # the store IDs for "pickup-in-store" or the region IDs for - # "same-day-delivery", to be removed for this - # {::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest#type type}. - # - # At least 1 value is required, and a maximum of 2000 values are allowed. - # Each value must be a string with a length limit of 10 characters, matching - # the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an - # INVALID_ARGUMENT error is returned. - # @param remove_time [::Google::Protobuf::Timestamp, ::Hash] - # The time when the fulfillment updates are issued, used to prevent - # out-of-order updates on fulfillment information. If not provided, the - # internal system time will be used. - # @param allow_missing [::Boolean] - # If set to true, and the {::Google::Cloud::Retail::V2::Product Product} is not - # found, the fulfillment information will still be processed and retained for - # at most 1 day and processed once the - # {::Google::Cloud::Retail::V2::Product Product} is created. If set to false, a - # NOT_FOUND error is returned if the - # {::Google::Cloud::Retail::V2::Product Product} is not found. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::Operation] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ProductService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest.new - # - # # Call the remove_fulfillment_places method. - # result = client.remove_fulfillment_places request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def remove_fulfillment_places request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.remove_fulfillment_places.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.product - header_params["product"] = request.product - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.remove_fulfillment_places.timeout, - metadata: metadata, - retry_policy: @config.rpcs.remove_fulfillment_places.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @product_service_stub.call_rpc :remove_fulfillment_places, request, options: options do |response, operation| - response = ::Gapic::Operation.new response, @operations_client, options: options - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Updates local inventory information for a - # {::Google::Cloud::Retail::V2::Product Product} at a list of places, while - # respecting the last update timestamps of each inventory field. - # - # This process is asynchronous and does not require the - # {::Google::Cloud::Retail::V2::Product Product} to exist before updating - # inventory information. If the request is valid, the update will be enqueued - # and processed downstream. As a consequence, when a response is returned, - # updates are not immediately manifested in the - # {::Google::Cloud::Retail::V2::Product Product} queried by - # {::Google::Cloud::Retail::V2::ProductService::Client#get_product ProductService.GetProduct} - # or - # {::Google::Cloud::Retail::V2::ProductService::Client#list_products ProductService.ListProducts}. - # - # Local inventory information can only be modified using this method. - # {::Google::Cloud::Retail::V2::ProductService::Client#create_product ProductService.CreateProduct} - # and - # {::Google::Cloud::Retail::V2::ProductService::Client#update_product ProductService.UpdateProduct} - # has no effect on local inventories. - # - # The returned {::Google::Longrunning::Operation Operation}s will be obsolete - # after 1 day, and GetOperation - # API will return NOT_FOUND afterwards. - # - # If conflicting updates are issued, the - # {::Google::Longrunning::Operation Operation}s associated with the stale - # updates will not be marked as {::Google::Longrunning::Operation#done done} - # until being obsolete. - # - # @overload add_local_inventories(request, options = nil) - # Pass arguments to `add_local_inventories` via a request object, either of type - # {::Google::Cloud::Retail::V2::AddLocalInventoriesRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::AddLocalInventoriesRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload add_local_inventories(product: nil, local_inventories: nil, add_mask: nil, add_time: nil, allow_missing: nil) - # Pass arguments to `add_local_inventories` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param product [::String] - # Required. Full resource name of {::Google::Cloud::Retail::V2::Product Product}, - # such as - # `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. - # - # If the caller does not have permission to access the - # {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it - # exists, a PERMISSION_DENIED error is returned. - # @param local_inventories [::Array<::Google::Cloud::Retail::V2::LocalInventory, ::Hash>] - # Required. A list of inventory information at difference places. Each place - # is identified by its place ID. At most 3000 inventories are allowed per - # request. - # @param add_mask [::Google::Protobuf::FieldMask, ::Hash] - # Indicates which inventory fields in the provided list of - # {::Google::Cloud::Retail::V2::LocalInventory LocalInventory} to update. The - # field is updated to the provided value. - # - # If a field is set while the place does not have a previous local inventory, - # the local inventory at that store is created. - # - # If a field is set while the value of that field is not provided, the - # original field value, if it exists, is deleted. - # - # If the mask is not set or set with empty paths, all inventory fields will - # be updated. - # - # If an unsupported or unknown field is provided, an INVALID_ARGUMENT error - # is returned and the entire update will be ignored. - # @param add_time [::Google::Protobuf::Timestamp, ::Hash] - # The time when the inventory updates are issued. Used to prevent - # out-of-order updates on local inventory fields. If not provided, the - # internal system time will be used. - # @param allow_missing [::Boolean] - # If set to true, and the {::Google::Cloud::Retail::V2::Product Product} is not - # found, the local inventory will still be processed and retained for at most - # 1 day and processed once the {::Google::Cloud::Retail::V2::Product Product} is - # created. If set to false, a NOT_FOUND error is returned if the - # {::Google::Cloud::Retail::V2::Product Product} is not found. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::Operation] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ProductService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::AddLocalInventoriesRequest.new - # - # # Call the add_local_inventories method. - # result = client.add_local_inventories request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def add_local_inventories request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::AddLocalInventoriesRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.add_local_inventories.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.product - header_params["product"] = request.product - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.add_local_inventories.timeout, - metadata: metadata, - retry_policy: @config.rpcs.add_local_inventories.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @product_service_stub.call_rpc :add_local_inventories, request, options: options do |response, operation| - response = ::Gapic::Operation.new response, @operations_client, options: options - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Remove local inventory information for a - # {::Google::Cloud::Retail::V2::Product Product} at a list of places at a removal - # timestamp. - # - # This process is asynchronous. If the request is valid, the removal will be - # enqueued and processed downstream. As a consequence, when a response is - # returned, removals are not immediately manifested in the - # {::Google::Cloud::Retail::V2::Product Product} queried by - # {::Google::Cloud::Retail::V2::ProductService::Client#get_product ProductService.GetProduct} - # or - # {::Google::Cloud::Retail::V2::ProductService::Client#list_products ProductService.ListProducts}. - # - # Local inventory information can only be removed using this method. - # {::Google::Cloud::Retail::V2::ProductService::Client#create_product ProductService.CreateProduct} - # and - # {::Google::Cloud::Retail::V2::ProductService::Client#update_product ProductService.UpdateProduct} - # has no effect on local inventories. - # - # The returned {::Google::Longrunning::Operation Operation}s will be obsolete - # after 1 day, and GetOperation - # API will return NOT_FOUND afterwards. - # - # If conflicting updates are issued, the - # {::Google::Longrunning::Operation Operation}s associated with the stale - # updates will not be marked as {::Google::Longrunning::Operation#done done} - # until being obsolete. - # - # @overload remove_local_inventories(request, options = nil) - # Pass arguments to `remove_local_inventories` via a request object, either of type - # {::Google::Cloud::Retail::V2::RemoveLocalInventoriesRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::RemoveLocalInventoriesRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload remove_local_inventories(product: nil, place_ids: nil, remove_time: nil, allow_missing: nil) - # Pass arguments to `remove_local_inventories` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param product [::String] - # Required. Full resource name of {::Google::Cloud::Retail::V2::Product Product}, - # such as - # `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. - # - # If the caller does not have permission to access the - # {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it - # exists, a PERMISSION_DENIED error is returned. - # @param place_ids [::Array<::String>] - # Required. A list of place IDs to have their inventory deleted. - # At most 3000 place IDs are allowed per request. - # @param remove_time [::Google::Protobuf::Timestamp, ::Hash] - # The time when the inventory deletions are issued. Used to prevent - # out-of-order updates and deletions on local inventory fields. If not - # provided, the internal system time will be used. - # @param allow_missing [::Boolean] - # If set to true, and the {::Google::Cloud::Retail::V2::Product Product} is not - # found, the local inventory removal request will still be processed and - # retained for at most 1 day and processed once the - # {::Google::Cloud::Retail::V2::Product Product} is created. If set to false, a - # NOT_FOUND error is returned if the - # {::Google::Cloud::Retail::V2::Product Product} is not found. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::Operation] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ProductService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::RemoveLocalInventoriesRequest.new - # - # # Call the remove_local_inventories method. - # result = client.remove_local_inventories request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def remove_local_inventories request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::RemoveLocalInventoriesRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.remove_local_inventories.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.product - header_params["product"] = request.product - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.remove_local_inventories.timeout, - metadata: metadata, - retry_policy: @config.rpcs.remove_local_inventories.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @product_service_stub.call_rpc :remove_local_inventories, request, options: options do |response, operation| - response = ::Gapic::Operation.new response, @operations_client, options: options - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Configuration class for the ProductService API. - # - # This class represents the configuration for ProductService, - # providing control over timeouts, retry behavior, logging, transport - # parameters, and other low-level controls. Certain parameters can also be - # applied individually to specific RPCs. See - # {::Google::Cloud::Retail::V2::ProductService::Client::Configuration::Rpcs} - # for a list of RPCs that can be configured independently. - # - # Configuration can be applied globally to all clients, or to a single client - # on construction. - # - # @example - # - # # Modify the global config, setting the timeout for - # # create_product to 20 seconds, - # # and all remaining timeouts to 10 seconds. - # ::Google::Cloud::Retail::V2::ProductService::Client.configure do |config| - # config.timeout = 10.0 - # config.rpcs.create_product.timeout = 20.0 - # end - # - # # Apply the above configuration only to a new client. - # client = ::Google::Cloud::Retail::V2::ProductService::Client.new do |config| - # config.timeout = 10.0 - # config.rpcs.create_product.timeout = 20.0 - # end - # - # @!attribute [rw] endpoint - # A custom service endpoint, as a hostname or hostname:port. The default is - # nil, indicating to use the default endpoint in the current universe domain. - # @return [::String,nil] - # @!attribute [rw] credentials - # Credentials to send with calls. You may provide any of the following types: - # * (`Google::Auth::Credentials`) A googleauth credentials object - # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) - # * (`Signet::OAuth2::Client`) A signet oauth2 client object - # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) - # * (`GRPC::Core::Channel`) a gRPC channel with included credentials - # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object - # * (`nil`) indicating no credentials - # - # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials - # is deprecated. Providing an unvalidated credential configuration to - # Google APIs can compromise the security of your systems and data. - # - # @example - # - # # The recommended way to provide credentials is to use the `make_creds` method - # # on the appropriate credentials class for your environment. - # - # require "googleauth" - # - # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds( - # json_key_io: ::File.open("/path/to/keyfile.json") - # ) - # - # client = ::Google::Cloud::Retail::V2::ProductService::Client.new do |config| - # config.credentials = credentials - # end - # - # @note Warning: If you accept a credential configuration (JSON file or Hash) from an - # external source for authentication to Google Cloud, you must validate it before - # providing it to a Google API client library. Providing an unvalidated credential - # configuration to Google APIs can compromise the security of your systems and data. - # For more information, refer to [Validate credential configurations from external - # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). - # @return [::Object] - # @!attribute [rw] scope - # The OAuth scopes - # @return [::Array<::String>] - # @!attribute [rw] lib_name - # The library name as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] lib_version - # The library version as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] channel_args - # Extra parameters passed to the gRPC channel. Note: this is ignored if a - # `GRPC::Core::Channel` object is provided as the credential. - # @return [::Hash] - # @!attribute [rw] interceptors - # An array of interceptors that are run before calls are executed. - # @return [::Array<::GRPC::ClientInterceptor>] - # @!attribute [rw] timeout - # The call timeout in seconds. - # @return [::Numeric] - # @!attribute [rw] metadata - # Additional gRPC headers to be sent with the call. - # @return [::Hash{::Symbol=>::String}] - # @!attribute [rw] retry_policy - # The retry policy. The value is a hash with the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # @return [::Hash] - # @!attribute [rw] quota_project - # A separate project against which to charge quota. - # @return [::String] - # @!attribute [rw] universe_domain - # The universe domain within which to make requests. This determines the - # default endpoint URL. The default value of nil uses the environment - # universe (usually the default "googleapis.com" universe). - # @return [::String,nil] - # @!attribute [rw] logger - # A custom logger to use for request/response debug logging, or the value - # `:default` (the default) to construct a default logger, or `nil` to - # explicitly disable logging. - # @return [::Logger,:default,nil] - # - class Configuration - extend ::Gapic::Config - - # @private - # The endpoint specific to the default "googleapis.com" universe. Deprecated. - DEFAULT_ENDPOINT = "retail.googleapis.com" - - config_attr :endpoint, nil, ::String, nil - config_attr :credentials, nil do |value| - allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] - allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel - allowed.any? { |klass| klass === value } - end - config_attr :scope, nil, ::String, ::Array, nil - config_attr :lib_name, nil, ::String, nil - config_attr :lib_version, nil, ::String, nil - config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) - config_attr :interceptors, nil, ::Array, nil - config_attr :timeout, nil, ::Numeric, nil - config_attr :metadata, nil, ::Hash, nil - config_attr :retry_policy, nil, ::Hash, ::Proc, nil - config_attr :quota_project, nil, ::String, nil - config_attr :universe_domain, nil, ::String, nil - config_attr :logger, :default, ::Logger, nil, :default - - # @private - def initialize parent_config = nil - @parent_config = parent_config unless parent_config.nil? - - yield self if block_given? - end - - ## - # Configurations for individual RPCs - # @return [Rpcs] - # - def rpcs - @rpcs ||= begin - parent_rpcs = nil - parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) - Rpcs.new parent_rpcs - end - end - - ## - # Configuration for the channel pool - # @return [::Gapic::ServiceStub::ChannelPool::Configuration] - # - def channel_pool - @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new - end - - ## - # Configuration RPC class for the ProductService API. - # - # Includes fields providing the configuration for each RPC in this service. - # Each configuration object is of type `Gapic::Config::Method` and includes - # the following configuration fields: - # - # * `timeout` (*type:* `Numeric`) - The call timeout in seconds - # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers - # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields - # include the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # - class Rpcs - ## - # RPC-specific configuration for `create_product` - # @return [::Gapic::Config::Method] - # - attr_reader :create_product - ## - # RPC-specific configuration for `get_product` - # @return [::Gapic::Config::Method] - # - attr_reader :get_product - ## - # RPC-specific configuration for `list_products` - # @return [::Gapic::Config::Method] - # - attr_reader :list_products - ## - # RPC-specific configuration for `update_product` - # @return [::Gapic::Config::Method] - # - attr_reader :update_product - ## - # RPC-specific configuration for `delete_product` - # @return [::Gapic::Config::Method] - # - attr_reader :delete_product - ## - # RPC-specific configuration for `purge_products` - # @return [::Gapic::Config::Method] - # - attr_reader :purge_products - ## - # RPC-specific configuration for `import_products` - # @return [::Gapic::Config::Method] - # - attr_reader :import_products - ## - # RPC-specific configuration for `set_inventory` - # @return [::Gapic::Config::Method] - # - attr_reader :set_inventory - ## - # RPC-specific configuration for `add_fulfillment_places` - # @return [::Gapic::Config::Method] - # - attr_reader :add_fulfillment_places - ## - # RPC-specific configuration for `remove_fulfillment_places` - # @return [::Gapic::Config::Method] - # - attr_reader :remove_fulfillment_places - ## - # RPC-specific configuration for `add_local_inventories` - # @return [::Gapic::Config::Method] - # - attr_reader :add_local_inventories - ## - # RPC-specific configuration for `remove_local_inventories` - # @return [::Gapic::Config::Method] - # - attr_reader :remove_local_inventories - - # @private - def initialize parent_rpcs = nil - create_product_config = parent_rpcs.create_product if parent_rpcs.respond_to? :create_product - @create_product = ::Gapic::Config::Method.new create_product_config - get_product_config = parent_rpcs.get_product if parent_rpcs.respond_to? :get_product - @get_product = ::Gapic::Config::Method.new get_product_config - list_products_config = parent_rpcs.list_products if parent_rpcs.respond_to? :list_products - @list_products = ::Gapic::Config::Method.new list_products_config - update_product_config = parent_rpcs.update_product if parent_rpcs.respond_to? :update_product - @update_product = ::Gapic::Config::Method.new update_product_config - delete_product_config = parent_rpcs.delete_product if parent_rpcs.respond_to? :delete_product - @delete_product = ::Gapic::Config::Method.new delete_product_config - purge_products_config = parent_rpcs.purge_products if parent_rpcs.respond_to? :purge_products - @purge_products = ::Gapic::Config::Method.new purge_products_config - import_products_config = parent_rpcs.import_products if parent_rpcs.respond_to? :import_products - @import_products = ::Gapic::Config::Method.new import_products_config - set_inventory_config = parent_rpcs.set_inventory if parent_rpcs.respond_to? :set_inventory - @set_inventory = ::Gapic::Config::Method.new set_inventory_config - add_fulfillment_places_config = parent_rpcs.add_fulfillment_places if parent_rpcs.respond_to? :add_fulfillment_places - @add_fulfillment_places = ::Gapic::Config::Method.new add_fulfillment_places_config - remove_fulfillment_places_config = parent_rpcs.remove_fulfillment_places if parent_rpcs.respond_to? :remove_fulfillment_places - @remove_fulfillment_places = ::Gapic::Config::Method.new remove_fulfillment_places_config - add_local_inventories_config = parent_rpcs.add_local_inventories if parent_rpcs.respond_to? :add_local_inventories - @add_local_inventories = ::Gapic::Config::Method.new add_local_inventories_config - remove_local_inventories_config = parent_rpcs.remove_local_inventories if parent_rpcs.respond_to? :remove_local_inventories - @remove_local_inventories = ::Gapic::Config::Method.new remove_local_inventories_config - - yield self if block_given? - end - end - end - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/credentials.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/credentials.rb deleted file mode 100644 index 1a4d7700391f..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/credentials.rb +++ /dev/null @@ -1,51 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "googleauth" - -module Google - module Cloud - module Retail - module V2 - module ProductService - # Credentials for the ProductService API. - class Credentials < ::Google::Auth::Credentials - self.scope = [ - "https://www.googleapis.com/auth/cloud-platform" - ] - self.env_vars = [ - "RETAIL_CREDENTIALS", - "RETAIL_KEYFILE", - "GOOGLE_CLOUD_CREDENTIALS", - "GOOGLE_CLOUD_KEYFILE", - "GCLOUD_KEYFILE", - "RETAIL_CREDENTIALS_JSON", - "RETAIL_KEYFILE_JSON", - "GOOGLE_CLOUD_CREDENTIALS_JSON", - "GOOGLE_CLOUD_KEYFILE_JSON", - "GCLOUD_KEYFILE_JSON" - ] - self.paths = [ - "~/.config/google_cloud/application_default_credentials.json" - ] - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/operations.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/operations.rb deleted file mode 100644 index 73c2f7ea2412..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/operations.rb +++ /dev/null @@ -1,843 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "gapic/operation" -require "google/longrunning/operations_pb" - -module Google - module Cloud - module Retail - module V2 - module ProductService - # Service that implements Longrunning Operations API. - class Operations - # @private - API_VERSION = "" - - # @private - DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" - - # @private - attr_reader :operations_stub - - ## - # Configuration for the ProductService Operations API. - # - # @yield [config] Configure the Operations client. - # @yieldparam config [Operations::Configuration] - # - # @return [Operations::Configuration] - # - def self.configure - @configure ||= Operations::Configuration.new - yield @configure if block_given? - @configure - end - - ## - # Configure the ProductService Operations instance. - # - # The configuration is set to the derived mode, meaning that values can be changed, - # but structural changes (adding new fields, etc.) are not allowed. Structural changes - # should be made on {Operations.configure}. - # - # @yield [config] Configure the Operations client. - # @yieldparam config [Operations::Configuration] - # - # @return [Operations::Configuration] - # - def configure - yield @config if block_given? - @config - end - - ## - # The effective universe domain - # - # @return [String] - # - def universe_domain - @operations_stub.universe_domain - end - - ## - # Create a new Operations client object. - # - # @yield [config] Configure the Client client. - # @yieldparam config [Operations::Configuration] - # - def initialize - # These require statements are intentionally placed here to initialize - # the gRPC module only when it's required. - # See https://github.com/googleapis/toolkit/issues/446 - require "gapic/grpc" - require "google/longrunning/operations_services_pb" - - # Create the configuration object - @config = Configuration.new Operations.configure - - # Yield the configuration if needed - yield @config if block_given? - - # Create credentials - credentials = @config.credentials - credentials ||= Credentials.default scope: @config.scope - if credentials.is_a?(::String) || credentials.is_a?(::Hash) - credentials = Credentials.new credentials, scope: @config.scope - end - @quota_project_id = @config.quota_project - @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id - - @operations_stub = ::Gapic::ServiceStub.new( - ::Google::Longrunning::Operations::Stub, - credentials: credentials, - endpoint: @config.endpoint, - endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, - universe_domain: @config.universe_domain, - channel_args: @config.channel_args, - interceptors: @config.interceptors, - channel_pool_config: @config.channel_pool - ) - - # Used by an LRO wrapper for some methods of this service - @operations_client = self - end - - # Service calls - - ## - # Lists operations that match the specified filter in the request. If the - # server doesn't support this method, it returns `UNIMPLEMENTED`. - # - # @overload list_operations(request, options = nil) - # Pass arguments to `list_operations` via a request object, either of type - # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::ListOperationsRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload list_operations(name: nil, filter: nil, page_size: nil, page_token: nil, return_partial_success: nil) - # Pass arguments to `list_operations` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation's parent resource. - # @param filter [::String] - # The standard list filter. - # @param page_size [::Integer] - # The standard list page size. - # @param page_token [::String] - # The standard list page token. - # @param return_partial_success [::Boolean] - # When set to `true`, operations that are reachable are returned as normal, - # and those that are unreachable are returned in the - # [ListOperationsResponse.unreachable] field. - # - # This can only be `true` when reading across collections e.g. when `parent` - # is set to `"projects/example/locations/-"`. - # - # This field is not by default supported and will result in an - # `UNIMPLEMENTED` error if set unless explicitly documented otherwise in - # service or product specific documentation. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::PagedEnumerable<::Gapic::Operation>] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::PagedEnumerable<::Gapic::Operation>] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::ListOperationsRequest.new - # - # # Call the list_operations method. - # result = client.list_operations request - # - # # The returned object is of type Gapic::PagedEnumerable. You can iterate - # # over elements, and API calls will be issued to fetch pages as needed. - # result.each do |item| - # # Each element is of type ::Google::Longrunning::Operation. - # p item - # end - # - def list_operations request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::ListOperationsRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.list_operations.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.name - header_params["name"] = request.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.list_operations.timeout, - metadata: metadata, - retry_policy: @config.rpcs.list_operations.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.call_rpc :list_operations, request, options: options do |response, operation| - wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client } - response = ::Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Gets the latest state of a long-running operation. Clients can use this - # method to poll the operation result at intervals as recommended by the API - # service. - # - # @overload get_operation(request, options = nil) - # Pass arguments to `get_operation` via a request object, either of type - # {::Google::Longrunning::GetOperationRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::GetOperationRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload get_operation(name: nil) - # Pass arguments to `get_operation` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation resource. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::Operation] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::GetOperationRequest.new - # - # # Call the get_operation method. - # result = client.get_operation request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def get_operation request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::GetOperationRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.get_operation.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.name - header_params["name"] = request.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.get_operation.timeout, - metadata: metadata, - retry_policy: @config.rpcs.get_operation.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.call_rpc :get_operation, request, options: options do |response, operation| - response = ::Gapic::Operation.new response, @operations_client, options: options - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Deletes a long-running operation. This method indicates that the client is - # no longer interested in the operation result. It does not cancel the - # operation. If the server doesn't support this method, it returns - # `google.rpc.Code.UNIMPLEMENTED`. - # - # @overload delete_operation(request, options = nil) - # Pass arguments to `delete_operation` via a request object, either of type - # {::Google::Longrunning::DeleteOperationRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::DeleteOperationRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload delete_operation(name: nil) - # Pass arguments to `delete_operation` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation resource to be deleted. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Protobuf::Empty] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Protobuf::Empty] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::DeleteOperationRequest.new - # - # # Call the delete_operation method. - # result = client.delete_operation request - # - # # The returned object is of type Google::Protobuf::Empty. - # p result - # - def delete_operation request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::DeleteOperationRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.delete_operation.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.name - header_params["name"] = request.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.delete_operation.timeout, - metadata: metadata, - retry_policy: @config.rpcs.delete_operation.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.call_rpc :delete_operation, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Starts asynchronous cancellation on a long-running operation. The server - # makes a best effort to cancel the operation, but success is not - # guaranteed. If the server doesn't support this method, it returns - # `google.rpc.Code.UNIMPLEMENTED`. Clients can use - # Operations.GetOperation or - # other methods to check whether the cancellation succeeded or whether the - # operation completed despite cancellation. On successful cancellation, - # the operation is not deleted; instead, it becomes an operation with - # an {::Google::Longrunning::Operation#error Operation.error} value with a - # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to - # `Code.CANCELLED`. - # - # @overload cancel_operation(request, options = nil) - # Pass arguments to `cancel_operation` via a request object, either of type - # {::Google::Longrunning::CancelOperationRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::CancelOperationRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload cancel_operation(name: nil) - # Pass arguments to `cancel_operation` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation resource to be cancelled. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Protobuf::Empty] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Protobuf::Empty] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::CancelOperationRequest.new - # - # # Call the cancel_operation method. - # result = client.cancel_operation request - # - # # The returned object is of type Google::Protobuf::Empty. - # p result - # - def cancel_operation request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::CancelOperationRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.cancel_operation.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.name - header_params["name"] = request.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.cancel_operation.timeout, - metadata: metadata, - retry_policy: @config.rpcs.cancel_operation.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Waits until the specified long-running operation is done or reaches at most - # a specified timeout, returning the latest state. If the operation is - # already done, the latest state is immediately returned. If the timeout - # specified is greater than the default HTTP/RPC timeout, the HTTP/RPC - # timeout is used. If the server does not support this method, it returns - # `google.rpc.Code.UNIMPLEMENTED`. - # Note that this method is on a best-effort basis. It may return the latest - # state before the specified timeout (including immediately), meaning even an - # immediate response is no guarantee that the operation is done. - # - # @overload wait_operation(request, options = nil) - # Pass arguments to `wait_operation` via a request object, either of type - # {::Google::Longrunning::WaitOperationRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::WaitOperationRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload wait_operation(name: nil, timeout: nil) - # Pass arguments to `wait_operation` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation resource to wait on. - # @param timeout [::Google::Protobuf::Duration, ::Hash] - # The maximum duration to wait before timing out. If left blank, the wait - # will be at most the time permitted by the underlying HTTP/RPC protocol. - # If RPC context deadline is also specified, the shorter one will be used. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::Operation] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::WaitOperationRequest.new - # - # # Call the wait_operation method. - # result = client.wait_operation request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def wait_operation request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::WaitOperationRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.wait_operation.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.wait_operation.timeout, - metadata: metadata, - retry_policy: @config.rpcs.wait_operation.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation| - response = ::Gapic::Operation.new response, @operations_client, options: options - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Configuration class for the Operations API. - # - # This class represents the configuration for Operations, - # providing control over timeouts, retry behavior, logging, transport - # parameters, and other low-level controls. Certain parameters can also be - # applied individually to specific RPCs. See - # {::Google::Longrunning::Operations::Client::Configuration::Rpcs} - # for a list of RPCs that can be configured independently. - # - # Configuration can be applied globally to all clients, or to a single client - # on construction. - # - # @example - # - # # Modify the global config, setting the timeout for - # # list_operations to 20 seconds, - # # and all remaining timeouts to 10 seconds. - # ::Google::Longrunning::Operations::Client.configure do |config| - # config.timeout = 10.0 - # config.rpcs.list_operations.timeout = 20.0 - # end - # - # # Apply the above configuration only to a new client. - # client = ::Google::Longrunning::Operations::Client.new do |config| - # config.timeout = 10.0 - # config.rpcs.list_operations.timeout = 20.0 - # end - # - # @!attribute [rw] endpoint - # A custom service endpoint, as a hostname or hostname:port. The default is - # nil, indicating to use the default endpoint in the current universe domain. - # @return [::String,nil] - # @!attribute [rw] credentials - # Credentials to send with calls. You may provide any of the following types: - # * (`Google::Auth::Credentials`) A googleauth credentials object - # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) - # * (`Signet::OAuth2::Client`) A signet oauth2 client object - # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) - # * (`GRPC::Core::Channel`) a gRPC channel with included credentials - # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object - # * (`nil`) indicating no credentials - # - # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials - # is deprecated. Providing an unvalidated credential configuration to - # Google APIs can compromise the security of your systems and data. - # - # @example - # - # # The recommended way to provide credentials is to use the `make_creds` method - # # on the appropriate credentials class for your environment. - # - # require "googleauth" - # - # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds( - # json_key_io: ::File.open("/path/to/keyfile.json") - # ) - # - # client = ::Google::Longrunning::Operations::Client.new do |config| - # config.credentials = credentials - # end - # - # @note Warning: If you accept a credential configuration (JSON file or Hash) from an - # external source for authentication to Google Cloud, you must validate it before - # providing it to a Google API client library. Providing an unvalidated credential - # configuration to Google APIs can compromise the security of your systems and data. - # For more information, refer to [Validate credential configurations from external - # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). - # @return [::Object] - # @!attribute [rw] scope - # The OAuth scopes - # @return [::Array<::String>] - # @!attribute [rw] lib_name - # The library name as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] lib_version - # The library version as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] channel_args - # Extra parameters passed to the gRPC channel. Note: this is ignored if a - # `GRPC::Core::Channel` object is provided as the credential. - # @return [::Hash] - # @!attribute [rw] interceptors - # An array of interceptors that are run before calls are executed. - # @return [::Array<::GRPC::ClientInterceptor>] - # @!attribute [rw] timeout - # The call timeout in seconds. - # @return [::Numeric] - # @!attribute [rw] metadata - # Additional gRPC headers to be sent with the call. - # @return [::Hash{::Symbol=>::String}] - # @!attribute [rw] retry_policy - # The retry policy. The value is a hash with the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # @return [::Hash] - # @!attribute [rw] quota_project - # A separate project against which to charge quota. - # @return [::String] - # @!attribute [rw] universe_domain - # The universe domain within which to make requests. This determines the - # default endpoint URL. The default value of nil uses the environment - # universe (usually the default "googleapis.com" universe). - # @return [::String,nil] - # @!attribute [rw] logger - # A custom logger to use for request/response debug logging, or the value - # `:default` (the default) to construct a default logger, or `nil` to - # explicitly disable logging. - # @return [::Logger,:default,nil] - # - class Configuration - extend ::Gapic::Config - - # @private - # The endpoint specific to the default "googleapis.com" universe. Deprecated. - DEFAULT_ENDPOINT = "retail.googleapis.com" - - config_attr :endpoint, nil, ::String, nil - config_attr :credentials, nil do |value| - allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] - allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel - allowed.any? { |klass| klass === value } - end - config_attr :scope, nil, ::String, ::Array, nil - config_attr :lib_name, nil, ::String, nil - config_attr :lib_version, nil, ::String, nil - config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) - config_attr :interceptors, nil, ::Array, nil - config_attr :timeout, nil, ::Numeric, nil - config_attr :metadata, nil, ::Hash, nil - config_attr :retry_policy, nil, ::Hash, ::Proc, nil - config_attr :quota_project, nil, ::String, nil - config_attr :universe_domain, nil, ::String, nil - config_attr :logger, :default, ::Logger, nil, :default - - # @private - def initialize parent_config = nil - @parent_config = parent_config unless parent_config.nil? - - yield self if block_given? - end - - ## - # Configurations for individual RPCs - # @return [Rpcs] - # - def rpcs - @rpcs ||= begin - parent_rpcs = nil - parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) - Rpcs.new parent_rpcs - end - end - - ## - # Configuration for the channel pool - # @return [::Gapic::ServiceStub::ChannelPool::Configuration] - # - def channel_pool - @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new - end - - ## - # Configuration RPC class for the Operations API. - # - # Includes fields providing the configuration for each RPC in this service. - # Each configuration object is of type `Gapic::Config::Method` and includes - # the following configuration fields: - # - # * `timeout` (*type:* `Numeric`) - The call timeout in seconds - # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers - # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields - # include the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # - class Rpcs - ## - # RPC-specific configuration for `list_operations` - # @return [::Gapic::Config::Method] - # - attr_reader :list_operations - ## - # RPC-specific configuration for `get_operation` - # @return [::Gapic::Config::Method] - # - attr_reader :get_operation - ## - # RPC-specific configuration for `delete_operation` - # @return [::Gapic::Config::Method] - # - attr_reader :delete_operation - ## - # RPC-specific configuration for `cancel_operation` - # @return [::Gapic::Config::Method] - # - attr_reader :cancel_operation - ## - # RPC-specific configuration for `wait_operation` - # @return [::Gapic::Config::Method] - # - attr_reader :wait_operation - - # @private - def initialize parent_rpcs = nil - list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations - @list_operations = ::Gapic::Config::Method.new list_operations_config - get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation - @get_operation = ::Gapic::Config::Method.new get_operation_config - delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation - @delete_operation = ::Gapic::Config::Method.new delete_operation_config - cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation - @cancel_operation = ::Gapic::Config::Method.new cancel_operation_config - wait_operation_config = parent_rpcs.wait_operation if parent_rpcs.respond_to? :wait_operation - @wait_operation = ::Gapic::Config::Method.new wait_operation_config - - yield self if block_given? - end - end - end - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/paths.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/paths.rb deleted file mode 100644 index c0f4efbe2230..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/paths.rb +++ /dev/null @@ -1,77 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Cloud - module Retail - module V2 - module ProductService - # Path helper methods for the ProductService API. - module Paths - ## - # Create a fully-qualified Branch resource string. - # - # The resource will be in the following format: - # - # `projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}` - # - # @param project [String] - # @param location [String] - # @param catalog [String] - # @param branch [String] - # - # @return [::String] - def branch_path project:, location:, catalog:, branch: - raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" - raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" - raise ::ArgumentError, "catalog cannot contain /" if catalog.to_s.include? "/" - - "projects/#{project}/locations/#{location}/catalogs/#{catalog}/branches/#{branch}" - end - - ## - # Create a fully-qualified Product resource string. - # - # The resource will be in the following format: - # - # `projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}` - # - # @param project [String] - # @param location [String] - # @param catalog [String] - # @param branch [String] - # @param product [String] - # - # @return [::String] - def product_path project:, location:, catalog:, branch:, product: - raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" - raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" - raise ::ArgumentError, "catalog cannot contain /" if catalog.to_s.include? "/" - raise ::ArgumentError, "branch cannot contain /" if branch.to_s.include? "/" - - "projects/#{project}/locations/#{location}/catalogs/#{catalog}/branches/#{branch}/products/#{product}" - end - - extend self - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/rest.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/rest.rb deleted file mode 100644 index 1a50a1c1e9fd..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/rest.rb +++ /dev/null @@ -1,54 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "gapic/rest" -require "gapic/config" -require "gapic/config/method" - -require "google/cloud/retail/v2/version" - -require "google/cloud/retail/v2/product_service/credentials" -require "google/cloud/retail/v2/product_service/paths" -require "google/cloud/retail/v2/product_service/rest/operations" -require "google/cloud/retail/v2/product_service/rest/client" - -module Google - module Cloud - module Retail - module V2 - ## - # Service for ingesting {::Google::Cloud::Retail::V2::Product Product} information - # of the customer's website. - # - # To load this service and instantiate a REST client: - # - # require "google/cloud/retail/v2/product_service/rest" - # client = ::Google::Cloud::Retail::V2::ProductService::Rest::Client.new - # - module ProductService - # Client for the REST transport - module Rest - end - end - end - end - end -end - -helper_path = ::File.join __dir__, "rest", "helpers.rb" -require "google/cloud/retail/v2/product_service/rest/helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/rest/client.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/rest/client.rb deleted file mode 100644 index 489f7e6ccebb..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/rest/client.rb +++ /dev/null @@ -1,2112 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "google/cloud/errors" -require "google/cloud/retail/v2/product_service_pb" -require "google/cloud/retail/v2/product_service/rest/service_stub" -require "google/cloud/location/rest" - -module Google - module Cloud - module Retail - module V2 - module ProductService - module Rest - ## - # REST client for the ProductService service. - # - # Service for ingesting {::Google::Cloud::Retail::V2::Product Product} information - # of the customer's website. - # - class Client - # @private - API_VERSION = "" - - # @private - DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" - - include Paths - - # @private - attr_reader :product_service_stub - - ## - # Configure the ProductService Client class. - # - # See {::Google::Cloud::Retail::V2::ProductService::Rest::Client::Configuration} - # for a description of the configuration fields. - # - # @example - # - # # Modify the configuration for all ProductService clients - # ::Google::Cloud::Retail::V2::ProductService::Rest::Client.configure do |config| - # config.timeout = 10.0 - # end - # - # @yield [config] Configure the Client client. - # @yieldparam config [Client::Configuration] - # - # @return [Client::Configuration] - # - def self.configure - @configure ||= begin - namespace = ["Google", "Cloud", "Retail", "V2"] - parent_config = while namespace.any? - parent_name = namespace.join "::" - parent_const = const_get parent_name - break parent_const.configure if parent_const.respond_to? :configure - namespace.pop - end - default_config = Client::Configuration.new parent_config - - default_config.timeout = 30.0 - default_config.retry_policy = { - initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [14, 4] - } - - default_config.rpcs.import_products.timeout = 300.0 - default_config.rpcs.import_products.retry_policy = { - initial_delay: 0.1, max_delay: 300.0, multiplier: 1.3, retry_codes: [14, 4] - } - - default_config - end - yield @configure if block_given? - @configure - end - - ## - # Configure the ProductService Client instance. - # - # The configuration is set to the derived mode, meaning that values can be changed, - # but structural changes (adding new fields, etc.) are not allowed. Structural changes - # should be made on {Client.configure}. - # - # See {::Google::Cloud::Retail::V2::ProductService::Rest::Client::Configuration} - # for a description of the configuration fields. - # - # @yield [config] Configure the Client client. - # @yieldparam config [Client::Configuration] - # - # @return [Client::Configuration] - # - def configure - yield @config if block_given? - @config - end - - ## - # The effective universe domain - # - # @return [String] - # - def universe_domain - @product_service_stub.universe_domain - end - - ## - # Create a new ProductService REST client object. - # - # @example - # - # # Create a client using the default configuration - # client = ::Google::Cloud::Retail::V2::ProductService::Rest::Client.new - # - # # Create a client using a custom configuration - # client = ::Google::Cloud::Retail::V2::ProductService::Rest::Client.new do |config| - # config.timeout = 10.0 - # end - # - # @yield [config] Configure the ProductService client. - # @yieldparam config [Client::Configuration] - # - def initialize - # Create the configuration object - @config = Configuration.new Client.configure - - # Yield the configuration if needed - yield @config if block_given? - - # Create credentials - credentials = @config.credentials - # Use self-signed JWT if the endpoint is unchanged from default, - # but only if the default endpoint does not have a region prefix. - enable_self_signed_jwt = @config.endpoint.nil? || - (@config.endpoint == Configuration::DEFAULT_ENDPOINT && - !@config.endpoint.split(".").first.include?("-")) - credentials ||= Credentials.default scope: @config.scope, - enable_self_signed_jwt: enable_self_signed_jwt - if credentials.is_a?(::String) || credentials.is_a?(::Hash) - credentials = Credentials.new credentials, scope: @config.scope - end - - @quota_project_id = @config.quota_project - @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id - - @operations_client = ::Google::Cloud::Retail::V2::ProductService::Rest::Operations.new do |config| - config.credentials = credentials - config.quota_project = @quota_project_id - config.endpoint = @config.endpoint - config.universe_domain = @config.universe_domain - end - - @product_service_stub = ::Google::Cloud::Retail::V2::ProductService::Rest::ServiceStub.new( - endpoint: @config.endpoint, - endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, - universe_domain: @config.universe_domain, - credentials: credentials, - logger: @config.logger - ) - - @product_service_stub.logger(stub: true)&.info do |entry| - entry.set_system_name - entry.set_service - entry.message = "Created client for #{entry.service}" - entry.set_credentials_fields credentials - entry.set "customEndpoint", @config.endpoint if @config.endpoint - entry.set "defaultTimeout", @config.timeout if @config.timeout - entry.set "quotaProject", @quota_project_id if @quota_project_id - end - - @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config| - config.credentials = credentials - config.quota_project = @quota_project_id - config.endpoint = @product_service_stub.endpoint - config.universe_domain = @product_service_stub.universe_domain - config.logger = @product_service_stub.logger if config.respond_to? :logger= - end - end - - ## - # Get the associated client for long-running operations. - # - # @return [::Google::Cloud::Retail::V2::ProductService::Rest::Operations] - # - attr_reader :operations_client - - ## - # Get the associated client for mix-in of the Locations. - # - # @return [Google::Cloud::Location::Locations::Rest::Client] - # - attr_reader :location_client - - ## - # The logger used for request/response debug logging. - # - # @return [Logger] - # - def logger - @product_service_stub.logger - end - - # Service calls - - ## - # Creates a {::Google::Cloud::Retail::V2::Product Product}. - # - # @overload create_product(request, options = nil) - # Pass arguments to `create_product` via a request object, either of type - # {::Google::Cloud::Retail::V2::CreateProductRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::CreateProductRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload create_product(parent: nil, product: nil, product_id: nil) - # Pass arguments to `create_product` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. The parent catalog resource name, such as - # `projects/*/locations/global/catalogs/default_catalog/branches/default_branch`. - # @param product [::Google::Cloud::Retail::V2::Product, ::Hash] - # Required. The {::Google::Cloud::Retail::V2::Product Product} to create. - # @param product_id [::String] - # Required. The ID to use for the {::Google::Cloud::Retail::V2::Product Product}, - # which will become the final component of the - # {::Google::Cloud::Retail::V2::Product#name Product.name}. - # - # If the caller does not have permission to create the - # {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it - # exists, a PERMISSION_DENIED error is returned. - # - # This field must be unique among all - # {::Google::Cloud::Retail::V2::Product Product}s with the same - # {::Google::Cloud::Retail::V2::CreateProductRequest#parent parent}. Otherwise, an - # ALREADY_EXISTS error is returned. - # - # This field must be a UTF-8 encoded string with a length limit of 128 - # characters. Otherwise, an INVALID_ARGUMENT error is returned. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::Product] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::Product] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ProductService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::CreateProductRequest.new - # - # # Call the create_product method. - # result = client.create_product request - # - # # The returned object is of type Google::Cloud::Retail::V2::Product. - # p result - # - def create_product request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::CreateProductRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.create_product.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.create_product.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.create_product.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @product_service_stub.create_product request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Gets a {::Google::Cloud::Retail::V2::Product Product}. - # - # @overload get_product(request, options = nil) - # Pass arguments to `get_product` via a request object, either of type - # {::Google::Cloud::Retail::V2::GetProductRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::GetProductRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload get_product(name: nil) - # Pass arguments to `get_product` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # Required. Full resource name of {::Google::Cloud::Retail::V2::Product Product}, - # such as - # `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. - # - # If the caller does not have permission to access the - # {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it - # exists, a PERMISSION_DENIED error is returned. - # - # If the requested {::Google::Cloud::Retail::V2::Product Product} does not exist, - # a NOT_FOUND error is returned. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::Product] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::Product] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ProductService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::GetProductRequest.new - # - # # Call the get_product method. - # result = client.get_product request - # - # # The returned object is of type Google::Cloud::Retail::V2::Product. - # p result - # - def get_product request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::GetProductRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.get_product.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.get_product.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.get_product.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @product_service_stub.get_product request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Gets a list of {::Google::Cloud::Retail::V2::Product Product}s. - # - # @overload list_products(request, options = nil) - # Pass arguments to `list_products` via a request object, either of type - # {::Google::Cloud::Retail::V2::ListProductsRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::ListProductsRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload list_products(parent: nil, page_size: nil, page_token: nil, filter: nil, read_mask: nil) - # Pass arguments to `list_products` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. The parent branch resource name, such as - # `projects/*/locations/global/catalogs/default_catalog/branches/0`. Use - # `default_branch` as the branch ID, to list products under the default - # branch. - # - # If the caller does not have permission to list - # {::Google::Cloud::Retail::V2::Product Product}s under this branch, regardless of - # whether or not this branch exists, a PERMISSION_DENIED error is returned. - # @param page_size [::Integer] - # Maximum number of {::Google::Cloud::Retail::V2::Product Product}s to return. If - # unspecified, defaults to 100. The maximum allowed value is 1000. Values - # above 1000 will be coerced to 1000. - # - # If this field is negative, an INVALID_ARGUMENT error is returned. - # @param page_token [::String] - # A page token - # {::Google::Cloud::Retail::V2::ListProductsResponse#next_page_token ListProductsResponse.next_page_token}, - # received from a previous - # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#list_products ProductService.ListProducts} - # call. Provide this to retrieve the subsequent page. - # - # When paginating, all other parameters provided to - # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#list_products ProductService.ListProducts} - # must match the call that provided the page token. Otherwise, an - # INVALID_ARGUMENT error is returned. - # @param filter [::String] - # A filter to apply on the list results. Supported features: - # - # * List all the products under the parent branch if - # {::Google::Cloud::Retail::V2::ListProductsRequest#filter filter} is unset. - # * List {::Google::Cloud::Retail::V2::Product::Type::VARIANT Product.Type.VARIANT} - # {::Google::Cloud::Retail::V2::Product Product}s sharing the same - # {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Product.Type.PRIMARY} - # {::Google::Cloud::Retail::V2::Product Product}. For example: - # `primary_product_id = "some_product_id"` - # * List {::Google::Cloud::Retail::V2::Product Product}s bundled in a - # {::Google::Cloud::Retail::V2::Product::Type::COLLECTION Product.Type.COLLECTION} - # {::Google::Cloud::Retail::V2::Product Product}. - # For example: - # `collection_product_id = "some_product_id"` - # * List {::Google::Cloud::Retail::V2::Product Product}s with a partibular type. - # For example: - # `type = "PRIMARY"` - # `type = "VARIANT"` - # `type = "COLLECTION"` - # - # If the field is unrecognizable, an INVALID_ARGUMENT error is returned. - # - # If the specified - # {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Product.Type.PRIMARY} - # {::Google::Cloud::Retail::V2::Product Product} or - # {::Google::Cloud::Retail::V2::Product::Type::COLLECTION Product.Type.COLLECTION} - # {::Google::Cloud::Retail::V2::Product Product} does not exist, a NOT_FOUND error - # is returned. - # @param read_mask [::Google::Protobuf::FieldMask, ::Hash] - # The fields of {::Google::Cloud::Retail::V2::Product Product} to return in the - # responses. If not set or empty, the following fields are returned: - # - # * {::Google::Cloud::Retail::V2::Product#name Product.name} - # * {::Google::Cloud::Retail::V2::Product#id Product.id} - # * {::Google::Cloud::Retail::V2::Product#title Product.title} - # * {::Google::Cloud::Retail::V2::Product#uri Product.uri} - # * {::Google::Cloud::Retail::V2::Product#images Product.images} - # * {::Google::Cloud::Retail::V2::Product#price_info Product.price_info} - # * {::Google::Cloud::Retail::V2::Product#brands Product.brands} - # - # If "*" is provided, all fields are returned. - # {::Google::Cloud::Retail::V2::Product#name Product.name} is always returned no - # matter what mask is set. - # - # If an unsupported or unknown field is provided, an INVALID_ARGUMENT error - # is returned. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Retail::V2::Product>] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Retail::V2::Product>] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ProductService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::ListProductsRequest.new - # - # # Call the list_products method. - # result = client.list_products request - # - # # The returned object is of type Gapic::PagedEnumerable. You can iterate - # # over elements, and API calls will be issued to fetch pages as needed. - # result.each do |item| - # # Each element is of type ::Google::Cloud::Retail::V2::Product. - # p item - # end - # - def list_products request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ListProductsRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.list_products.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.list_products.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.list_products.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @product_service_stub.list_products request, options do |result, operation| - result = ::Gapic::Rest::PagedEnumerable.new @product_service_stub, :list_products, "products", request, result, options - yield result, operation if block_given? - throw :response, result - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Updates a {::Google::Cloud::Retail::V2::Product Product}. - # - # @overload update_product(request, options = nil) - # Pass arguments to `update_product` via a request object, either of type - # {::Google::Cloud::Retail::V2::UpdateProductRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::UpdateProductRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload update_product(product: nil, update_mask: nil, allow_missing: nil) - # Pass arguments to `update_product` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param product [::Google::Cloud::Retail::V2::Product, ::Hash] - # Required. The product to update/create. - # - # If the caller does not have permission to update the - # {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it - # exists, a PERMISSION_DENIED error is returned. - # - # If the {::Google::Cloud::Retail::V2::Product Product} to update does not exist - # and - # {::Google::Cloud::Retail::V2::UpdateProductRequest#allow_missing allow_missing} - # is not set, a NOT_FOUND error is returned. - # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] - # Indicates which fields in the provided - # {::Google::Cloud::Retail::V2::Product Product} to update. The immutable and - # output only fields are NOT supported. If not set, all supported fields (the - # fields that are neither immutable nor output only) are updated. - # - # If an unsupported or unknown field is provided, an INVALID_ARGUMENT error - # is returned. - # - # The attribute key can be updated by setting the mask path as - # "attributes.$\\{key_name}". If a key name is present in the mask but not in - # the patching product from the request, this key will be deleted after the - # update. - # @param allow_missing [::Boolean] - # If set to true, and the {::Google::Cloud::Retail::V2::Product Product} is not - # found, a new {::Google::Cloud::Retail::V2::Product Product} will be created. In - # this situation, `update_mask` is ignored. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::Product] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::Product] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ProductService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::UpdateProductRequest.new - # - # # Call the update_product method. - # result = client.update_product request - # - # # The returned object is of type Google::Cloud::Retail::V2::Product. - # p result - # - def update_product request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::UpdateProductRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.update_product.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.update_product.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.update_product.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @product_service_stub.update_product request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Deletes a {::Google::Cloud::Retail::V2::Product Product}. - # - # @overload delete_product(request, options = nil) - # Pass arguments to `delete_product` via a request object, either of type - # {::Google::Cloud::Retail::V2::DeleteProductRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::DeleteProductRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload delete_product(name: nil) - # Pass arguments to `delete_product` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # Required. Full resource name of {::Google::Cloud::Retail::V2::Product Product}, - # such as - # `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. - # - # If the caller does not have permission to delete the - # {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it - # exists, a PERMISSION_DENIED error is returned. - # - # If the {::Google::Cloud::Retail::V2::Product Product} to delete does not exist, - # a NOT_FOUND error is returned. - # - # The {::Google::Cloud::Retail::V2::Product Product} to delete can neither be a - # {::Google::Cloud::Retail::V2::Product::Type::COLLECTION Product.Type.COLLECTION} - # {::Google::Cloud::Retail::V2::Product Product} member nor a - # {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Product.Type.PRIMARY} - # {::Google::Cloud::Retail::V2::Product Product} with more than one - # {::Google::Cloud::Retail::V2::Product::Type::VARIANT variants}. Otherwise, an - # INVALID_ARGUMENT error is returned. - # - # All inventory information for the named - # {::Google::Cloud::Retail::V2::Product Product} will be deleted. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Protobuf::Empty] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Protobuf::Empty] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ProductService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::DeleteProductRequest.new - # - # # Call the delete_product method. - # result = client.delete_product request - # - # # The returned object is of type Google::Protobuf::Empty. - # p result - # - def delete_product request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::DeleteProductRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.delete_product.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.delete_product.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.delete_product.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @product_service_stub.delete_product request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Permanently deletes all selected {::Google::Cloud::Retail::V2::Product Product}s - # under a branch. - # - # This process is asynchronous. If the request is valid, the removal will be - # enqueued and processed offline. Depending on the number of - # {::Google::Cloud::Retail::V2::Product Product}s, this operation could take hours - # to complete. Before the operation completes, some - # {::Google::Cloud::Retail::V2::Product Product}s may still be returned by - # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#get_product ProductService.GetProduct} - # or - # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#list_products ProductService.ListProducts}. - # - # Depending on the number of {::Google::Cloud::Retail::V2::Product Product}s, this - # operation could take hours to complete. To get a sample of - # {::Google::Cloud::Retail::V2::Product Product}s that would be deleted, set - # {::Google::Cloud::Retail::V2::PurgeProductsRequest#force PurgeProductsRequest.force} - # to false. - # - # @overload purge_products(request, options = nil) - # Pass arguments to `purge_products` via a request object, either of type - # {::Google::Cloud::Retail::V2::PurgeProductsRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::PurgeProductsRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload purge_products(parent: nil, filter: nil, force: nil) - # Pass arguments to `purge_products` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. The resource name of the branch under which the products are - # created. The format is - # `projects/${projectId}/locations/global/catalogs/${catalogId}/branches/${branchId}` - # @param filter [::String] - # Required. The filter string to specify the products to be deleted with a - # length limit of 5,000 characters. - # - # Empty string filter is not allowed. "*" implies delete all items in a - # branch. - # - # The eligible fields for filtering are: - # - # * `availability`: Double quoted - # {::Google::Cloud::Retail::V2::Product#availability Product.availability} string. - # * `create_time` : in ISO 8601 "zulu" format. - # - # Supported syntax: - # - # * Comparators (">", "<", ">=", "<=", "="). - # Examples: - # * create_time <= "2015-02-13T17:05:46Z" - # * availability = "IN_STOCK" - # - # * Conjunctions ("AND") - # Examples: - # * create_time <= "2015-02-13T17:05:46Z" AND availability = "PREORDER" - # - # * Disjunctions ("OR") - # Examples: - # * create_time <= "2015-02-13T17:05:46Z" OR availability = "IN_STOCK" - # - # * Can support nested queries. - # Examples: - # * (create_time <= "2015-02-13T17:05:46Z" AND availability = "PREORDER") - # OR (create_time >= "2015-02-14T13:03:32Z" AND availability = "IN_STOCK") - # - # * Filter Limits: - # * Filter should not contain more than 6 conditions. - # * Max nesting depth should not exceed 2 levels. - # - # Examples queries: - # * Delete back order products created before a timestamp. - # create_time <= "2015-02-13T17:05:46Z" OR availability = "BACKORDER" - # @param force [::Boolean] - # Actually perform the purge. - # If `force` is set to false, the method will return the expected purge count - # without deleting any products. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Gapic::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ProductService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::PurgeProductsRequest.new - # - # # Call the purge_products method. - # result = client.purge_products request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def purge_products request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::PurgeProductsRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.purge_products.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.purge_products.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.purge_products.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @product_service_stub.purge_products request, options do |result, operation| - result = ::Gapic::Operation.new result, @operations_client, options: options - yield result, operation if block_given? - throw :response, result - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Bulk import of multiple {::Google::Cloud::Retail::V2::Product Product}s. - # - # Request processing may be synchronous. - # Non-existing items are created. - # - # Note that it is possible for a subset of the - # {::Google::Cloud::Retail::V2::Product Product}s to be successfully updated. - # - # @overload import_products(request, options = nil) - # Pass arguments to `import_products` via a request object, either of type - # {::Google::Cloud::Retail::V2::ImportProductsRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::ImportProductsRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload import_products(parent: nil, request_id: nil, input_config: nil, errors_config: nil, update_mask: nil, reconciliation_mode: nil, notification_pubsub_topic: nil) - # Pass arguments to `import_products` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. - # `projects/1234/locations/global/catalogs/default_catalog/branches/default_branch` - # - # If no updateMask is specified, requires products.create permission. - # If updateMask is specified, requires products.update permission. - # @param request_id [::String] - # Deprecated. This field has no effect. - # @param input_config [::Google::Cloud::Retail::V2::ProductInputConfig, ::Hash] - # Required. The desired input location of the data. - # @param errors_config [::Google::Cloud::Retail::V2::ImportErrorsConfig, ::Hash] - # The desired location of errors incurred during the Import. - # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] - # Indicates which fields in the provided imported `products` to update. If - # not set, all fields are updated. If provided, only the existing product - # fields are updated. Missing products will not be created. - # @param reconciliation_mode [::Google::Cloud::Retail::V2::ImportProductsRequest::ReconciliationMode] - # The mode of reconciliation between existing products and the products to be - # imported. Defaults to - # {::Google::Cloud::Retail::V2::ImportProductsRequest::ReconciliationMode::INCREMENTAL ReconciliationMode.INCREMENTAL}. - # @param notification_pubsub_topic [::String] - # Full Pub/Sub topic name for receiving notification. If this field is set, - # when the import is finished, a notification is sent to - # specified Pub/Sub topic. The message data is JSON string of a - # {::Google::Longrunning::Operation Operation}. - # - # Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. It has - # to be within the same project as - # {::Google::Cloud::Retail::V2::ImportProductsRequest#parent ImportProductsRequest.parent}. - # Make sure that both - # `cloud-retail-customer-data-access@system.gserviceaccount.com` and - # `service-@gcp-sa-retail.iam.gserviceaccount.com` - # have the `pubsub.topics.publish` IAM permission on the topic. - # - # Only supported when - # {::Google::Cloud::Retail::V2::ImportProductsRequest#reconciliation_mode ImportProductsRequest.reconciliation_mode} - # is set to `FULL`. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Gapic::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ProductService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::ImportProductsRequest.new - # - # # Call the import_products method. - # result = client.import_products request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def import_products request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ImportProductsRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.import_products.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.import_products.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.import_products.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @product_service_stub.import_products request, options do |result, operation| - result = ::Gapic::Operation.new result, @operations_client, options: options - yield result, operation if block_given? - throw :response, result - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Updates inventory information for a - # {::Google::Cloud::Retail::V2::Product Product} while respecting the last update - # timestamps of each inventory field. - # - # This process is asynchronous and does not require the - # {::Google::Cloud::Retail::V2::Product Product} to exist before updating - # fulfillment information. If the request is valid, the update is enqueued - # and processed downstream. As a consequence, when a response is returned, - # updates are not immediately manifested in the - # {::Google::Cloud::Retail::V2::Product Product} queried by - # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#get_product ProductService.GetProduct} - # or - # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#list_products ProductService.ListProducts}. - # - # When inventory is updated with - # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#create_product ProductService.CreateProduct} - # and - # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#update_product ProductService.UpdateProduct}, - # the specified inventory field value(s) overwrite any existing value(s) - # while ignoring the last update time for this field. Furthermore, the last - # update times for the specified inventory fields are overwritten by the - # times of the - # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#create_product ProductService.CreateProduct} - # or - # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#update_product ProductService.UpdateProduct} - # request. - # - # If no inventory fields are set in - # {::Google::Cloud::Retail::V2::CreateProductRequest#product CreateProductRequest.product}, - # then any pre-existing inventory information for this product is used. - # - # If no inventory fields are set in - # {::Google::Cloud::Retail::V2::SetInventoryRequest#set_mask SetInventoryRequest.set_mask}, - # then any existing inventory information is preserved. - # - # Pre-existing inventory information can only be updated with - # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#set_inventory ProductService.SetInventory}, - # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#add_fulfillment_places ProductService.AddFulfillmentPlaces}, - # and - # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#remove_fulfillment_places ProductService.RemoveFulfillmentPlaces}. - # - # The returned {::Google::Longrunning::Operation Operation}s is obsolete after - # one day, and the GetOperation - # API returns `NOT_FOUND` afterwards. - # - # If conflicting updates are issued, the - # {::Google::Longrunning::Operation Operation}s associated with the stale - # updates are not marked as {::Google::Longrunning::Operation#done done} until - # they are obsolete. - # - # @overload set_inventory(request, options = nil) - # Pass arguments to `set_inventory` via a request object, either of type - # {::Google::Cloud::Retail::V2::SetInventoryRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::SetInventoryRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload set_inventory(inventory: nil, set_mask: nil, set_time: nil, allow_missing: nil) - # Pass arguments to `set_inventory` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param inventory [::Google::Cloud::Retail::V2::Product, ::Hash] - # Required. The inventory information to update. The allowable fields to - # update are: - # - # * {::Google::Cloud::Retail::V2::Product#price_info Product.price_info} - # * {::Google::Cloud::Retail::V2::Product#availability Product.availability} - # * {::Google::Cloud::Retail::V2::Product#available_quantity Product.available_quantity} - # * {::Google::Cloud::Retail::V2::Product#fulfillment_info Product.fulfillment_info} - # The updated inventory fields must be specified in - # {::Google::Cloud::Retail::V2::SetInventoryRequest#set_mask SetInventoryRequest.set_mask}. - # - # If - # {::Google::Cloud::Retail::V2::Product#name SetInventoryRequest.inventory.name} - # is empty or invalid, an INVALID_ARGUMENT error is returned. - # - # If the caller does not have permission to update the - # {::Google::Cloud::Retail::V2::Product Product} named in - # {::Google::Cloud::Retail::V2::Product#name Product.name}, regardless of whether - # or not it exists, a PERMISSION_DENIED error is returned. - # - # If the {::Google::Cloud::Retail::V2::Product Product} to update does not have - # existing inventory information, the provided inventory information will be - # inserted. - # - # If the {::Google::Cloud::Retail::V2::Product Product} to update has existing - # inventory information, the provided inventory information will be merged - # while respecting the last update time for each inventory field, using the - # provided or default value for - # {::Google::Cloud::Retail::V2::SetInventoryRequest#set_time SetInventoryRequest.set_time}. - # - # The caller can replace place IDs for a subset of fulfillment types in the - # following ways: - # - # * Adds "fulfillment_info" in - # {::Google::Cloud::Retail::V2::SetInventoryRequest#set_mask SetInventoryRequest.set_mask} - # * Specifies only the desired fulfillment types and corresponding place IDs - # to update in - # {::Google::Cloud::Retail::V2::Product#fulfillment_info SetInventoryRequest.inventory.fulfillment_info} - # - # The caller can clear all place IDs from a subset of fulfillment types in - # the following ways: - # - # * Adds "fulfillment_info" in - # {::Google::Cloud::Retail::V2::SetInventoryRequest#set_mask SetInventoryRequest.set_mask} - # * Specifies only the desired fulfillment types to clear in - # {::Google::Cloud::Retail::V2::Product#fulfillment_info SetInventoryRequest.inventory.fulfillment_info} - # * Checks that only the desired fulfillment info types have empty - # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids SetInventoryRequest.inventory.fulfillment_info.place_ids} - # - # The last update time is recorded for the following inventory fields: - # * {::Google::Cloud::Retail::V2::Product#price_info Product.price_info} - # * {::Google::Cloud::Retail::V2::Product#availability Product.availability} - # * {::Google::Cloud::Retail::V2::Product#available_quantity Product.available_quantity} - # * {::Google::Cloud::Retail::V2::Product#fulfillment_info Product.fulfillment_info} - # - # If a full overwrite of inventory information while ignoring timestamps is - # needed, - # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#update_product ProductService.UpdateProduct} - # should be invoked instead. - # @param set_mask [::Google::Protobuf::FieldMask, ::Hash] - # Indicates which inventory fields in the provided - # {::Google::Cloud::Retail::V2::Product Product} to update. - # - # At least one field must be provided. - # - # If an unsupported or unknown field is provided, an INVALID_ARGUMENT error - # is returned and the entire update will be ignored. - # @param set_time [::Google::Protobuf::Timestamp, ::Hash] - # The time when the request is issued, used to prevent - # out-of-order updates on inventory fields with the last update time - # recorded. If not provided, the internal system time will be used. - # @param allow_missing [::Boolean] - # If set to true, and the {::Google::Cloud::Retail::V2::Product Product} with name - # {::Google::Cloud::Retail::V2::Product#name Product.name} is not found, the - # inventory update will still be processed and retained for at most 1 day - # until the {::Google::Cloud::Retail::V2::Product Product} is created. If set to - # false, a NOT_FOUND error is returned if the - # {::Google::Cloud::Retail::V2::Product Product} is not found. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Gapic::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ProductService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::SetInventoryRequest.new - # - # # Call the set_inventory method. - # result = client.set_inventory request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def set_inventory request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::SetInventoryRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.set_inventory.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.set_inventory.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.set_inventory.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @product_service_stub.set_inventory request, options do |result, operation| - result = ::Gapic::Operation.new result, @operations_client, options: options - yield result, operation if block_given? - throw :response, result - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # We recommend that you use the - # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#add_local_inventories ProductService.AddLocalInventories} - # method instead of the - # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#add_fulfillment_places ProductService.AddFulfillmentPlaces} - # method. - # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#add_local_inventories ProductService.AddLocalInventories} - # achieves the same results but provides more fine-grained control over - # ingesting local inventory data. - # - # Incrementally adds place IDs to - # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids Product.fulfillment_info.place_ids}. - # - # This process is asynchronous and does not require the - # {::Google::Cloud::Retail::V2::Product Product} to exist before updating - # fulfillment information. If the request is valid, the update will be - # enqueued and processed downstream. As a consequence, when a response is - # returned, the added place IDs are not immediately manifested in the - # {::Google::Cloud::Retail::V2::Product Product} queried by - # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#get_product ProductService.GetProduct} - # or - # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#list_products ProductService.ListProducts}. - # - # The returned {::Google::Longrunning::Operation Operation}s will be obsolete - # after 1 day, and GetOperation - # API will return NOT_FOUND afterwards. - # - # If conflicting updates are issued, the - # {::Google::Longrunning::Operation Operation}s associated with the stale - # updates will not be marked as {::Google::Longrunning::Operation#done done} - # until being obsolete. - # - # @overload add_fulfillment_places(request, options = nil) - # Pass arguments to `add_fulfillment_places` via a request object, either of type - # {::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload add_fulfillment_places(product: nil, type: nil, place_ids: nil, add_time: nil, allow_missing: nil) - # Pass arguments to `add_fulfillment_places` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param product [::String] - # Required. Full resource name of {::Google::Cloud::Retail::V2::Product Product}, - # such as - # `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. - # - # If the caller does not have permission to access the - # {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it - # exists, a PERMISSION_DENIED error is returned. - # @param type [::String] - # Required. The fulfillment type, including commonly used types (such as - # pickup in store and same day delivery), and custom types. - # - # Supported values: - # - # * "pickup-in-store" - # * "ship-to-store" - # * "same-day-delivery" - # * "next-day-delivery" - # * "custom-type-1" - # * "custom-type-2" - # * "custom-type-3" - # * "custom-type-4" - # * "custom-type-5" - # - # If this field is set to an invalid value other than these, an - # INVALID_ARGUMENT error is returned. - # - # This field directly corresponds to - # {::Google::Cloud::Retail::V2::FulfillmentInfo#type Product.fulfillment_info.type}. - # @param place_ids [::Array<::String>] - # Required. The IDs for this - # {::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest#type type}, such as - # the store IDs for "pickup-in-store" or the region IDs for - # "same-day-delivery" to be added for this - # {::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest#type type}. Duplicate - # IDs will be automatically ignored. - # - # At least 1 value is required, and a maximum of 2000 values are allowed. - # Each value must be a string with a length limit of 10 characters, matching - # the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an - # INVALID_ARGUMENT error is returned. - # - # If the total number of place IDs exceeds 2000 for this - # {::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest#type type} after - # adding, then the update will be rejected. - # @param add_time [::Google::Protobuf::Timestamp, ::Hash] - # The time when the fulfillment updates are issued, used to prevent - # out-of-order updates on fulfillment information. If not provided, the - # internal system time will be used. - # @param allow_missing [::Boolean] - # If set to true, and the {::Google::Cloud::Retail::V2::Product Product} is not - # found, the fulfillment information will still be processed and retained for - # at most 1 day and processed once the - # {::Google::Cloud::Retail::V2::Product Product} is created. If set to false, a - # NOT_FOUND error is returned if the - # {::Google::Cloud::Retail::V2::Product Product} is not found. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Gapic::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ProductService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest.new - # - # # Call the add_fulfillment_places method. - # result = client.add_fulfillment_places request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def add_fulfillment_places request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.add_fulfillment_places.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.add_fulfillment_places.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.add_fulfillment_places.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @product_service_stub.add_fulfillment_places request, options do |result, operation| - result = ::Gapic::Operation.new result, @operations_client, options: options - yield result, operation if block_given? - throw :response, result - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # We recommend that you use the - # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#remove_local_inventories ProductService.RemoveLocalInventories} - # method instead of the - # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#remove_fulfillment_places ProductService.RemoveFulfillmentPlaces} - # method. - # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#remove_local_inventories ProductService.RemoveLocalInventories} - # achieves the same results but provides more fine-grained control over - # ingesting local inventory data. - # - # Incrementally removes place IDs from a - # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids Product.fulfillment_info.place_ids}. - # - # This process is asynchronous and does not require the - # {::Google::Cloud::Retail::V2::Product Product} to exist before updating - # fulfillment information. If the request is valid, the update will be - # enqueued and processed downstream. As a consequence, when a response is - # returned, the removed place IDs are not immediately manifested in the - # {::Google::Cloud::Retail::V2::Product Product} queried by - # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#get_product ProductService.GetProduct} - # or - # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#list_products ProductService.ListProducts}. - # - # The returned {::Google::Longrunning::Operation Operation}s will be obsolete - # after 1 day, and GetOperation - # API will return NOT_FOUND afterwards. - # - # If conflicting updates are issued, the - # {::Google::Longrunning::Operation Operation}s associated with the stale - # updates will not be marked as {::Google::Longrunning::Operation#done done} - # until being obsolete. - # - # @overload remove_fulfillment_places(request, options = nil) - # Pass arguments to `remove_fulfillment_places` via a request object, either of type - # {::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload remove_fulfillment_places(product: nil, type: nil, place_ids: nil, remove_time: nil, allow_missing: nil) - # Pass arguments to `remove_fulfillment_places` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param product [::String] - # Required. Full resource name of {::Google::Cloud::Retail::V2::Product Product}, - # such as - # `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. - # - # If the caller does not have permission to access the - # {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it - # exists, a PERMISSION_DENIED error is returned. - # @param type [::String] - # Required. The fulfillment type, including commonly used types (such as - # pickup in store and same day delivery), and custom types. - # - # Supported values: - # - # * "pickup-in-store" - # * "ship-to-store" - # * "same-day-delivery" - # * "next-day-delivery" - # * "custom-type-1" - # * "custom-type-2" - # * "custom-type-3" - # * "custom-type-4" - # * "custom-type-5" - # - # If this field is set to an invalid value other than these, an - # INVALID_ARGUMENT error is returned. - # - # This field directly corresponds to - # {::Google::Cloud::Retail::V2::FulfillmentInfo#type Product.fulfillment_info.type}. - # @param place_ids [::Array<::String>] - # Required. The IDs for this - # {::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest#type type}, such as - # the store IDs for "pickup-in-store" or the region IDs for - # "same-day-delivery", to be removed for this - # {::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest#type type}. - # - # At least 1 value is required, and a maximum of 2000 values are allowed. - # Each value must be a string with a length limit of 10 characters, matching - # the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an - # INVALID_ARGUMENT error is returned. - # @param remove_time [::Google::Protobuf::Timestamp, ::Hash] - # The time when the fulfillment updates are issued, used to prevent - # out-of-order updates on fulfillment information. If not provided, the - # internal system time will be used. - # @param allow_missing [::Boolean] - # If set to true, and the {::Google::Cloud::Retail::V2::Product Product} is not - # found, the fulfillment information will still be processed and retained for - # at most 1 day and processed once the - # {::Google::Cloud::Retail::V2::Product Product} is created. If set to false, a - # NOT_FOUND error is returned if the - # {::Google::Cloud::Retail::V2::Product Product} is not found. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Gapic::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ProductService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest.new - # - # # Call the remove_fulfillment_places method. - # result = client.remove_fulfillment_places request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def remove_fulfillment_places request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.remove_fulfillment_places.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.remove_fulfillment_places.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.remove_fulfillment_places.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @product_service_stub.remove_fulfillment_places request, options do |result, operation| - result = ::Gapic::Operation.new result, @operations_client, options: options - yield result, operation if block_given? - throw :response, result - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Updates local inventory information for a - # {::Google::Cloud::Retail::V2::Product Product} at a list of places, while - # respecting the last update timestamps of each inventory field. - # - # This process is asynchronous and does not require the - # {::Google::Cloud::Retail::V2::Product Product} to exist before updating - # inventory information. If the request is valid, the update will be enqueued - # and processed downstream. As a consequence, when a response is returned, - # updates are not immediately manifested in the - # {::Google::Cloud::Retail::V2::Product Product} queried by - # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#get_product ProductService.GetProduct} - # or - # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#list_products ProductService.ListProducts}. - # - # Local inventory information can only be modified using this method. - # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#create_product ProductService.CreateProduct} - # and - # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#update_product ProductService.UpdateProduct} - # has no effect on local inventories. - # - # The returned {::Google::Longrunning::Operation Operation}s will be obsolete - # after 1 day, and GetOperation - # API will return NOT_FOUND afterwards. - # - # If conflicting updates are issued, the - # {::Google::Longrunning::Operation Operation}s associated with the stale - # updates will not be marked as {::Google::Longrunning::Operation#done done} - # until being obsolete. - # - # @overload add_local_inventories(request, options = nil) - # Pass arguments to `add_local_inventories` via a request object, either of type - # {::Google::Cloud::Retail::V2::AddLocalInventoriesRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::AddLocalInventoriesRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload add_local_inventories(product: nil, local_inventories: nil, add_mask: nil, add_time: nil, allow_missing: nil) - # Pass arguments to `add_local_inventories` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param product [::String] - # Required. Full resource name of {::Google::Cloud::Retail::V2::Product Product}, - # such as - # `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. - # - # If the caller does not have permission to access the - # {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it - # exists, a PERMISSION_DENIED error is returned. - # @param local_inventories [::Array<::Google::Cloud::Retail::V2::LocalInventory, ::Hash>] - # Required. A list of inventory information at difference places. Each place - # is identified by its place ID. At most 3000 inventories are allowed per - # request. - # @param add_mask [::Google::Protobuf::FieldMask, ::Hash] - # Indicates which inventory fields in the provided list of - # {::Google::Cloud::Retail::V2::LocalInventory LocalInventory} to update. The - # field is updated to the provided value. - # - # If a field is set while the place does not have a previous local inventory, - # the local inventory at that store is created. - # - # If a field is set while the value of that field is not provided, the - # original field value, if it exists, is deleted. - # - # If the mask is not set or set with empty paths, all inventory fields will - # be updated. - # - # If an unsupported or unknown field is provided, an INVALID_ARGUMENT error - # is returned and the entire update will be ignored. - # @param add_time [::Google::Protobuf::Timestamp, ::Hash] - # The time when the inventory updates are issued. Used to prevent - # out-of-order updates on local inventory fields. If not provided, the - # internal system time will be used. - # @param allow_missing [::Boolean] - # If set to true, and the {::Google::Cloud::Retail::V2::Product Product} is not - # found, the local inventory will still be processed and retained for at most - # 1 day and processed once the {::Google::Cloud::Retail::V2::Product Product} is - # created. If set to false, a NOT_FOUND error is returned if the - # {::Google::Cloud::Retail::V2::Product Product} is not found. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Gapic::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ProductService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::AddLocalInventoriesRequest.new - # - # # Call the add_local_inventories method. - # result = client.add_local_inventories request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def add_local_inventories request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::AddLocalInventoriesRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.add_local_inventories.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.add_local_inventories.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.add_local_inventories.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @product_service_stub.add_local_inventories request, options do |result, operation| - result = ::Gapic::Operation.new result, @operations_client, options: options - yield result, operation if block_given? - throw :response, result - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Remove local inventory information for a - # {::Google::Cloud::Retail::V2::Product Product} at a list of places at a removal - # timestamp. - # - # This process is asynchronous. If the request is valid, the removal will be - # enqueued and processed downstream. As a consequence, when a response is - # returned, removals are not immediately manifested in the - # {::Google::Cloud::Retail::V2::Product Product} queried by - # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#get_product ProductService.GetProduct} - # or - # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#list_products ProductService.ListProducts}. - # - # Local inventory information can only be removed using this method. - # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#create_product ProductService.CreateProduct} - # and - # {::Google::Cloud::Retail::V2::ProductService::Rest::Client#update_product ProductService.UpdateProduct} - # has no effect on local inventories. - # - # The returned {::Google::Longrunning::Operation Operation}s will be obsolete - # after 1 day, and GetOperation - # API will return NOT_FOUND afterwards. - # - # If conflicting updates are issued, the - # {::Google::Longrunning::Operation Operation}s associated with the stale - # updates will not be marked as {::Google::Longrunning::Operation#done done} - # until being obsolete. - # - # @overload remove_local_inventories(request, options = nil) - # Pass arguments to `remove_local_inventories` via a request object, either of type - # {::Google::Cloud::Retail::V2::RemoveLocalInventoriesRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::RemoveLocalInventoriesRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload remove_local_inventories(product: nil, place_ids: nil, remove_time: nil, allow_missing: nil) - # Pass arguments to `remove_local_inventories` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param product [::String] - # Required. Full resource name of {::Google::Cloud::Retail::V2::Product Product}, - # such as - # `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. - # - # If the caller does not have permission to access the - # {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it - # exists, a PERMISSION_DENIED error is returned. - # @param place_ids [::Array<::String>] - # Required. A list of place IDs to have their inventory deleted. - # At most 3000 place IDs are allowed per request. - # @param remove_time [::Google::Protobuf::Timestamp, ::Hash] - # The time when the inventory deletions are issued. Used to prevent - # out-of-order updates and deletions on local inventory fields. If not - # provided, the internal system time will be used. - # @param allow_missing [::Boolean] - # If set to true, and the {::Google::Cloud::Retail::V2::Product Product} is not - # found, the local inventory removal request will still be processed and - # retained for at most 1 day and processed once the - # {::Google::Cloud::Retail::V2::Product Product} is created. If set to false, a - # NOT_FOUND error is returned if the - # {::Google::Cloud::Retail::V2::Product Product} is not found. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Gapic::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ProductService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::RemoveLocalInventoriesRequest.new - # - # # Call the remove_local_inventories method. - # result = client.remove_local_inventories request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def remove_local_inventories request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::RemoveLocalInventoriesRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.remove_local_inventories.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.remove_local_inventories.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.remove_local_inventories.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @product_service_stub.remove_local_inventories request, options do |result, operation| - result = ::Gapic::Operation.new result, @operations_client, options: options - yield result, operation if block_given? - throw :response, result - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Configuration class for the ProductService REST API. - # - # This class represents the configuration for ProductService REST, - # providing control over timeouts, retry behavior, logging, transport - # parameters, and other low-level controls. Certain parameters can also be - # applied individually to specific RPCs. See - # {::Google::Cloud::Retail::V2::ProductService::Rest::Client::Configuration::Rpcs} - # for a list of RPCs that can be configured independently. - # - # Configuration can be applied globally to all clients, or to a single client - # on construction. - # - # @example - # - # # Modify the global config, setting the timeout for - # # create_product to 20 seconds, - # # and all remaining timeouts to 10 seconds. - # ::Google::Cloud::Retail::V2::ProductService::Rest::Client.configure do |config| - # config.timeout = 10.0 - # config.rpcs.create_product.timeout = 20.0 - # end - # - # # Apply the above configuration only to a new client. - # client = ::Google::Cloud::Retail::V2::ProductService::Rest::Client.new do |config| - # config.timeout = 10.0 - # config.rpcs.create_product.timeout = 20.0 - # end - # - # @!attribute [rw] endpoint - # A custom service endpoint, as a hostname or hostname:port. The default is - # nil, indicating to use the default endpoint in the current universe domain. - # @return [::String,nil] - # @!attribute [rw] credentials - # Credentials to send with calls. You may provide any of the following types: - # * (`String`) The path to a service account key file in JSON format - # * (`Hash`) A service account key as a Hash - # * (`Google::Auth::Credentials`) A googleauth credentials object - # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) - # * (`Signet::OAuth2::Client`) A signet oauth2 client object - # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) - # * (`nil`) indicating no credentials - # - # Warning: If you accept a credential configuration (JSON file or Hash) from an - # external source for authentication to Google Cloud, you must validate it before - # providing it to a Google API client library. Providing an unvalidated credential - # configuration to Google APIs can compromise the security of your systems and data. - # For more information, refer to [Validate credential configurations from external - # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). - # @return [::Object] - # @!attribute [rw] scope - # The OAuth scopes - # @return [::Array<::String>] - # @!attribute [rw] lib_name - # The library name as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] lib_version - # The library version as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] timeout - # The call timeout in seconds. - # @return [::Numeric] - # @!attribute [rw] metadata - # Additional headers to be sent with the call. - # @return [::Hash{::Symbol=>::String}] - # @!attribute [rw] retry_policy - # The retry policy. The value is a hash with the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # @return [::Hash] - # @!attribute [rw] quota_project - # A separate project against which to charge quota. - # @return [::String] - # @!attribute [rw] universe_domain - # The universe domain within which to make requests. This determines the - # default endpoint URL. The default value of nil uses the environment - # universe (usually the default "googleapis.com" universe). - # @return [::String,nil] - # @!attribute [rw] logger - # A custom logger to use for request/response debug logging, or the value - # `:default` (the default) to construct a default logger, or `nil` to - # explicitly disable logging. - # @return [::Logger,:default,nil] - # - class Configuration - extend ::Gapic::Config - - # @private - # The endpoint specific to the default "googleapis.com" universe. Deprecated. - DEFAULT_ENDPOINT = "retail.googleapis.com" - - config_attr :endpoint, nil, ::String, nil - config_attr :credentials, nil do |value| - allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] - allowed.any? { |klass| klass === value } - end - config_attr :scope, nil, ::String, ::Array, nil - config_attr :lib_name, nil, ::String, nil - config_attr :lib_version, nil, ::String, nil - config_attr :timeout, nil, ::Numeric, nil - config_attr :metadata, nil, ::Hash, nil - config_attr :retry_policy, nil, ::Hash, ::Proc, nil - config_attr :quota_project, nil, ::String, nil - config_attr :universe_domain, nil, ::String, nil - config_attr :logger, :default, ::Logger, nil, :default - - # @private - def initialize parent_config = nil - @parent_config = parent_config unless parent_config.nil? - - yield self if block_given? - end - - ## - # Configurations for individual RPCs - # @return [Rpcs] - # - def rpcs - @rpcs ||= begin - parent_rpcs = nil - parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) - Rpcs.new parent_rpcs - end - end - - ## - # Configuration RPC class for the ProductService API. - # - # Includes fields providing the configuration for each RPC in this service. - # Each configuration object is of type `Gapic::Config::Method` and includes - # the following configuration fields: - # - # * `timeout` (*type:* `Numeric`) - The call timeout in seconds - # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers - # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields - # include the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # - class Rpcs - ## - # RPC-specific configuration for `create_product` - # @return [::Gapic::Config::Method] - # - attr_reader :create_product - ## - # RPC-specific configuration for `get_product` - # @return [::Gapic::Config::Method] - # - attr_reader :get_product - ## - # RPC-specific configuration for `list_products` - # @return [::Gapic::Config::Method] - # - attr_reader :list_products - ## - # RPC-specific configuration for `update_product` - # @return [::Gapic::Config::Method] - # - attr_reader :update_product - ## - # RPC-specific configuration for `delete_product` - # @return [::Gapic::Config::Method] - # - attr_reader :delete_product - ## - # RPC-specific configuration for `purge_products` - # @return [::Gapic::Config::Method] - # - attr_reader :purge_products - ## - # RPC-specific configuration for `import_products` - # @return [::Gapic::Config::Method] - # - attr_reader :import_products - ## - # RPC-specific configuration for `set_inventory` - # @return [::Gapic::Config::Method] - # - attr_reader :set_inventory - ## - # RPC-specific configuration for `add_fulfillment_places` - # @return [::Gapic::Config::Method] - # - attr_reader :add_fulfillment_places - ## - # RPC-specific configuration for `remove_fulfillment_places` - # @return [::Gapic::Config::Method] - # - attr_reader :remove_fulfillment_places - ## - # RPC-specific configuration for `add_local_inventories` - # @return [::Gapic::Config::Method] - # - attr_reader :add_local_inventories - ## - # RPC-specific configuration for `remove_local_inventories` - # @return [::Gapic::Config::Method] - # - attr_reader :remove_local_inventories - - # @private - def initialize parent_rpcs = nil - create_product_config = parent_rpcs.create_product if parent_rpcs.respond_to? :create_product - @create_product = ::Gapic::Config::Method.new create_product_config - get_product_config = parent_rpcs.get_product if parent_rpcs.respond_to? :get_product - @get_product = ::Gapic::Config::Method.new get_product_config - list_products_config = parent_rpcs.list_products if parent_rpcs.respond_to? :list_products - @list_products = ::Gapic::Config::Method.new list_products_config - update_product_config = parent_rpcs.update_product if parent_rpcs.respond_to? :update_product - @update_product = ::Gapic::Config::Method.new update_product_config - delete_product_config = parent_rpcs.delete_product if parent_rpcs.respond_to? :delete_product - @delete_product = ::Gapic::Config::Method.new delete_product_config - purge_products_config = parent_rpcs.purge_products if parent_rpcs.respond_to? :purge_products - @purge_products = ::Gapic::Config::Method.new purge_products_config - import_products_config = parent_rpcs.import_products if parent_rpcs.respond_to? :import_products - @import_products = ::Gapic::Config::Method.new import_products_config - set_inventory_config = parent_rpcs.set_inventory if parent_rpcs.respond_to? :set_inventory - @set_inventory = ::Gapic::Config::Method.new set_inventory_config - add_fulfillment_places_config = parent_rpcs.add_fulfillment_places if parent_rpcs.respond_to? :add_fulfillment_places - @add_fulfillment_places = ::Gapic::Config::Method.new add_fulfillment_places_config - remove_fulfillment_places_config = parent_rpcs.remove_fulfillment_places if parent_rpcs.respond_to? :remove_fulfillment_places - @remove_fulfillment_places = ::Gapic::Config::Method.new remove_fulfillment_places_config - add_local_inventories_config = parent_rpcs.add_local_inventories if parent_rpcs.respond_to? :add_local_inventories - @add_local_inventories = ::Gapic::Config::Method.new add_local_inventories_config - remove_local_inventories_config = parent_rpcs.remove_local_inventories if parent_rpcs.respond_to? :remove_local_inventories - @remove_local_inventories = ::Gapic::Config::Method.new remove_local_inventories_config - - yield self if block_given? - end - end - end - end - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/rest/operations.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/rest/operations.rb deleted file mode 100644 index f14d649ba52d..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/rest/operations.rb +++ /dev/null @@ -1,962 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "gapic/operation" - -module Google - module Cloud - module Retail - module V2 - module ProductService - module Rest - # Service that implements Longrunning Operations API. - class Operations - # @private - API_VERSION = "" - - # @private - DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" - - # @private - attr_reader :operations_stub - - ## - # Configuration for the ProductService Operations API. - # - # @yield [config] Configure the Operations client. - # @yieldparam config [Operations::Configuration] - # - # @return [Operations::Configuration] - # - def self.configure - @configure ||= Operations::Configuration.new - yield @configure if block_given? - @configure - end - - ## - # Configure the ProductService Operations instance. - # - # The configuration is set to the derived mode, meaning that values can be changed, - # but structural changes (adding new fields, etc.) are not allowed. Structural changes - # should be made on {Operations.configure}. - # - # @yield [config] Configure the Operations client. - # @yieldparam config [Operations::Configuration] - # - # @return [Operations::Configuration] - # - def configure - yield @config if block_given? - @config - end - - ## - # The effective universe domain - # - # @return [String] - # - def universe_domain - @operations_stub.universe_domain - end - - ## - # Create a new Operations client object. - # - # @yield [config] Configure the Client client. - # @yieldparam config [Operations::Configuration] - # - def initialize - # Create the configuration object - @config = Configuration.new Operations.configure - - # Yield the configuration if needed - yield @config if block_given? - - # Create credentials - credentials = @config.credentials - credentials ||= Credentials.default scope: @config.scope - if credentials.is_a?(::String) || credentials.is_a?(::Hash) - credentials = Credentials.new credentials, scope: @config.scope - end - - @quota_project_id = @config.quota_project - @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id - - @operations_stub = OperationsServiceStub.new( - endpoint: @config.endpoint, - endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, - universe_domain: @config.universe_domain, - credentials: credentials - ) - - # Used by an LRO wrapper for some methods of this service - @operations_client = self - end - - # Service calls - - ## - # Lists operations that match the specified filter in the request. If the - # server doesn't support this method, it returns `UNIMPLEMENTED`. - # - # @overload list_operations(request, options = nil) - # Pass arguments to `list_operations` via a request object, either of type - # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::ListOperationsRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload list_operations(name: nil, filter: nil, page_size: nil, page_token: nil, return_partial_success: nil) - # Pass arguments to `list_operations` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation's parent resource. - # @param filter [::String] - # The standard list filter. - # @param page_size [::Integer] - # The standard list page size. - # @param page_token [::String] - # The standard list page token. - # @param return_partial_success [::Boolean] - # When set to `true`, operations that are reachable are returned as normal, - # and those that are unreachable are returned in the - # [ListOperationsResponse.unreachable] field. - # - # This can only be `true` when reading across collections e.g. when `parent` - # is set to `"projects/example/locations/-"`. - # - # This field is not by default supported and will result in an - # `UNIMPLEMENTED` error if set unless explicitly documented otherwise in - # service or product specific documentation. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Gapic::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::ListOperationsRequest.new - # - # # Call the list_operations method. - # result = client.list_operations request - # - # # The returned object is of type Gapic::PagedEnumerable. You can iterate - # # over elements, and API calls will be issued to fetch pages as needed. - # result.each do |item| - # # Each element is of type ::Google::Longrunning::Operation. - # p item - # end - # - def list_operations request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::ListOperationsRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.list_operations.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.list_operations.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.list_operations.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.list_operations request, options do |result, operation| - result = ::Gapic::Rest::PagedEnumerable.new @operations_stub, :list_operations, "operations", request, result, options - yield result, operation if block_given? - throw :response, result - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Gets the latest state of a long-running operation. Clients can use this - # method to poll the operation result at intervals as recommended by the API - # service. - # - # @overload get_operation(request, options = nil) - # Pass arguments to `get_operation` via a request object, either of type - # {::Google::Longrunning::GetOperationRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::GetOperationRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload get_operation(name: nil) - # Pass arguments to `get_operation` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation resource. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Gapic::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::GetOperationRequest.new - # - # # Call the get_operation method. - # result = client.get_operation request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def get_operation request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::GetOperationRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.get_operation.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.get_operation.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.get_operation.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.get_operation request, options do |result, operation| - result = ::Gapic::Operation.new result, @operations_client, options: options - yield result, operation if block_given? - throw :response, result - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Deletes a long-running operation. This method indicates that the client is - # no longer interested in the operation result. It does not cancel the - # operation. If the server doesn't support this method, it returns - # `google.rpc.Code.UNIMPLEMENTED`. - # - # @overload delete_operation(request, options = nil) - # Pass arguments to `delete_operation` via a request object, either of type - # {::Google::Longrunning::DeleteOperationRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::DeleteOperationRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload delete_operation(name: nil) - # Pass arguments to `delete_operation` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation resource to be deleted. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Protobuf::Empty] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Protobuf::Empty] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::DeleteOperationRequest.new - # - # # Call the delete_operation method. - # result = client.delete_operation request - # - # # The returned object is of type Google::Protobuf::Empty. - # p result - # - def delete_operation request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::DeleteOperationRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.delete_operation.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.delete_operation.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.delete_operation.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.delete_operation request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Starts asynchronous cancellation on a long-running operation. The server - # makes a best effort to cancel the operation, but success is not - # guaranteed. If the server doesn't support this method, it returns - # `google.rpc.Code.UNIMPLEMENTED`. Clients can use - # Operations.GetOperation or - # other methods to check whether the cancellation succeeded or whether the - # operation completed despite cancellation. On successful cancellation, - # the operation is not deleted; instead, it becomes an operation with - # an {::Google::Longrunning::Operation#error Operation.error} value with a - # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to - # `Code.CANCELLED`. - # - # @overload cancel_operation(request, options = nil) - # Pass arguments to `cancel_operation` via a request object, either of type - # {::Google::Longrunning::CancelOperationRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::CancelOperationRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload cancel_operation(name: nil) - # Pass arguments to `cancel_operation` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation resource to be cancelled. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Protobuf::Empty] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Protobuf::Empty] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::CancelOperationRequest.new - # - # # Call the cancel_operation method. - # result = client.cancel_operation request - # - # # The returned object is of type Google::Protobuf::Empty. - # p result - # - def cancel_operation request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::CancelOperationRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.cancel_operation.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.cancel_operation.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.cancel_operation.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.cancel_operation request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Configuration class for the Operations REST API. - # - # This class represents the configuration for Operations REST, - # providing control over timeouts, retry behavior, logging, transport - # parameters, and other low-level controls. Certain parameters can also be - # applied individually to specific RPCs. See - # {::Google::Longrunning::Operations::Rest::Client::Configuration::Rpcs} - # for a list of RPCs that can be configured independently. - # - # Configuration can be applied globally to all clients, or to a single client - # on construction. - # - # @example - # - # # Modify the global config, setting the timeout for - # # list_operations to 20 seconds, - # # and all remaining timeouts to 10 seconds. - # ::Google::Longrunning::Operations::Rest::Client.configure do |config| - # config.timeout = 10.0 - # config.rpcs.list_operations.timeout = 20.0 - # end - # - # # Apply the above configuration only to a new client. - # client = ::Google::Longrunning::Operations::Rest::Client.new do |config| - # config.timeout = 10.0 - # config.rpcs.list_operations.timeout = 20.0 - # end - # - # @!attribute [rw] endpoint - # A custom service endpoint, as a hostname or hostname:port. The default is - # nil, indicating to use the default endpoint in the current universe domain. - # @return [::String,nil] - # @!attribute [rw] credentials - # Credentials to send with calls. You may provide any of the following types: - # * (`String`) The path to a service account key file in JSON format - # * (`Hash`) A service account key as a Hash - # * (`Google::Auth::Credentials`) A googleauth credentials object - # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) - # * (`Signet::OAuth2::Client`) A signet oauth2 client object - # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) - # * (`nil`) indicating no credentials - # - # Warning: If you accept a credential configuration (JSON file or Hash) from an - # external source for authentication to Google Cloud, you must validate it before - # providing it to a Google API client library. Providing an unvalidated credential - # configuration to Google APIs can compromise the security of your systems and data. - # For more information, refer to [Validate credential configurations from external - # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). - # @return [::Object] - # @!attribute [rw] scope - # The OAuth scopes - # @return [::Array<::String>] - # @!attribute [rw] lib_name - # The library name as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] lib_version - # The library version as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] timeout - # The call timeout in seconds. - # @return [::Numeric] - # @!attribute [rw] metadata - # Additional headers to be sent with the call. - # @return [::Hash{::Symbol=>::String}] - # @!attribute [rw] retry_policy - # The retry policy. The value is a hash with the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # @return [::Hash] - # @!attribute [rw] quota_project - # A separate project against which to charge quota. - # @return [::String] - # @!attribute [rw] universe_domain - # The universe domain within which to make requests. This determines the - # default endpoint URL. The default value of nil uses the environment - # universe (usually the default "googleapis.com" universe). - # @return [::String,nil] - # @!attribute [rw] logger - # A custom logger to use for request/response debug logging, or the value - # `:default` (the default) to construct a default logger, or `nil` to - # explicitly disable logging. - # @return [::Logger,:default,nil] - # - class Configuration - extend ::Gapic::Config - - # @private - # The endpoint specific to the default "googleapis.com" universe. Deprecated. - DEFAULT_ENDPOINT = "retail.googleapis.com" - - config_attr :endpoint, nil, ::String, nil - config_attr :credentials, nil do |value| - allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] - allowed.any? { |klass| klass === value } - end - config_attr :scope, nil, ::String, ::Array, nil - config_attr :lib_name, nil, ::String, nil - config_attr :lib_version, nil, ::String, nil - config_attr :timeout, nil, ::Numeric, nil - config_attr :metadata, nil, ::Hash, nil - config_attr :retry_policy, nil, ::Hash, ::Proc, nil - config_attr :quota_project, nil, ::String, nil - config_attr :universe_domain, nil, ::String, nil - config_attr :logger, :default, ::Logger, nil, :default - - # @private - def initialize parent_config = nil - @parent_config = parent_config unless parent_config.nil? - - yield self if block_given? - end - - ## - # Configurations for individual RPCs - # @return [Rpcs] - # - def rpcs - @rpcs ||= begin - parent_rpcs = nil - parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) - Rpcs.new parent_rpcs - end - end - - ## - # Configuration RPC class for the Operations API. - # - # Includes fields providing the configuration for each RPC in this service. - # Each configuration object is of type `Gapic::Config::Method` and includes - # the following configuration fields: - # - # * `timeout` (*type:* `Numeric`) - The call timeout in seconds - # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers - # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields - # include the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # - class Rpcs - ## - # RPC-specific configuration for `list_operations` - # @return [::Gapic::Config::Method] - # - attr_reader :list_operations - ## - # RPC-specific configuration for `get_operation` - # @return [::Gapic::Config::Method] - # - attr_reader :get_operation - ## - # RPC-specific configuration for `delete_operation` - # @return [::Gapic::Config::Method] - # - attr_reader :delete_operation - ## - # RPC-specific configuration for `cancel_operation` - # @return [::Gapic::Config::Method] - # - attr_reader :cancel_operation - - # @private - def initialize parent_rpcs = nil - list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations - @list_operations = ::Gapic::Config::Method.new list_operations_config - get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation - @get_operation = ::Gapic::Config::Method.new get_operation_config - delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation - @delete_operation = ::Gapic::Config::Method.new delete_operation_config - cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation - @cancel_operation = ::Gapic::Config::Method.new cancel_operation_config - - yield self if block_given? - end - end - end - end - - ## - # @private - # REST service stub for the Longrunning Operations API. - # Service stub contains baseline method implementations - # including transcoding, making the REST call, and deserialing the response. - class OperationsServiceStub - def initialize endpoint:, endpoint_template:, universe_domain:, credentials: - # These require statements are intentionally placed here to initialize - # the REST modules only when it's required. - require "gapic/rest" - - @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, - endpoint_template: endpoint_template, - universe_domain: universe_domain, - credentials: credentials - end - - ## - # Baseline implementation for the list_operations REST call - # - # @param request_pb [::Google::Longrunning::ListOperationsRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Longrunning::ListOperationsResponse] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Longrunning::ListOperationsResponse] - # A result object deserialized from the server's reply - def list_operations request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = OperationsServiceStub.transcode_list_operations_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "list_operations", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Longrunning::ListOperationsResponse.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the get_operation REST call - # - # @param request_pb [::Google::Longrunning::GetOperationRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Longrunning::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Longrunning::Operation] - # A result object deserialized from the server's reply - def get_operation request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = OperationsServiceStub.transcode_get_operation_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "get_operation", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the delete_operation REST call - # - # @param request_pb [::Google::Longrunning::DeleteOperationRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Protobuf::Empty] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Protobuf::Empty] - # A result object deserialized from the server's reply - def delete_operation request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = OperationsServiceStub.transcode_delete_operation_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "delete_operation", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the cancel_operation REST call - # - # @param request_pb [::Google::Longrunning::CancelOperationRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Protobuf::Empty] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Protobuf::Empty] - # A result object deserialized from the server's reply - def cancel_operation request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = OperationsServiceStub.transcode_cancel_operation_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "cancel_operation", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # @private - # - # GRPC transcoding helper method for the list_operations REST call - # - # @param request_pb [::Google::Longrunning::ListOperationsRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_list_operations_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :get, - uri_template: "/v2/{name}/operations", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/?$}, false] - ] - ) - .with_bindings( - uri_method: :get, - uri_template: "/v2/{name}/operations", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] - ] - ) - .with_bindings( - uri_method: :get, - uri_template: "/v2/{name}/operations", - matches: [ - ["name", %r{^projects/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the get_operation REST call - # - # @param request_pb [::Google::Longrunning::GetOperationRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_get_operation_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :get, - uri_template: "/v2/{name}", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/operations/[^/]+/?$}, false] - ] - ) - .with_bindings( - uri_method: :get, - uri_template: "/v2/{name}", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/branches/[^/]+/operations/[^/]+/?$}, false] - ] - ) - .with_bindings( - uri_method: :get, - uri_template: "/v2/{name}", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/operations/[^/]+/?$}, false] - ] - ) - .with_bindings( - uri_method: :get, - uri_template: "/v2/{name}", - matches: [ - ["name", %r{^projects/[^/]+/operations/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the delete_operation REST call - # - # @param request_pb [::Google::Longrunning::DeleteOperationRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_delete_operation_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :delete, - uri_template: "/v1/{name}", - matches: [ - ["name", %r{^operations(?:/(?<__wildcard__>.*))?$}, true] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the cancel_operation REST call - # - # @param request_pb [::Google::Longrunning::CancelOperationRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_cancel_operation_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :post, - uri_template: "/v1/{name}:cancel", - body: "*", - matches: [ - ["name", %r{^operations(?:/(?<__wildcard__>.*))?$}, true] - ] - ) - transcoder.transcode request_pb - end - end - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/rest/service_stub.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/rest/service_stub.rb deleted file mode 100644 index 164a945f0191..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service/rest/service_stub.rb +++ /dev/null @@ -1,822 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "google/cloud/retail/v2/product_service_pb" - -module Google - module Cloud - module Retail - module V2 - module ProductService - module Rest - ## - # REST service stub for the ProductService service. - # Service stub contains baseline method implementations - # including transcoding, making the REST call, and deserialing the response. - # - class ServiceStub - # @private - def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger: - # These require statements are intentionally placed here to initialize - # the REST modules only when it's required. - require "gapic/rest" - - @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, - endpoint_template: endpoint_template, - universe_domain: universe_domain, - credentials: credentials, - numeric_enums: true, - service_name: self.class, - raise_faraday_errors: false, - logger: logger - end - - ## - # The effective universe domain - # - # @return [String] - # - def universe_domain - @client_stub.universe_domain - end - - ## - # The effective endpoint - # - # @return [String] - # - def endpoint - @client_stub.endpoint - end - - ## - # The logger used for request/response debug logging. - # - # @return [Logger] - # - def logger stub: false - stub ? @client_stub.stub_logger : @client_stub.logger - end - - ## - # Baseline implementation for the create_product REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::CreateProductRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::Product] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::Product] - # A result object deserialized from the server's reply - def create_product request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_create_product_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "create_product", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Retail::V2::Product.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the get_product REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::GetProductRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::Product] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::Product] - # A result object deserialized from the server's reply - def get_product request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_get_product_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "get_product", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Retail::V2::Product.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the list_products REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::ListProductsRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::ListProductsResponse] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::ListProductsResponse] - # A result object deserialized from the server's reply - def list_products request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_list_products_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "list_products", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Retail::V2::ListProductsResponse.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the update_product REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::UpdateProductRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::Product] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::Product] - # A result object deserialized from the server's reply - def update_product request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_update_product_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "update_product", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Retail::V2::Product.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the delete_product REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::DeleteProductRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Protobuf::Empty] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Protobuf::Empty] - # A result object deserialized from the server's reply - def delete_product request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_delete_product_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "delete_product", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the purge_products REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::PurgeProductsRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Longrunning::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Longrunning::Operation] - # A result object deserialized from the server's reply - def purge_products request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_purge_products_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "purge_products", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the import_products REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::ImportProductsRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Longrunning::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Longrunning::Operation] - # A result object deserialized from the server's reply - def import_products request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_import_products_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "import_products", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the set_inventory REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::SetInventoryRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Longrunning::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Longrunning::Operation] - # A result object deserialized from the server's reply - def set_inventory request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_set_inventory_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "set_inventory", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the add_fulfillment_places REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Longrunning::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Longrunning::Operation] - # A result object deserialized from the server's reply - def add_fulfillment_places request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_add_fulfillment_places_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "add_fulfillment_places", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the remove_fulfillment_places REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Longrunning::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Longrunning::Operation] - # A result object deserialized from the server's reply - def remove_fulfillment_places request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_remove_fulfillment_places_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "remove_fulfillment_places", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the add_local_inventories REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::AddLocalInventoriesRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Longrunning::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Longrunning::Operation] - # A result object deserialized from the server's reply - def add_local_inventories request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_add_local_inventories_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "add_local_inventories", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the remove_local_inventories REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::RemoveLocalInventoriesRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Longrunning::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Longrunning::Operation] - # A result object deserialized from the server's reply - def remove_local_inventories request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_remove_local_inventories_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "remove_local_inventories", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # @private - # - # GRPC transcoding helper method for the create_product REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::CreateProductRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_create_product_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :post, - uri_template: "/v2/{parent}/products", - body: "product", - matches: [ - ["parent", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/branches/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the get_product REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::GetProductRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_get_product_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :get, - uri_template: "/v2/{name}", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/branches/[^/]+/products(?:/(?<__wildcard__>.*))?$}, true] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the list_products REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::ListProductsRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_list_products_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :get, - uri_template: "/v2/{parent}/products", - matches: [ - ["parent", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/branches/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the update_product REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::UpdateProductRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_update_product_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :patch, - uri_template: "/v2/{product.name}", - body: "product", - matches: [ - ["product.name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/branches/[^/]+/products(?:/(?<__wildcard__>.*))?$}, true] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the delete_product REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::DeleteProductRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_delete_product_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :delete, - uri_template: "/v2/{name}", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/branches/[^/]+/products(?:/(?<__wildcard__>.*))?$}, true] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the purge_products REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::PurgeProductsRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_purge_products_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :post, - uri_template: "/v2/{parent}/products:purge", - body: "*", - matches: [ - ["parent", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/branches/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the import_products REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::ImportProductsRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_import_products_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :post, - uri_template: "/v2/{parent}/products:import", - body: "*", - matches: [ - ["parent", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/branches/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the set_inventory REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::SetInventoryRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_set_inventory_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :post, - uri_template: "/v2/{inventory.name}:setInventory", - body: "*", - matches: [ - ["inventory.name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/branches/[^/]+/products(?:/(?<__wildcard__>.*))?$}, true] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the add_fulfillment_places REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_add_fulfillment_places_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :post, - uri_template: "/v2/{product}:addFulfillmentPlaces", - body: "*", - matches: [ - ["product", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/branches/[^/]+/products(?:/(?<__wildcard__>.*))?$}, true] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the remove_fulfillment_places REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_remove_fulfillment_places_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :post, - uri_template: "/v2/{product}:removeFulfillmentPlaces", - body: "*", - matches: [ - ["product", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/branches/[^/]+/products(?:/(?<__wildcard__>.*))?$}, true] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the add_local_inventories REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::AddLocalInventoriesRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_add_local_inventories_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :post, - uri_template: "/v2/{product}:addLocalInventories", - body: "*", - matches: [ - ["product", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/branches/[^/]+/products(?:/(?<__wildcard__>.*))?$}, true] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the remove_local_inventories REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::RemoveLocalInventoriesRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_remove_local_inventories_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :post, - uri_template: "/v2/{product}:removeLocalInventories", - body: "*", - matches: [ - ["product", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/branches/[^/]+/products(?:/(?<__wildcard__>.*))?$}, true] - ] - ) - transcoder.transcode request_pb - end - end - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service_pb.rb deleted file mode 100644 index aee2b57676bc..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service_pb.rb +++ /dev/null @@ -1,54 +0,0 @@ -# frozen_string_literal: true -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/retail/v2/product_service.proto - -require 'google/protobuf' - -require 'google/api/annotations_pb' -require 'google/api/client_pb' -require 'google/api/field_behavior_pb' -require 'google/api/resource_pb' -require 'google/cloud/retail/v2/common_pb' -require 'google/cloud/retail/v2/import_config_pb' -require 'google/cloud/retail/v2/product_pb' -require 'google/cloud/retail/v2/purge_config_pb' -require 'google/longrunning/operations_pb' -require 'google/protobuf/empty_pb' -require 'google/protobuf/field_mask_pb' -require 'google/protobuf/timestamp_pb' - - -descriptor_data = "\n,google/cloud/retail/v2/product_service.proto\x12\x16google.cloud.retail.v2\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a#google/cloud/retail/v2/common.proto\x1a*google/cloud/retail/v2/import_config.proto\x1a$google/cloud/retail/v2/product.proto\x1a)google/cloud/retail/v2/purge_config.proto\x1a#google/longrunning/operations.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\x9c\x01\n\x14\x43reateProductRequest\x12\x34\n\x06parent\x18\x01 \x01(\tB$\xe0\x41\x02\xfa\x41\x1e\n\x1cretail.googleapis.com/Branch\x12\x35\n\x07product\x18\x02 \x01(\x0b\x32\x1f.google.cloud.retail.v2.ProductB\x03\xe0\x41\x02\x12\x17\n\nproduct_id\x18\x03 \x01(\tB\x03\xe0\x41\x02\"H\n\x11GetProductRequest\x12\x33\n\x04name\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\n\x1dretail.googleapis.com/Product\"\x95\x01\n\x14UpdateProductRequest\x12\x35\n\x07product\x18\x01 \x01(\x0b\x32\x1f.google.cloud.retail.v2.ProductB\x03\xe0\x41\x02\x12/\n\x0bupdate_mask\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMask\x12\x15\n\rallow_missing\x18\x03 \x01(\x08\"K\n\x14\x44\x65leteProductRequest\x12\x33\n\x04name\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\n\x1dretail.googleapis.com/Product\"\xb1\x01\n\x13ListProductsRequest\x12\x34\n\x06parent\x18\x01 \x01(\tB$\xe0\x41\x02\xfa\x41\x1e\n\x1cretail.googleapis.com/Branch\x12\x11\n\tpage_size\x18\x02 \x01(\x05\x12\x12\n\npage_token\x18\x03 \x01(\t\x12\x0e\n\x06\x66ilter\x18\x04 \x01(\t\x12-\n\tread_mask\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.FieldMask\"b\n\x14ListProductsResponse\x12\x31\n\x08products\x18\x01 \x03(\x0b\x32\x1f.google.cloud.retail.v2.Product\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t\"\xc1\x01\n\x13SetInventoryRequest\x12\x37\n\tinventory\x18\x01 \x01(\x0b\x32\x1f.google.cloud.retail.v2.ProductB\x03\xe0\x41\x02\x12,\n\x08set_mask\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMask\x12,\n\x08set_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x15\n\rallow_missing\x18\x04 \x01(\x08\"\x16\n\x14SetInventoryMetadata\"\x16\n\x14SetInventoryResponse\"\xc5\x01\n\x1b\x41\x64\x64\x46ulfillmentPlacesRequest\x12\x36\n\x07product\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\n\x1dretail.googleapis.com/Product\x12\x11\n\x04type\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\x16\n\tplace_ids\x18\x03 \x03(\tB\x03\xe0\x41\x02\x12,\n\x08\x61\x64\x64_time\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x15\n\rallow_missing\x18\x05 \x01(\x08\"\x1e\n\x1c\x41\x64\x64\x46ulfillmentPlacesMetadata\"\x1e\n\x1c\x41\x64\x64\x46ulfillmentPlacesResponse\"\x8f\x02\n\x1a\x41\x64\x64LocalInventoriesRequest\x12\x36\n\x07product\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\n\x1dretail.googleapis.com/Product\x12\x46\n\x11local_inventories\x18\x02 \x03(\x0b\x32&.google.cloud.retail.v2.LocalInventoryB\x03\xe0\x41\x02\x12,\n\x08\x61\x64\x64_mask\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.FieldMask\x12,\n\x08\x61\x64\x64_time\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x15\n\rallow_missing\x18\x06 \x01(\x08\"\x1d\n\x1b\x41\x64\x64LocalInventoriesMetadata\"\x1d\n\x1b\x41\x64\x64LocalInventoriesResponse\"\xb7\x01\n\x1dRemoveLocalInventoriesRequest\x12\x36\n\x07product\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\n\x1dretail.googleapis.com/Product\x12\x16\n\tplace_ids\x18\x02 \x03(\tB\x03\xe0\x41\x02\x12/\n\x0bremove_time\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x15\n\rallow_missing\x18\x03 \x01(\x08\" \n\x1eRemoveLocalInventoriesMetadata\" \n\x1eRemoveLocalInventoriesResponse\"\xcb\x01\n\x1eRemoveFulfillmentPlacesRequest\x12\x36\n\x07product\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\n\x1dretail.googleapis.com/Product\x12\x11\n\x04type\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\x16\n\tplace_ids\x18\x03 \x03(\tB\x03\xe0\x41\x02\x12/\n\x0bremove_time\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x15\n\rallow_missing\x18\x05 \x01(\x08\"!\n\x1fRemoveFulfillmentPlacesMetadata\"!\n\x1fRemoveFulfillmentPlacesResponse2\xc2\x19\n\x0eProductService\x12\xcf\x01\n\rCreateProduct\x12,.google.cloud.retail.v2.CreateProductRequest\x1a\x1f.google.cloud.retail.v2.Product\"o\xda\x41\x19parent,product,product_id\x82\xd3\xe4\x93\x02M\"B/v2/{parent=projects/*/locations/*/catalogs/*/branches/*}/products:\x07product\x12\xac\x01\n\nGetProduct\x12).google.cloud.retail.v2.GetProductRequest\x1a\x1f.google.cloud.retail.v2.Product\"R\xda\x41\x04name\x82\xd3\xe4\x93\x02\x45\x12\x43/v2/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}\x12\xbe\x01\n\x0cListProducts\x12+.google.cloud.retail.v2.ListProductsRequest\x1a,.google.cloud.retail.v2.ListProductsResponse\"S\xda\x41\x06parent\x82\xd3\xe4\x93\x02\x44\x12\x42/v2/{parent=projects/*/locations/*/catalogs/*/branches/*}/products\x12\xd2\x01\n\rUpdateProduct\x12,.google.cloud.retail.v2.UpdateProductRequest\x1a\x1f.google.cloud.retail.v2.Product\"r\xda\x41\x13product,update_mask\x82\xd3\xe4\x93\x02V2K/v2/{product.name=projects/*/locations/*/catalogs/*/branches/*/products/**}:\x07product\x12\xa9\x01\n\rDeleteProduct\x12,.google.cloud.retail.v2.DeleteProductRequest\x1a\x16.google.protobuf.Empty\"R\xda\x41\x04name\x82\xd3\xe4\x93\x02\x45*C/v2/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}\x12\x91\x02\n\rPurgeProducts\x12,.google.cloud.retail.v2.PurgeProductsRequest\x1a\x1d.google.longrunning.Operation\"\xb2\x01\xca\x41\\\n,google.cloud.retail.v2.PurgeProductsResponse\x12,google.cloud.retail.v2.PurgeProductsMetadata\x82\xd3\xe4\x93\x02M\"H/v2/{parent=projects/*/locations/*/catalogs/*/branches/*}/products:purge:\x01*\x12\x8e\x02\n\x0eImportProducts\x12-.google.cloud.retail.v2.ImportProductsRequest\x1a\x1d.google.longrunning.Operation\"\xad\x01\xca\x41V\n-google.cloud.retail.v2.ImportProductsResponse\x12%google.cloud.retail.v2.ImportMetadata\x82\xd3\xe4\x93\x02N\"I/v2/{parent=projects/*/locations/*/catalogs/*/branches/*}/products:import:\x01*\x12\xb4\x02\n\x0cSetInventory\x12+.google.cloud.retail.v2.SetInventoryRequest\x1a\x1d.google.longrunning.Operation\"\xd7\x01\xca\x41Z\n+google.cloud.retail.v2.SetInventoryResponse\x12+google.cloud.retail.v2.SetInventoryMetadata\xda\x41\x12inventory,set_mask\x82\xd3\xe4\x93\x02_\"Z/v2/{inventory.name=projects/*/locations/*/catalogs/*/branches/*/products/**}:setInventory:\x01*\x12\xca\x02\n\x14\x41\x64\x64\x46ulfillmentPlaces\x12\x33.google.cloud.retail.v2.AddFulfillmentPlacesRequest\x1a\x1d.google.longrunning.Operation\"\xdd\x01\xca\x41j\n3google.cloud.retail.v2.AddFulfillmentPlacesResponse\x12\x33google.cloud.retail.v2.AddFulfillmentPlacesMetadata\xda\x41\x07product\x82\xd3\xe4\x93\x02`\"[/v2/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:addFulfillmentPlaces:\x01*\x12\xd9\x02\n\x17RemoveFulfillmentPlaces\x12\x36.google.cloud.retail.v2.RemoveFulfillmentPlacesRequest\x1a\x1d.google.longrunning.Operation\"\xe6\x01\xca\x41p\n6google.cloud.retail.v2.RemoveFulfillmentPlacesResponse\x12\x36google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata\xda\x41\x07product\x82\xd3\xe4\x93\x02\x63\"^/v2/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:removeFulfillmentPlaces:\x01*\x12\xc5\x02\n\x13\x41\x64\x64LocalInventories\x12\x32.google.cloud.retail.v2.AddLocalInventoriesRequest\x1a\x1d.google.longrunning.Operation\"\xda\x01\xca\x41h\n2google.cloud.retail.v2.AddLocalInventoriesResponse\x12\x32google.cloud.retail.v2.AddLocalInventoriesMetadata\xda\x41\x07product\x82\xd3\xe4\x93\x02_\"Z/v2/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:addLocalInventories:\x01*\x12\xd4\x02\n\x16RemoveLocalInventories\x12\x35.google.cloud.retail.v2.RemoveLocalInventoriesRequest\x1a\x1d.google.longrunning.Operation\"\xe3\x01\xca\x41n\n5google.cloud.retail.v2.RemoveLocalInventoriesResponse\x12\x35google.cloud.retail.v2.RemoveLocalInventoriesMetadata\xda\x41\x07product\x82\xd3\xe4\x93\x02\x62\"]/v2/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:removeLocalInventories:\x01*\x1aI\xca\x41\x15retail.googleapis.com\xd2\x41.https://www.googleapis.com/auth/cloud-platformB\xbe\x01\n\x1a\x63om.google.cloud.retail.v2B\x13ProductServiceProtoP\x01Z2cloud.google.com/go/retail/apiv2/retailpb;retailpb\xa2\x02\x06RETAIL\xaa\x02\x16Google.Cloud.Retail.V2\xca\x02\x16Google\\Cloud\\Retail\\V2\xea\x02\x19Google::Cloud::Retail::V2b\x06proto3" - -pool = ::Google::Protobuf::DescriptorPool.generated_pool -pool.add_serialized_file(descriptor_data) - -module Google - module Cloud - module Retail - module V2 - CreateProductRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CreateProductRequest").msgclass - GetProductRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.GetProductRequest").msgclass - UpdateProductRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.UpdateProductRequest").msgclass - DeleteProductRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.DeleteProductRequest").msgclass - ListProductsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ListProductsRequest").msgclass - ListProductsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ListProductsResponse").msgclass - SetInventoryRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SetInventoryRequest").msgclass - SetInventoryMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SetInventoryMetadata").msgclass - SetInventoryResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SetInventoryResponse").msgclass - AddFulfillmentPlacesRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.AddFulfillmentPlacesRequest").msgclass - AddFulfillmentPlacesMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.AddFulfillmentPlacesMetadata").msgclass - AddFulfillmentPlacesResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.AddFulfillmentPlacesResponse").msgclass - AddLocalInventoriesRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.AddLocalInventoriesRequest").msgclass - AddLocalInventoriesMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.AddLocalInventoriesMetadata").msgclass - AddLocalInventoriesResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.AddLocalInventoriesResponse").msgclass - RemoveLocalInventoriesRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.RemoveLocalInventoriesRequest").msgclass - RemoveLocalInventoriesMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.RemoveLocalInventoriesMetadata").msgclass - RemoveLocalInventoriesResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.RemoveLocalInventoriesResponse").msgclass - RemoveFulfillmentPlacesRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.RemoveFulfillmentPlacesRequest").msgclass - RemoveFulfillmentPlacesMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata").msgclass - RemoveFulfillmentPlacesResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.RemoveFulfillmentPlacesResponse").msgclass - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service_services_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service_services_pb.rb deleted file mode 100644 index 5ae098e9d214..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/product_service_services_pb.rb +++ /dev/null @@ -1,248 +0,0 @@ -# Generated by the protocol buffer compiler. DO NOT EDIT! -# Source: google/cloud/retail/v2/product_service.proto for package 'Google.Cloud.Retail.V2' -# Original file comments: -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -require 'grpc' -require 'google/cloud/retail/v2/product_service_pb' - -module Google - module Cloud - module Retail - module V2 - module ProductService - # Service for ingesting [Product][google.cloud.retail.v2.Product] information - # of the customer's website. - class Service - - include ::GRPC::GenericService - - self.marshal_class_method = :encode - self.unmarshal_class_method = :decode - self.service_name = 'google.cloud.retail.v2.ProductService' - - # Creates a [Product][google.cloud.retail.v2.Product]. - rpc :CreateProduct, ::Google::Cloud::Retail::V2::CreateProductRequest, ::Google::Cloud::Retail::V2::Product - # Gets a [Product][google.cloud.retail.v2.Product]. - rpc :GetProduct, ::Google::Cloud::Retail::V2::GetProductRequest, ::Google::Cloud::Retail::V2::Product - # Gets a list of [Product][google.cloud.retail.v2.Product]s. - rpc :ListProducts, ::Google::Cloud::Retail::V2::ListProductsRequest, ::Google::Cloud::Retail::V2::ListProductsResponse - # Updates a [Product][google.cloud.retail.v2.Product]. - rpc :UpdateProduct, ::Google::Cloud::Retail::V2::UpdateProductRequest, ::Google::Cloud::Retail::V2::Product - # Deletes a [Product][google.cloud.retail.v2.Product]. - rpc :DeleteProduct, ::Google::Cloud::Retail::V2::DeleteProductRequest, ::Google::Protobuf::Empty - # Permanently deletes all selected [Product][google.cloud.retail.v2.Product]s - # under a branch. - # - # This process is asynchronous. If the request is valid, the removal will be - # enqueued and processed offline. Depending on the number of - # [Product][google.cloud.retail.v2.Product]s, this operation could take hours - # to complete. Before the operation completes, some - # [Product][google.cloud.retail.v2.Product]s may still be returned by - # [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] - # or - # [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. - # - # Depending on the number of [Product][google.cloud.retail.v2.Product]s, this - # operation could take hours to complete. To get a sample of - # [Product][google.cloud.retail.v2.Product]s that would be deleted, set - # [PurgeProductsRequest.force][google.cloud.retail.v2.PurgeProductsRequest.force] - # to false. - rpc :PurgeProducts, ::Google::Cloud::Retail::V2::PurgeProductsRequest, ::Google::Longrunning::Operation - # Bulk import of multiple [Product][google.cloud.retail.v2.Product]s. - # - # Request processing may be synchronous. - # Non-existing items are created. - # - # Note that it is possible for a subset of the - # [Product][google.cloud.retail.v2.Product]s to be successfully updated. - rpc :ImportProducts, ::Google::Cloud::Retail::V2::ImportProductsRequest, ::Google::Longrunning::Operation - # Updates inventory information for a - # [Product][google.cloud.retail.v2.Product] while respecting the last update - # timestamps of each inventory field. - # - # This process is asynchronous and does not require the - # [Product][google.cloud.retail.v2.Product] to exist before updating - # fulfillment information. If the request is valid, the update is enqueued - # and processed downstream. As a consequence, when a response is returned, - # updates are not immediately manifested in the - # [Product][google.cloud.retail.v2.Product] queried by - # [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] - # or - # [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. - # - # When inventory is updated with - # [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] - # and - # [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct], - # the specified inventory field value(s) overwrite any existing value(s) - # while ignoring the last update time for this field. Furthermore, the last - # update times for the specified inventory fields are overwritten by the - # times of the - # [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] - # or - # [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] - # request. - # - # If no inventory fields are set in - # [CreateProductRequest.product][google.cloud.retail.v2.CreateProductRequest.product], - # then any pre-existing inventory information for this product is used. - # - # If no inventory fields are set in - # [SetInventoryRequest.set_mask][google.cloud.retail.v2.SetInventoryRequest.set_mask], - # then any existing inventory information is preserved. - # - # Pre-existing inventory information can only be updated with - # [ProductService.SetInventory][google.cloud.retail.v2.ProductService.SetInventory], - # [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces], - # and - # [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]. - # - # The returned [Operation][google.longrunning.Operation]s is obsolete after - # one day, and the [GetOperation][google.longrunning.Operations.GetOperation] - # API returns `NOT_FOUND` afterwards. - # - # If conflicting updates are issued, the - # [Operation][google.longrunning.Operation]s associated with the stale - # updates are not marked as [done][google.longrunning.Operation.done] until - # they are obsolete. - rpc :SetInventory, ::Google::Cloud::Retail::V2::SetInventoryRequest, ::Google::Longrunning::Operation - # We recommend that you use the - # [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories] - # method instead of the - # [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces] - # method. - # [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories] - # achieves the same results but provides more fine-grained control over - # ingesting local inventory data. - # - # Incrementally adds place IDs to - # [Product.fulfillment_info.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]. - # - # This process is asynchronous and does not require the - # [Product][google.cloud.retail.v2.Product] to exist before updating - # fulfillment information. If the request is valid, the update will be - # enqueued and processed downstream. As a consequence, when a response is - # returned, the added place IDs are not immediately manifested in the - # [Product][google.cloud.retail.v2.Product] queried by - # [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] - # or - # [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. - # - # The returned [Operation][google.longrunning.Operation]s will be obsolete - # after 1 day, and [GetOperation][google.longrunning.Operations.GetOperation] - # API will return NOT_FOUND afterwards. - # - # If conflicting updates are issued, the - # [Operation][google.longrunning.Operation]s associated with the stale - # updates will not be marked as [done][google.longrunning.Operation.done] - # until being obsolete. - rpc :AddFulfillmentPlaces, ::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest, ::Google::Longrunning::Operation - # We recommend that you use the - # [ProductService.RemoveLocalInventories][google.cloud.retail.v2.ProductService.RemoveLocalInventories] - # method instead of the - # [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces] - # method. - # [ProductService.RemoveLocalInventories][google.cloud.retail.v2.ProductService.RemoveLocalInventories] - # achieves the same results but provides more fine-grained control over - # ingesting local inventory data. - # - # Incrementally removes place IDs from a - # [Product.fulfillment_info.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]. - # - # This process is asynchronous and does not require the - # [Product][google.cloud.retail.v2.Product] to exist before updating - # fulfillment information. If the request is valid, the update will be - # enqueued and processed downstream. As a consequence, when a response is - # returned, the removed place IDs are not immediately manifested in the - # [Product][google.cloud.retail.v2.Product] queried by - # [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] - # or - # [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. - # - # The returned [Operation][google.longrunning.Operation]s will be obsolete - # after 1 day, and [GetOperation][google.longrunning.Operations.GetOperation] - # API will return NOT_FOUND afterwards. - # - # If conflicting updates are issued, the - # [Operation][google.longrunning.Operation]s associated with the stale - # updates will not be marked as [done][google.longrunning.Operation.done] - # until being obsolete. - rpc :RemoveFulfillmentPlaces, ::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest, ::Google::Longrunning::Operation - # Updates local inventory information for a - # [Product][google.cloud.retail.v2.Product] at a list of places, while - # respecting the last update timestamps of each inventory field. - # - # This process is asynchronous and does not require the - # [Product][google.cloud.retail.v2.Product] to exist before updating - # inventory information. If the request is valid, the update will be enqueued - # and processed downstream. As a consequence, when a response is returned, - # updates are not immediately manifested in the - # [Product][google.cloud.retail.v2.Product] queried by - # [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] - # or - # [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. - # - # Local inventory information can only be modified using this method. - # [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] - # and - # [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] - # has no effect on local inventories. - # - # The returned [Operation][google.longrunning.Operation]s will be obsolete - # after 1 day, and [GetOperation][google.longrunning.Operations.GetOperation] - # API will return NOT_FOUND afterwards. - # - # If conflicting updates are issued, the - # [Operation][google.longrunning.Operation]s associated with the stale - # updates will not be marked as [done][google.longrunning.Operation.done] - # until being obsolete. - rpc :AddLocalInventories, ::Google::Cloud::Retail::V2::AddLocalInventoriesRequest, ::Google::Longrunning::Operation - # Remove local inventory information for a - # [Product][google.cloud.retail.v2.Product] at a list of places at a removal - # timestamp. - # - # This process is asynchronous. If the request is valid, the removal will be - # enqueued and processed downstream. As a consequence, when a response is - # returned, removals are not immediately manifested in the - # [Product][google.cloud.retail.v2.Product] queried by - # [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct] - # or - # [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]. - # - # Local inventory information can only be removed using this method. - # [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct] - # and - # [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct] - # has no effect on local inventories. - # - # The returned [Operation][google.longrunning.Operation]s will be obsolete - # after 1 day, and [GetOperation][google.longrunning.Operations.GetOperation] - # API will return NOT_FOUND afterwards. - # - # If conflicting updates are issued, the - # [Operation][google.longrunning.Operation]s associated with the stale - # updates will not be marked as [done][google.longrunning.Operation.done] - # until being obsolete. - rpc :RemoveLocalInventories, ::Google::Cloud::Retail::V2::RemoveLocalInventoriesRequest, ::Google::Longrunning::Operation - end - - Stub = Service.rpc_stub_class - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/promotion_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/promotion_pb.rb deleted file mode 100644 index ae0f81f377b7..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/promotion_pb.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/retail/v2/promotion.proto - -require 'google/protobuf' - - -descriptor_data = "\n&google/cloud/retail/v2/promotion.proto\x12\x16google.cloud.retail.v2\"!\n\tPromotion\x12\x14\n\x0cpromotion_id\x18\x01 \x01(\tB\xb9\x01\n\x1a\x63om.google.cloud.retail.v2B\x0ePromotionProtoP\x01Z2cloud.google.com/go/retail/apiv2/retailpb;retailpb\xa2\x02\x06RETAIL\xaa\x02\x16Google.Cloud.Retail.V2\xca\x02\x16Google\\Cloud\\Retail\\V2\xea\x02\x19Google::Cloud::Retail::V2b\x06proto3" - -pool = ::Google::Protobuf::DescriptorPool.generated_pool -pool.add_serialized_file(descriptor_data) - -module Google - module Cloud - module Retail - module V2 - Promotion = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Promotion").msgclass - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/purge_config_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/purge_config_pb.rb deleted file mode 100644 index 786696cf2180..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/purge_config_pb.rb +++ /dev/null @@ -1,30 +0,0 @@ -# frozen_string_literal: true -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/retail/v2/purge_config.proto - -require 'google/protobuf' - -require 'google/api/field_behavior_pb' -require 'google/api/resource_pb' -require 'google/protobuf/timestamp_pb' - - -descriptor_data = "\n)google/cloud/retail/v2/purge_config.proto\x12\x16google.cloud.retail.v2\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\x0f\n\rPurgeMetadata\"\xa7\x01\n\x15PurgeProductsMetadata\x12/\n\x0b\x63reate_time\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12/\n\x0bupdate_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x15\n\rsuccess_count\x18\x03 \x01(\x03\x12\x15\n\rfailure_count\x18\x04 \x01(\x03\"p\n\x14PurgeProductsRequest\x12\x34\n\x06parent\x18\x01 \x01(\tB$\xe0\x41\x02\xfa\x41\x1e\n\x1cretail.googleapis.com/Branch\x12\x13\n\x06\x66ilter\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\r\n\x05\x66orce\x18\x03 \x01(\x08\"f\n\x15PurgeProductsResponse\x12\x13\n\x0bpurge_count\x18\x01 \x01(\x03\x12\x38\n\x0cpurge_sample\x18\x02 \x03(\tB\"\xfa\x41\x1f\n\x1dretail.googleapis.com/Product\"s\n\x16PurgeUserEventsRequest\x12\x35\n\x06parent\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\n\x1dretail.googleapis.com/Catalog\x12\x13\n\x06\x66ilter\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\r\n\x05\x66orce\x18\x03 \x01(\x08\"6\n\x17PurgeUserEventsResponse\x12\x1b\n\x13purged_events_count\x18\x01 \x01(\x03\x42\xbb\x01\n\x1a\x63om.google.cloud.retail.v2B\x10PurgeConfigProtoP\x01Z2cloud.google.com/go/retail/apiv2/retailpb;retailpb\xa2\x02\x06RETAIL\xaa\x02\x16Google.Cloud.Retail.V2\xca\x02\x16Google\\Cloud\\Retail\\V2\xea\x02\x19Google::Cloud::Retail::V2b\x06proto3" - -pool = ::Google::Protobuf::DescriptorPool.generated_pool -pool.add_serialized_file(descriptor_data) - -module Google - module Cloud - module Retail - module V2 - PurgeMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.PurgeMetadata").msgclass - PurgeProductsMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.PurgeProductsMetadata").msgclass - PurgeProductsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.PurgeProductsRequest").msgclass - PurgeProductsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.PurgeProductsResponse").msgclass - PurgeUserEventsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.PurgeUserEventsRequest").msgclass - PurgeUserEventsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.PurgeUserEventsResponse").msgclass - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/rest.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/rest.rb deleted file mode 100644 index 47b06c36e7ba..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/rest.rb +++ /dev/null @@ -1,48 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "google/cloud/retail/v2/analytics_service/rest" -require "google/cloud/retail/v2/catalog_service/rest" -require "google/cloud/retail/v2/completion_service/rest" -require "google/cloud/retail/v2/control_service/rest" -require "google/cloud/retail/v2/search_service/rest" -require "google/cloud/retail/v2/conversational_search_service/rest" -require "google/cloud/retail/v2/generative_question_service/rest" -require "google/cloud/retail/v2/model_service/rest" -require "google/cloud/retail/v2/prediction_service/rest" -require "google/cloud/retail/v2/product_service/rest" -require "google/cloud/retail/v2/serving_config_service/rest" -require "google/cloud/retail/v2/user_event_service/rest" -require "google/cloud/retail/v2/version" - -module Google - module Cloud - module Retail - ## - # To load just the REST part of this package, including all its services, and instantiate a REST client: - # - # @example - # - # require "google/cloud/retail/v2/rest" - # client = ::Google::Cloud::Retail::V2::AnalyticsService::Rest::Client.new - # - module V2 - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/safety_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/safety_pb.rb deleted file mode 100644 index 9cf4cbf18eaa..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/safety_pb.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/retail/v2/safety.proto - -require 'google/protobuf' - -require 'google/api/field_behavior_pb' - - -descriptor_data = "\n#google/cloud/retail/v2/safety.proto\x12\x16google.cloud.retail.v2\x1a\x1fgoogle/api/field_behavior.proto\"\xd5\x03\n\rSafetySetting\x12\x36\n\x08\x63\x61tegory\x18\x01 \x01(\x0e\x32$.google.cloud.retail.v2.HarmCategory\x12K\n\tthreshold\x18\x02 \x01(\x0e\x32\x38.google.cloud.retail.v2.SafetySetting.HarmBlockThreshold\x12J\n\x06method\x18\x03 \x01(\x0e\x32\x35.google.cloud.retail.v2.SafetySetting.HarmBlockMethodB\x03\xe0\x41\x01\"\x9d\x01\n\x12HarmBlockThreshold\x12$\n HARM_BLOCK_THRESHOLD_UNSPECIFIED\x10\x00\x12\x17\n\x13\x42LOCK_LOW_AND_ABOVE\x10\x01\x12\x1a\n\x16\x42LOCK_MEDIUM_AND_ABOVE\x10\x02\x12\x13\n\x0f\x42LOCK_ONLY_HIGH\x10\x03\x12\x0e\n\nBLOCK_NONE\x10\x04\x12\x07\n\x03OFF\x10\x05\"S\n\x0fHarmBlockMethod\x12!\n\x1dHARM_BLOCK_METHOD_UNSPECIFIED\x10\x00\x12\x0c\n\x08SEVERITY\x10\x01\x12\x0f\n\x0bPROBABILITY\x10\x02*\xd7\x01\n\x0cHarmCategory\x12\x1d\n\x19HARM_CATEGORY_UNSPECIFIED\x10\x00\x12\x1d\n\x19HARM_CATEGORY_HATE_SPEECH\x10\x01\x12#\n\x1fHARM_CATEGORY_DANGEROUS_CONTENT\x10\x02\x12\x1c\n\x18HARM_CATEGORY_HARASSMENT\x10\x03\x12#\n\x1fHARM_CATEGORY_SEXUALLY_EXPLICIT\x10\x04\x12!\n\x1dHARM_CATEGORY_CIVIC_INTEGRITY\x10\x05\x42\xb6\x01\n\x1a\x63om.google.cloud.retail.v2B\x0bSafetyProtoP\x01Z2cloud.google.com/go/retail/apiv2/retailpb;retailpb\xa2\x02\x06RETAIL\xaa\x02\x16Google.Cloud.Retail.V2\xca\x02\x16Google\\Cloud\\Retail\\V2\xea\x02\x19Google::Cloud::Retail::V2b\x06proto3" - -pool = ::Google::Protobuf::DescriptorPool.generated_pool -pool.add_serialized_file(descriptor_data) - -module Google - module Cloud - module Retail - module V2 - SafetySetting = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SafetySetting").msgclass - SafetySetting::HarmBlockThreshold = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SafetySetting.HarmBlockThreshold").enummodule - SafetySetting::HarmBlockMethod = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SafetySetting.HarmBlockMethod").enummodule - HarmCategory = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.HarmCategory").enummodule - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service.rb deleted file mode 100644 index dae214f30163..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service.rb +++ /dev/null @@ -1,58 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "gapic/common" -require "gapic/config" -require "gapic/config/method" - -require "google/cloud/retail/v2/version" - -require "google/cloud/retail/v2/search_service/credentials" -require "google/cloud/retail/v2/search_service/paths" -require "google/cloud/retail/v2/search_service/client" -require "google/cloud/retail/v2/search_service/rest" - -module Google - module Cloud - module Retail - module V2 - ## - # Service for search. - # - # This feature is only available for users who have Retail Search enabled. - # Enable Retail Search on Cloud Console before using this feature. - # - # @example Load this service and instantiate a gRPC client - # - # require "google/cloud/retail/v2/search_service" - # client = ::Google::Cloud::Retail::V2::SearchService::Client.new - # - # @example Load this service and instantiate a REST client - # - # require "google/cloud/retail/v2/search_service/rest" - # client = ::Google::Cloud::Retail::V2::SearchService::Rest::Client.new - # - module SearchService - end - end - end - end -end - -helper_path = ::File.join __dir__, "search_service", "helpers.rb" -require "google/cloud/retail/v2/search_service/helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/client.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/client.rb deleted file mode 100644 index 7dcd0044183f..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/client.rb +++ /dev/null @@ -1,789 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "google/cloud/errors" -require "google/cloud/retail/v2/search_service_pb" -require "google/cloud/location" - -module Google - module Cloud - module Retail - module V2 - module SearchService - ## - # Client for the SearchService service. - # - # Service for search. - # - # This feature is only available for users who have Retail Search enabled. - # Enable Retail Search on Cloud Console before using this feature. - # - class Client - # @private - API_VERSION = "" - - # @private - DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" - - include Paths - - # @private - attr_reader :search_service_stub - - ## - # Configure the SearchService Client class. - # - # See {::Google::Cloud::Retail::V2::SearchService::Client::Configuration} - # for a description of the configuration fields. - # - # @example - # - # # Modify the configuration for all SearchService clients - # ::Google::Cloud::Retail::V2::SearchService::Client.configure do |config| - # config.timeout = 10.0 - # end - # - # @yield [config] Configure the Client client. - # @yieldparam config [Client::Configuration] - # - # @return [Client::Configuration] - # - def self.configure - @configure ||= begin - namespace = ["Google", "Cloud", "Retail", "V2"] - parent_config = while namespace.any? - parent_name = namespace.join "::" - parent_const = const_get parent_name - break parent_const.configure if parent_const.respond_to? :configure - namespace.pop - end - default_config = Client::Configuration.new parent_config - - default_config.timeout = 5.0 - default_config.retry_policy = { - initial_delay: 0.1, max_delay: 5.0, multiplier: 1.3, retry_codes: [14, 4] - } - - default_config - end - yield @configure if block_given? - @configure - end - - ## - # Configure the SearchService Client instance. - # - # The configuration is set to the derived mode, meaning that values can be changed, - # but structural changes (adding new fields, etc.) are not allowed. Structural changes - # should be made on {Client.configure}. - # - # See {::Google::Cloud::Retail::V2::SearchService::Client::Configuration} - # for a description of the configuration fields. - # - # @yield [config] Configure the Client client. - # @yieldparam config [Client::Configuration] - # - # @return [Client::Configuration] - # - def configure - yield @config if block_given? - @config - end - - ## - # The effective universe domain - # - # @return [String] - # - def universe_domain - @search_service_stub.universe_domain - end - - ## - # Create a new SearchService client object. - # - # @example - # - # # Create a client using the default configuration - # client = ::Google::Cloud::Retail::V2::SearchService::Client.new - # - # # Create a client using a custom configuration - # client = ::Google::Cloud::Retail::V2::SearchService::Client.new do |config| - # config.timeout = 10.0 - # end - # - # @yield [config] Configure the SearchService client. - # @yieldparam config [Client::Configuration] - # - def initialize - # These require statements are intentionally placed here to initialize - # the gRPC module only when it's required. - # See https://github.com/googleapis/toolkit/issues/446 - require "gapic/grpc" - require "google/cloud/retail/v2/search_service_services_pb" - - # Create the configuration object - @config = Configuration.new Client.configure - - # Yield the configuration if needed - yield @config if block_given? - - # Create credentials - credentials = @config.credentials - # Use self-signed JWT if the endpoint is unchanged from default, - # but only if the default endpoint does not have a region prefix. - enable_self_signed_jwt = @config.endpoint.nil? || - (@config.endpoint == Configuration::DEFAULT_ENDPOINT && - !@config.endpoint.split(".").first.include?("-")) - credentials ||= Credentials.default scope: @config.scope, - enable_self_signed_jwt: enable_self_signed_jwt - if credentials.is_a?(::String) || credentials.is_a?(::Hash) - credentials = Credentials.new credentials, scope: @config.scope - end - @quota_project_id = @config.quota_project - @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id - - @search_service_stub = ::Gapic::ServiceStub.new( - ::Google::Cloud::Retail::V2::SearchService::Stub, - credentials: credentials, - endpoint: @config.endpoint, - endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, - universe_domain: @config.universe_domain, - channel_args: @config.channel_args, - interceptors: @config.interceptors, - channel_pool_config: @config.channel_pool, - logger: @config.logger - ) - - @search_service_stub.stub_logger&.info do |entry| - entry.set_system_name - entry.set_service - entry.message = "Created client for #{entry.service}" - entry.set_credentials_fields credentials - entry.set "customEndpoint", @config.endpoint if @config.endpoint - entry.set "defaultTimeout", @config.timeout if @config.timeout - entry.set "quotaProject", @quota_project_id if @quota_project_id - end - - @location_client = Google::Cloud::Location::Locations::Client.new do |config| - config.credentials = credentials - config.quota_project = @quota_project_id - config.endpoint = @search_service_stub.endpoint - config.universe_domain = @search_service_stub.universe_domain - config.logger = @search_service_stub.logger if config.respond_to? :logger= - end - end - - ## - # Get the associated client for mix-in of the Locations. - # - # @return [Google::Cloud::Location::Locations::Client] - # - attr_reader :location_client - - ## - # The logger used for request/response debug logging. - # - # @return [Logger] - # - def logger - @search_service_stub.logger - end - - # Service calls - - ## - # Performs a search. - # - # This feature is only available for users who have Retail Search enabled. - # Enable Retail Search on Cloud Console before using this feature. - # - # @overload search(request, options = nil) - # Pass arguments to `search` via a request object, either of type - # {::Google::Cloud::Retail::V2::SearchRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::SearchRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload search(placement: nil, branch: nil, query: nil, visitor_id: nil, user_info: nil, page_size: nil, page_token: nil, offset: nil, filter: nil, canonical_filter: nil, order_by: nil, facet_specs: nil, dynamic_facet_spec: nil, boost_spec: nil, query_expansion_spec: nil, variant_rollup_keys: nil, page_categories: nil, search_mode: nil, personalization_spec: nil, labels: nil, spell_correction_spec: nil, entity: nil, conversational_search_spec: nil, tile_navigation_spec: nil, language_code: nil, region_code: nil, place_id: nil, user_attributes: nil) - # Pass arguments to `search` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param placement [::String] - # Required. The resource name of the Retail Search serving config, such as - # `projects/*/locations/global/catalogs/default_catalog/servingConfigs/default_serving_config` - # or the name of the legacy placement resource, such as - # `projects/*/locations/global/catalogs/default_catalog/placements/default_search`. - # This field is used to identify the serving config name and the set - # of models that are used to make the search. - # @param branch [::String] - # The branch resource name, such as - # `projects/*/locations/global/catalogs/default_catalog/branches/0`. - # - # Use "default_branch" as the branch ID or leave this field empty, to search - # products under the default branch. - # @param query [::String] - # Raw search query. - # - # If this field is empty, the request is considered a category browsing - # request and returned results are based on - # {::Google::Cloud::Retail::V2::SearchRequest#filter filter} and - # {::Google::Cloud::Retail::V2::SearchRequest#page_categories page_categories}. - # @param visitor_id [::String] - # Required. A unique identifier for tracking visitors. For example, this - # could be implemented with an HTTP cookie, which should be able to uniquely - # identify a visitor on a single device. This unique identifier should not - # change if the visitor logs in or out of the website. - # - # This should be the same identifier as - # {::Google::Cloud::Retail::V2::UserEvent#visitor_id UserEvent.visitor_id}. - # - # The field must be a UTF-8 encoded string with a length limit of 128 - # characters. Otherwise, an INVALID_ARGUMENT error is returned. - # @param user_info [::Google::Cloud::Retail::V2::UserInfo, ::Hash] - # User information. - # @param page_size [::Integer] - # Maximum number of {::Google::Cloud::Retail::V2::Product Product}s to return. If - # unspecified, defaults to a reasonable value. The maximum allowed value is - # 120. Values above 120 will be coerced to 120. - # - # If this field is negative, an INVALID_ARGUMENT is returned. - # @param page_token [::String] - # A page token - # {::Google::Cloud::Retail::V2::SearchResponse#next_page_token SearchResponse.next_page_token}, - # received from a previous - # {::Google::Cloud::Retail::V2::SearchService::Client#search SearchService.Search} call. - # Provide this to retrieve the subsequent page. - # - # When paginating, all other parameters provided to - # {::Google::Cloud::Retail::V2::SearchService::Client#search SearchService.Search} must - # match the call that provided the page token. Otherwise, an INVALID_ARGUMENT - # error is returned. - # @param offset [::Integer] - # A 0-indexed integer that specifies the current offset (that is, starting - # result location, amongst the {::Google::Cloud::Retail::V2::Product Product}s - # deemed by the API as relevant) in search results. This field is only - # considered if {::Google::Cloud::Retail::V2::SearchRequest#page_token page_token} - # is unset. - # - # If this field is negative, an INVALID_ARGUMENT is returned. - # @param filter [::String] - # The filter syntax consists of an expression language for constructing a - # predicate from one or more fields of the products being filtered. Filter - # expression is case-sensitive. For more information, see - # [Filter](https://cloud.google.com/retail/docs/filter-and-order#filter). - # - # If this field is unrecognizable, an INVALID_ARGUMENT is returned. - # @param canonical_filter [::String] - # The default filter that is applied when a user performs a search without - # checking any filters on the search page. - # - # The filter applied to every search request when quality improvement such as - # query expansion is needed. In the case a query does not have a sufficient - # amount of results this filter will be used to determine whether or not to - # enable the query expansion flow. The original filter will still be used for - # the query expanded search. - # This field is strongly recommended to achieve high search quality. - # - # For more information about filter syntax, see - # {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}. - # @param order_by [::String] - # The order in which products are returned. Products can be ordered by - # a field in an {::Google::Cloud::Retail::V2::Product Product} object. Leave it - # unset if ordered by relevance. OrderBy expression is case-sensitive. For - # more information, see - # [Order](https://cloud.google.com/retail/docs/filter-and-order#order). - # - # If this field is unrecognizable, an INVALID_ARGUMENT is returned. - # @param facet_specs [::Array<::Google::Cloud::Retail::V2::SearchRequest::FacetSpec, ::Hash>] - # Facet specifications for faceted search. If empty, no facets are returned. - # - # A maximum of 200 values are allowed. Otherwise, an INVALID_ARGUMENT error - # is returned. - # @param dynamic_facet_spec [::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec, ::Hash] - # Deprecated. Refer to https://cloud.google.com/retail/docs/configs#dynamic - # to enable dynamic facets. Do not set this field. - # - # The specification for dynamically generated facets. Notice that only - # textual facets can be dynamically generated. - # @param boost_spec [::Google::Cloud::Retail::V2::SearchRequest::BoostSpec, ::Hash] - # Boost specification to boost certain products. For more information, see - # [Boost results](https://cloud.google.com/retail/docs/boosting). - # - # Notice that if both - # {::Google::Cloud::Retail::V2::ServingConfig#boost_control_ids ServingConfig.boost_control_ids} - # and - # {::Google::Cloud::Retail::V2::SearchRequest#boost_spec SearchRequest.boost_spec} - # are set, the boost conditions from both places are evaluated. If a search - # request matches multiple boost conditions, the final boost score is equal - # to the sum of the boost scores from all matched boost conditions. - # @param query_expansion_spec [::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec, ::Hash] - # The query expansion specification that specifies the conditions under which - # query expansion occurs. For more information, see [Query - # expansion](https://cloud.google.com/retail/docs/result-size#query_expansion). - # @param variant_rollup_keys [::Array<::String>] - # The keys to fetch and rollup the matching - # {::Google::Cloud::Retail::V2::Product::Type::VARIANT variant} - # {::Google::Cloud::Retail::V2::Product Product}s attributes, - # {::Google::Cloud::Retail::V2::FulfillmentInfo FulfillmentInfo} or - # {::Google::Cloud::Retail::V2::LocalInventory LocalInventory}s attributes. The - # attributes from all the matching - # {::Google::Cloud::Retail::V2::Product::Type::VARIANT variant} - # {::Google::Cloud::Retail::V2::Product Product}s or - # {::Google::Cloud::Retail::V2::LocalInventory LocalInventory}s are merged and - # de-duplicated. Notice that rollup attributes will lead to extra query - # latency. Maximum number of keys is 30. - # - # For {::Google::Cloud::Retail::V2::FulfillmentInfo FulfillmentInfo}, a - # fulfillment type and a fulfillment ID must be provided in the format of - # "fulfillmentType.fulfillmentId". E.g., in "pickupInStore.store123", - # "pickupInStore" is fulfillment type and "store123" is the store ID. - # - # Supported keys are: - # - # * colorFamilies - # * price - # * originalPrice - # * discount - # * variantId - # * inventory(place_id,price) - # * inventory(place_id,original_price) - # * inventory(place_id,attributes.key), where key is any key in the - # {::Google::Cloud::Retail::V2::LocalInventory#attributes Product.local_inventories.attributes} - # map. - # * attributes.key, where key is any key in the - # {::Google::Cloud::Retail::V2::Product#attributes Product.attributes} map. - # * pickupInStore.id, where id is any - # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} - # for {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type} - # "pickup-in-store". - # * shipToStore.id, where id is any - # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} - # for {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type} - # "ship-to-store". - # * sameDayDelivery.id, where id is any - # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} - # for {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type} - # "same-day-delivery". - # * nextDayDelivery.id, where id is any - # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} - # for {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type} - # "next-day-delivery". - # * customFulfillment1.id, where id is any - # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} - # for {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type} - # "custom-type-1". - # * customFulfillment2.id, where id is any - # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} - # for {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type} - # "custom-type-2". - # * customFulfillment3.id, where id is any - # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} - # for {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type} - # "custom-type-3". - # * customFulfillment4.id, where id is any - # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} - # for {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type} - # "custom-type-4". - # * customFulfillment5.id, where id is any - # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} - # for {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type} - # "custom-type-5". - # - # If this field is set to an invalid value other than these, an - # INVALID_ARGUMENT error is returned. - # @param page_categories [::Array<::String>] - # The categories associated with a category page. Must be set for category - # navigation queries to achieve good search quality. The format should be - # the same as - # {::Google::Cloud::Retail::V2::UserEvent#page_categories UserEvent.page_categories}; - # - # To represent full path of category, use '>' sign to separate different - # hierarchies. If '>' is part of the category name, replace it with - # other character(s). - # - # Category pages include special pages such as sales or promotions. For - # instance, a special sale page may have the category hierarchy: - # "pageCategories" : ["Sales > 2017 Black Friday Deals"]. - # @param search_mode [::Google::Cloud::Retail::V2::SearchRequest::SearchMode] - # The search mode of the search request. If not specified, a single search - # request triggers both product search and faceted search. - # @param personalization_spec [::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec, ::Hash] - # The specification for personalization. - # - # Notice that if both - # {::Google::Cloud::Retail::V2::ServingConfig#personalization_spec ServingConfig.personalization_spec} - # and - # {::Google::Cloud::Retail::V2::SearchRequest#personalization_spec SearchRequest.personalization_spec} - # are set. - # {::Google::Cloud::Retail::V2::SearchRequest#personalization_spec SearchRequest.personalization_spec} - # will override - # {::Google::Cloud::Retail::V2::ServingConfig#personalization_spec ServingConfig.personalization_spec}. - # @param labels [::Hash{::String => ::String}] - # The labels applied to a resource must meet the following requirements: - # - # * Each resource can have multiple labels, up to a maximum of 64. - # * Each label must be a key-value pair. - # * Keys have a minimum length of 1 character and a maximum length of 63 - # characters and cannot be empty. Values can be empty and have a maximum - # length of 63 characters. - # * Keys and values can contain only lowercase letters, numeric characters, - # underscores, and dashes. All characters must use UTF-8 encoding, and - # international characters are allowed. - # * The key portion of a label must be unique. However, you can use the same - # key with multiple resources. - # * Keys must start with a lowercase letter or international character. - # - # For more information, see [Requirements for - # labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) - # in the Resource Manager documentation. - # @param spell_correction_spec [::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec, ::Hash] - # The spell correction specification that specifies the mode under - # which spell correction will take effect. - # @param entity [::String] - # The entity for customers that may run multiple different entities, domains, - # sites or regions, for example, `Google US`, `Google Ads`, `Waymo`, - # `google.com`, `youtube.com`, etc. - # If this is set, it should be exactly matched with - # {::Google::Cloud::Retail::V2::UserEvent#entity UserEvent.entity} to get search - # results boosted by entity. - # @param conversational_search_spec [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec, ::Hash] - # Optional. This field specifies all conversational related parameters - # addition to traditional retail search. - # @param tile_navigation_spec [::Google::Cloud::Retail::V2::SearchRequest::TileNavigationSpec, ::Hash] - # Optional. This field specifies tile navigation related parameters. - # @param language_code [::String] - # Optional. The BCP-47 language code, such as "en-US" or "sr-Latn" - # [list](https://www.unicode.org/cldr/charts/46/summary/root.html). For more - # information, see [Standardized codes](https://google.aip.dev/143). This - # field helps to better interpret the query. If a value isn't specified, the - # query language code is automatically detected, which may not be accurate. - # @param region_code [::String] - # Optional. The Unicode country/region code (CLDR) of a location, such as - # "US" and "419" - # [list](https://www.unicode.org/cldr/charts/46/supplemental/territory_information.html). - # For more information, see [Standardized codes](https://google.aip.dev/143). - # If set, then results will be boosted based on the region_code provided. - # @param place_id [::String] - # Optional. An id corresponding to a place, such as a store id or region id. - # When specified, we use the price from the local inventory with the matching - # product's - # {::Google::Cloud::Retail::V2::LocalInventory#place_id LocalInventory.place_id} - # for revenue optimization. - # @param user_attributes [::Hash{::String => ::Google::Cloud::Retail::V2::StringList, ::Hash}] - # Optional. The user attributes that could be used for personalization of - # search results. - # * Populate at most 100 key-value pairs per query. - # * Only supports string keys and repeated string values. - # * Duplcate keys are not allowed within a single query. - # - # Example: - # user_attributes: [ - # { key: "pets" - # value { - # values: "dog" - # values: "cat" - # } - # }, - # { key: "state" - # value { - # values: "CA" - # } - # } - # ] - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Retail::V2::SearchResponse::SearchResult>] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::PagedEnumerable<::Google::Cloud::Retail::V2::SearchResponse::SearchResult>] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::SearchService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::SearchRequest.new - # - # # Call the search method. - # result = client.search request - # - # # The returned object is of type Gapic::PagedEnumerable. You can iterate - # # over elements, and API calls will be issued to fetch pages as needed. - # result.each do |item| - # # Each element is of type ::Google::Cloud::Retail::V2::SearchResponse::SearchResult. - # p item - # end - # - def search request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::SearchRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.search.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.placement - header_params["placement"] = request.placement - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.search.timeout, - metadata: metadata, - retry_policy: @config.rpcs.search.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @search_service_stub.call_rpc :search, request, options: options do |response, operation| - response = ::Gapic::PagedEnumerable.new @search_service_stub, :search, request, response, operation, options - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Configuration class for the SearchService API. - # - # This class represents the configuration for SearchService, - # providing control over timeouts, retry behavior, logging, transport - # parameters, and other low-level controls. Certain parameters can also be - # applied individually to specific RPCs. See - # {::Google::Cloud::Retail::V2::SearchService::Client::Configuration::Rpcs} - # for a list of RPCs that can be configured independently. - # - # Configuration can be applied globally to all clients, or to a single client - # on construction. - # - # @example - # - # # Modify the global config, setting the timeout for - # # search to 20 seconds, - # # and all remaining timeouts to 10 seconds. - # ::Google::Cloud::Retail::V2::SearchService::Client.configure do |config| - # config.timeout = 10.0 - # config.rpcs.search.timeout = 20.0 - # end - # - # # Apply the above configuration only to a new client. - # client = ::Google::Cloud::Retail::V2::SearchService::Client.new do |config| - # config.timeout = 10.0 - # config.rpcs.search.timeout = 20.0 - # end - # - # @!attribute [rw] endpoint - # A custom service endpoint, as a hostname or hostname:port. The default is - # nil, indicating to use the default endpoint in the current universe domain. - # @return [::String,nil] - # @!attribute [rw] credentials - # Credentials to send with calls. You may provide any of the following types: - # * (`Google::Auth::Credentials`) A googleauth credentials object - # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) - # * (`Signet::OAuth2::Client`) A signet oauth2 client object - # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) - # * (`GRPC::Core::Channel`) a gRPC channel with included credentials - # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object - # * (`nil`) indicating no credentials - # - # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials - # is deprecated. Providing an unvalidated credential configuration to - # Google APIs can compromise the security of your systems and data. - # - # @example - # - # # The recommended way to provide credentials is to use the `make_creds` method - # # on the appropriate credentials class for your environment. - # - # require "googleauth" - # - # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds( - # json_key_io: ::File.open("/path/to/keyfile.json") - # ) - # - # client = ::Google::Cloud::Retail::V2::SearchService::Client.new do |config| - # config.credentials = credentials - # end - # - # @note Warning: If you accept a credential configuration (JSON file or Hash) from an - # external source for authentication to Google Cloud, you must validate it before - # providing it to a Google API client library. Providing an unvalidated credential - # configuration to Google APIs can compromise the security of your systems and data. - # For more information, refer to [Validate credential configurations from external - # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). - # @return [::Object] - # @!attribute [rw] scope - # The OAuth scopes - # @return [::Array<::String>] - # @!attribute [rw] lib_name - # The library name as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] lib_version - # The library version as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] channel_args - # Extra parameters passed to the gRPC channel. Note: this is ignored if a - # `GRPC::Core::Channel` object is provided as the credential. - # @return [::Hash] - # @!attribute [rw] interceptors - # An array of interceptors that are run before calls are executed. - # @return [::Array<::GRPC::ClientInterceptor>] - # @!attribute [rw] timeout - # The call timeout in seconds. - # @return [::Numeric] - # @!attribute [rw] metadata - # Additional gRPC headers to be sent with the call. - # @return [::Hash{::Symbol=>::String}] - # @!attribute [rw] retry_policy - # The retry policy. The value is a hash with the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # @return [::Hash] - # @!attribute [rw] quota_project - # A separate project against which to charge quota. - # @return [::String] - # @!attribute [rw] universe_domain - # The universe domain within which to make requests. This determines the - # default endpoint URL. The default value of nil uses the environment - # universe (usually the default "googleapis.com" universe). - # @return [::String,nil] - # @!attribute [rw] logger - # A custom logger to use for request/response debug logging, or the value - # `:default` (the default) to construct a default logger, or `nil` to - # explicitly disable logging. - # @return [::Logger,:default,nil] - # - class Configuration - extend ::Gapic::Config - - # @private - # The endpoint specific to the default "googleapis.com" universe. Deprecated. - DEFAULT_ENDPOINT = "retail.googleapis.com" - - config_attr :endpoint, nil, ::String, nil - config_attr :credentials, nil do |value| - allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] - allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel - allowed.any? { |klass| klass === value } - end - config_attr :scope, nil, ::String, ::Array, nil - config_attr :lib_name, nil, ::String, nil - config_attr :lib_version, nil, ::String, nil - config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) - config_attr :interceptors, nil, ::Array, nil - config_attr :timeout, nil, ::Numeric, nil - config_attr :metadata, nil, ::Hash, nil - config_attr :retry_policy, nil, ::Hash, ::Proc, nil - config_attr :quota_project, nil, ::String, nil - config_attr :universe_domain, nil, ::String, nil - config_attr :logger, :default, ::Logger, nil, :default - - # @private - def initialize parent_config = nil - @parent_config = parent_config unless parent_config.nil? - - yield self if block_given? - end - - ## - # Configurations for individual RPCs - # @return [Rpcs] - # - def rpcs - @rpcs ||= begin - parent_rpcs = nil - parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) - Rpcs.new parent_rpcs - end - end - - ## - # Configuration for the channel pool - # @return [::Gapic::ServiceStub::ChannelPool::Configuration] - # - def channel_pool - @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new - end - - ## - # Configuration RPC class for the SearchService API. - # - # Includes fields providing the configuration for each RPC in this service. - # Each configuration object is of type `Gapic::Config::Method` and includes - # the following configuration fields: - # - # * `timeout` (*type:* `Numeric`) - The call timeout in seconds - # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers - # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields - # include the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # - class Rpcs - ## - # RPC-specific configuration for `search` - # @return [::Gapic::Config::Method] - # - attr_reader :search - - # @private - def initialize parent_rpcs = nil - search_config = parent_rpcs.search if parent_rpcs.respond_to? :search - @search = ::Gapic::Config::Method.new search_config - - yield self if block_given? - end - end - end - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/credentials.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/credentials.rb deleted file mode 100644 index cac1d6f0827c..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/credentials.rb +++ /dev/null @@ -1,51 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "googleauth" - -module Google - module Cloud - module Retail - module V2 - module SearchService - # Credentials for the SearchService API. - class Credentials < ::Google::Auth::Credentials - self.scope = [ - "https://www.googleapis.com/auth/cloud-platform" - ] - self.env_vars = [ - "RETAIL_CREDENTIALS", - "RETAIL_KEYFILE", - "GOOGLE_CLOUD_CREDENTIALS", - "GOOGLE_CLOUD_KEYFILE", - "GCLOUD_KEYFILE", - "RETAIL_CREDENTIALS_JSON", - "RETAIL_KEYFILE_JSON", - "GOOGLE_CLOUD_CREDENTIALS_JSON", - "GOOGLE_CLOUD_KEYFILE_JSON", - "GCLOUD_KEYFILE_JSON" - ] - self.paths = [ - "~/.config/google_cloud/application_default_credentials.json" - ] - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/paths.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/paths.rb deleted file mode 100644 index 9bc8dfbe2895..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/paths.rb +++ /dev/null @@ -1,54 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Cloud - module Retail - module V2 - module SearchService - # Path helper methods for the SearchService API. - module Paths - ## - # Create a fully-qualified Branch resource string. - # - # The resource will be in the following format: - # - # `projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}` - # - # @param project [String] - # @param location [String] - # @param catalog [String] - # @param branch [String] - # - # @return [::String] - def branch_path project:, location:, catalog:, branch: - raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" - raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" - raise ::ArgumentError, "catalog cannot contain /" if catalog.to_s.include? "/" - - "projects/#{project}/locations/#{location}/catalogs/#{catalog}/branches/#{branch}" - end - - extend self - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/rest.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/rest.rb deleted file mode 100644 index b7b1de13989c..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/rest.rb +++ /dev/null @@ -1,55 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "gapic/rest" -require "gapic/config" -require "gapic/config/method" - -require "google/cloud/retail/v2/version" - -require "google/cloud/retail/v2/search_service/credentials" -require "google/cloud/retail/v2/search_service/paths" -require "google/cloud/retail/v2/search_service/rest/client" - -module Google - module Cloud - module Retail - module V2 - ## - # Service for search. - # - # This feature is only available for users who have Retail Search enabled. - # Enable Retail Search on Cloud Console before using this feature. - # - # To load this service and instantiate a REST client: - # - # require "google/cloud/retail/v2/search_service/rest" - # client = ::Google::Cloud::Retail::V2::SearchService::Rest::Client.new - # - module SearchService - # Client for the REST transport - module Rest - end - end - end - end - end -end - -helper_path = ::File.join __dir__, "rest", "helpers.rb" -require "google/cloud/retail/v2/search_service/rest/helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/rest/client.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/rest/client.rb deleted file mode 100644 index 5657920b447d..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/rest/client.rb +++ /dev/null @@ -1,739 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "google/cloud/errors" -require "google/cloud/retail/v2/search_service_pb" -require "google/cloud/retail/v2/search_service/rest/service_stub" -require "google/cloud/location/rest" - -module Google - module Cloud - module Retail - module V2 - module SearchService - module Rest - ## - # REST client for the SearchService service. - # - # Service for search. - # - # This feature is only available for users who have Retail Search enabled. - # Enable Retail Search on Cloud Console before using this feature. - # - class Client - # @private - API_VERSION = "" - - # @private - DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" - - include Paths - - # @private - attr_reader :search_service_stub - - ## - # Configure the SearchService Client class. - # - # See {::Google::Cloud::Retail::V2::SearchService::Rest::Client::Configuration} - # for a description of the configuration fields. - # - # @example - # - # # Modify the configuration for all SearchService clients - # ::Google::Cloud::Retail::V2::SearchService::Rest::Client.configure do |config| - # config.timeout = 10.0 - # end - # - # @yield [config] Configure the Client client. - # @yieldparam config [Client::Configuration] - # - # @return [Client::Configuration] - # - def self.configure - @configure ||= begin - namespace = ["Google", "Cloud", "Retail", "V2"] - parent_config = while namespace.any? - parent_name = namespace.join "::" - parent_const = const_get parent_name - break parent_const.configure if parent_const.respond_to? :configure - namespace.pop - end - default_config = Client::Configuration.new parent_config - - default_config.timeout = 5.0 - default_config.retry_policy = { - initial_delay: 0.1, max_delay: 5.0, multiplier: 1.3, retry_codes: [14, 4] - } - - default_config - end - yield @configure if block_given? - @configure - end - - ## - # Configure the SearchService Client instance. - # - # The configuration is set to the derived mode, meaning that values can be changed, - # but structural changes (adding new fields, etc.) are not allowed. Structural changes - # should be made on {Client.configure}. - # - # See {::Google::Cloud::Retail::V2::SearchService::Rest::Client::Configuration} - # for a description of the configuration fields. - # - # @yield [config] Configure the Client client. - # @yieldparam config [Client::Configuration] - # - # @return [Client::Configuration] - # - def configure - yield @config if block_given? - @config - end - - ## - # The effective universe domain - # - # @return [String] - # - def universe_domain - @search_service_stub.universe_domain - end - - ## - # Create a new SearchService REST client object. - # - # @example - # - # # Create a client using the default configuration - # client = ::Google::Cloud::Retail::V2::SearchService::Rest::Client.new - # - # # Create a client using a custom configuration - # client = ::Google::Cloud::Retail::V2::SearchService::Rest::Client.new do |config| - # config.timeout = 10.0 - # end - # - # @yield [config] Configure the SearchService client. - # @yieldparam config [Client::Configuration] - # - def initialize - # Create the configuration object - @config = Configuration.new Client.configure - - # Yield the configuration if needed - yield @config if block_given? - - # Create credentials - credentials = @config.credentials - # Use self-signed JWT if the endpoint is unchanged from default, - # but only if the default endpoint does not have a region prefix. - enable_self_signed_jwt = @config.endpoint.nil? || - (@config.endpoint == Configuration::DEFAULT_ENDPOINT && - !@config.endpoint.split(".").first.include?("-")) - credentials ||= Credentials.default scope: @config.scope, - enable_self_signed_jwt: enable_self_signed_jwt - if credentials.is_a?(::String) || credentials.is_a?(::Hash) - credentials = Credentials.new credentials, scope: @config.scope - end - - @quota_project_id = @config.quota_project - @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id - - @search_service_stub = ::Google::Cloud::Retail::V2::SearchService::Rest::ServiceStub.new( - endpoint: @config.endpoint, - endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, - universe_domain: @config.universe_domain, - credentials: credentials, - logger: @config.logger - ) - - @search_service_stub.logger(stub: true)&.info do |entry| - entry.set_system_name - entry.set_service - entry.message = "Created client for #{entry.service}" - entry.set_credentials_fields credentials - entry.set "customEndpoint", @config.endpoint if @config.endpoint - entry.set "defaultTimeout", @config.timeout if @config.timeout - entry.set "quotaProject", @quota_project_id if @quota_project_id - end - - @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config| - config.credentials = credentials - config.quota_project = @quota_project_id - config.endpoint = @search_service_stub.endpoint - config.universe_domain = @search_service_stub.universe_domain - config.logger = @search_service_stub.logger if config.respond_to? :logger= - end - end - - ## - # Get the associated client for mix-in of the Locations. - # - # @return [Google::Cloud::Location::Locations::Rest::Client] - # - attr_reader :location_client - - ## - # The logger used for request/response debug logging. - # - # @return [Logger] - # - def logger - @search_service_stub.logger - end - - # Service calls - - ## - # Performs a search. - # - # This feature is only available for users who have Retail Search enabled. - # Enable Retail Search on Cloud Console before using this feature. - # - # @overload search(request, options = nil) - # Pass arguments to `search` via a request object, either of type - # {::Google::Cloud::Retail::V2::SearchRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::SearchRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload search(placement: nil, branch: nil, query: nil, visitor_id: nil, user_info: nil, page_size: nil, page_token: nil, offset: nil, filter: nil, canonical_filter: nil, order_by: nil, facet_specs: nil, dynamic_facet_spec: nil, boost_spec: nil, query_expansion_spec: nil, variant_rollup_keys: nil, page_categories: nil, search_mode: nil, personalization_spec: nil, labels: nil, spell_correction_spec: nil, entity: nil, conversational_search_spec: nil, tile_navigation_spec: nil, language_code: nil, region_code: nil, place_id: nil, user_attributes: nil) - # Pass arguments to `search` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param placement [::String] - # Required. The resource name of the Retail Search serving config, such as - # `projects/*/locations/global/catalogs/default_catalog/servingConfigs/default_serving_config` - # or the name of the legacy placement resource, such as - # `projects/*/locations/global/catalogs/default_catalog/placements/default_search`. - # This field is used to identify the serving config name and the set - # of models that are used to make the search. - # @param branch [::String] - # The branch resource name, such as - # `projects/*/locations/global/catalogs/default_catalog/branches/0`. - # - # Use "default_branch" as the branch ID or leave this field empty, to search - # products under the default branch. - # @param query [::String] - # Raw search query. - # - # If this field is empty, the request is considered a category browsing - # request and returned results are based on - # {::Google::Cloud::Retail::V2::SearchRequest#filter filter} and - # {::Google::Cloud::Retail::V2::SearchRequest#page_categories page_categories}. - # @param visitor_id [::String] - # Required. A unique identifier for tracking visitors. For example, this - # could be implemented with an HTTP cookie, which should be able to uniquely - # identify a visitor on a single device. This unique identifier should not - # change if the visitor logs in or out of the website. - # - # This should be the same identifier as - # {::Google::Cloud::Retail::V2::UserEvent#visitor_id UserEvent.visitor_id}. - # - # The field must be a UTF-8 encoded string with a length limit of 128 - # characters. Otherwise, an INVALID_ARGUMENT error is returned. - # @param user_info [::Google::Cloud::Retail::V2::UserInfo, ::Hash] - # User information. - # @param page_size [::Integer] - # Maximum number of {::Google::Cloud::Retail::V2::Product Product}s to return. If - # unspecified, defaults to a reasonable value. The maximum allowed value is - # 120. Values above 120 will be coerced to 120. - # - # If this field is negative, an INVALID_ARGUMENT is returned. - # @param page_token [::String] - # A page token - # {::Google::Cloud::Retail::V2::SearchResponse#next_page_token SearchResponse.next_page_token}, - # received from a previous - # {::Google::Cloud::Retail::V2::SearchService::Rest::Client#search SearchService.Search} call. - # Provide this to retrieve the subsequent page. - # - # When paginating, all other parameters provided to - # {::Google::Cloud::Retail::V2::SearchService::Rest::Client#search SearchService.Search} must - # match the call that provided the page token. Otherwise, an INVALID_ARGUMENT - # error is returned. - # @param offset [::Integer] - # A 0-indexed integer that specifies the current offset (that is, starting - # result location, amongst the {::Google::Cloud::Retail::V2::Product Product}s - # deemed by the API as relevant) in search results. This field is only - # considered if {::Google::Cloud::Retail::V2::SearchRequest#page_token page_token} - # is unset. - # - # If this field is negative, an INVALID_ARGUMENT is returned. - # @param filter [::String] - # The filter syntax consists of an expression language for constructing a - # predicate from one or more fields of the products being filtered. Filter - # expression is case-sensitive. For more information, see - # [Filter](https://cloud.google.com/retail/docs/filter-and-order#filter). - # - # If this field is unrecognizable, an INVALID_ARGUMENT is returned. - # @param canonical_filter [::String] - # The default filter that is applied when a user performs a search without - # checking any filters on the search page. - # - # The filter applied to every search request when quality improvement such as - # query expansion is needed. In the case a query does not have a sufficient - # amount of results this filter will be used to determine whether or not to - # enable the query expansion flow. The original filter will still be used for - # the query expanded search. - # This field is strongly recommended to achieve high search quality. - # - # For more information about filter syntax, see - # {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}. - # @param order_by [::String] - # The order in which products are returned. Products can be ordered by - # a field in an {::Google::Cloud::Retail::V2::Product Product} object. Leave it - # unset if ordered by relevance. OrderBy expression is case-sensitive. For - # more information, see - # [Order](https://cloud.google.com/retail/docs/filter-and-order#order). - # - # If this field is unrecognizable, an INVALID_ARGUMENT is returned. - # @param facet_specs [::Array<::Google::Cloud::Retail::V2::SearchRequest::FacetSpec, ::Hash>] - # Facet specifications for faceted search. If empty, no facets are returned. - # - # A maximum of 200 values are allowed. Otherwise, an INVALID_ARGUMENT error - # is returned. - # @param dynamic_facet_spec [::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec, ::Hash] - # Deprecated. Refer to https://cloud.google.com/retail/docs/configs#dynamic - # to enable dynamic facets. Do not set this field. - # - # The specification for dynamically generated facets. Notice that only - # textual facets can be dynamically generated. - # @param boost_spec [::Google::Cloud::Retail::V2::SearchRequest::BoostSpec, ::Hash] - # Boost specification to boost certain products. For more information, see - # [Boost results](https://cloud.google.com/retail/docs/boosting). - # - # Notice that if both - # {::Google::Cloud::Retail::V2::ServingConfig#boost_control_ids ServingConfig.boost_control_ids} - # and - # {::Google::Cloud::Retail::V2::SearchRequest#boost_spec SearchRequest.boost_spec} - # are set, the boost conditions from both places are evaluated. If a search - # request matches multiple boost conditions, the final boost score is equal - # to the sum of the boost scores from all matched boost conditions. - # @param query_expansion_spec [::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec, ::Hash] - # The query expansion specification that specifies the conditions under which - # query expansion occurs. For more information, see [Query - # expansion](https://cloud.google.com/retail/docs/result-size#query_expansion). - # @param variant_rollup_keys [::Array<::String>] - # The keys to fetch and rollup the matching - # {::Google::Cloud::Retail::V2::Product::Type::VARIANT variant} - # {::Google::Cloud::Retail::V2::Product Product}s attributes, - # {::Google::Cloud::Retail::V2::FulfillmentInfo FulfillmentInfo} or - # {::Google::Cloud::Retail::V2::LocalInventory LocalInventory}s attributes. The - # attributes from all the matching - # {::Google::Cloud::Retail::V2::Product::Type::VARIANT variant} - # {::Google::Cloud::Retail::V2::Product Product}s or - # {::Google::Cloud::Retail::V2::LocalInventory LocalInventory}s are merged and - # de-duplicated. Notice that rollup attributes will lead to extra query - # latency. Maximum number of keys is 30. - # - # For {::Google::Cloud::Retail::V2::FulfillmentInfo FulfillmentInfo}, a - # fulfillment type and a fulfillment ID must be provided in the format of - # "fulfillmentType.fulfillmentId". E.g., in "pickupInStore.store123", - # "pickupInStore" is fulfillment type and "store123" is the store ID. - # - # Supported keys are: - # - # * colorFamilies - # * price - # * originalPrice - # * discount - # * variantId - # * inventory(place_id,price) - # * inventory(place_id,original_price) - # * inventory(place_id,attributes.key), where key is any key in the - # {::Google::Cloud::Retail::V2::LocalInventory#attributes Product.local_inventories.attributes} - # map. - # * attributes.key, where key is any key in the - # {::Google::Cloud::Retail::V2::Product#attributes Product.attributes} map. - # * pickupInStore.id, where id is any - # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} - # for {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type} - # "pickup-in-store". - # * shipToStore.id, where id is any - # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} - # for {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type} - # "ship-to-store". - # * sameDayDelivery.id, where id is any - # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} - # for {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type} - # "same-day-delivery". - # * nextDayDelivery.id, where id is any - # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} - # for {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type} - # "next-day-delivery". - # * customFulfillment1.id, where id is any - # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} - # for {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type} - # "custom-type-1". - # * customFulfillment2.id, where id is any - # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} - # for {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type} - # "custom-type-2". - # * customFulfillment3.id, where id is any - # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} - # for {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type} - # "custom-type-3". - # * customFulfillment4.id, where id is any - # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} - # for {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type} - # "custom-type-4". - # * customFulfillment5.id, where id is any - # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} - # for {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type} - # "custom-type-5". - # - # If this field is set to an invalid value other than these, an - # INVALID_ARGUMENT error is returned. - # @param page_categories [::Array<::String>] - # The categories associated with a category page. Must be set for category - # navigation queries to achieve good search quality. The format should be - # the same as - # {::Google::Cloud::Retail::V2::UserEvent#page_categories UserEvent.page_categories}; - # - # To represent full path of category, use '>' sign to separate different - # hierarchies. If '>' is part of the category name, replace it with - # other character(s). - # - # Category pages include special pages such as sales or promotions. For - # instance, a special sale page may have the category hierarchy: - # "pageCategories" : ["Sales > 2017 Black Friday Deals"]. - # @param search_mode [::Google::Cloud::Retail::V2::SearchRequest::SearchMode] - # The search mode of the search request. If not specified, a single search - # request triggers both product search and faceted search. - # @param personalization_spec [::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec, ::Hash] - # The specification for personalization. - # - # Notice that if both - # {::Google::Cloud::Retail::V2::ServingConfig#personalization_spec ServingConfig.personalization_spec} - # and - # {::Google::Cloud::Retail::V2::SearchRequest#personalization_spec SearchRequest.personalization_spec} - # are set. - # {::Google::Cloud::Retail::V2::SearchRequest#personalization_spec SearchRequest.personalization_spec} - # will override - # {::Google::Cloud::Retail::V2::ServingConfig#personalization_spec ServingConfig.personalization_spec}. - # @param labels [::Hash{::String => ::String}] - # The labels applied to a resource must meet the following requirements: - # - # * Each resource can have multiple labels, up to a maximum of 64. - # * Each label must be a key-value pair. - # * Keys have a minimum length of 1 character and a maximum length of 63 - # characters and cannot be empty. Values can be empty and have a maximum - # length of 63 characters. - # * Keys and values can contain only lowercase letters, numeric characters, - # underscores, and dashes. All characters must use UTF-8 encoding, and - # international characters are allowed. - # * The key portion of a label must be unique. However, you can use the same - # key with multiple resources. - # * Keys must start with a lowercase letter or international character. - # - # For more information, see [Requirements for - # labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) - # in the Resource Manager documentation. - # @param spell_correction_spec [::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec, ::Hash] - # The spell correction specification that specifies the mode under - # which spell correction will take effect. - # @param entity [::String] - # The entity for customers that may run multiple different entities, domains, - # sites or regions, for example, `Google US`, `Google Ads`, `Waymo`, - # `google.com`, `youtube.com`, etc. - # If this is set, it should be exactly matched with - # {::Google::Cloud::Retail::V2::UserEvent#entity UserEvent.entity} to get search - # results boosted by entity. - # @param conversational_search_spec [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec, ::Hash] - # Optional. This field specifies all conversational related parameters - # addition to traditional retail search. - # @param tile_navigation_spec [::Google::Cloud::Retail::V2::SearchRequest::TileNavigationSpec, ::Hash] - # Optional. This field specifies tile navigation related parameters. - # @param language_code [::String] - # Optional. The BCP-47 language code, such as "en-US" or "sr-Latn" - # [list](https://www.unicode.org/cldr/charts/46/summary/root.html). For more - # information, see [Standardized codes](https://google.aip.dev/143). This - # field helps to better interpret the query. If a value isn't specified, the - # query language code is automatically detected, which may not be accurate. - # @param region_code [::String] - # Optional. The Unicode country/region code (CLDR) of a location, such as - # "US" and "419" - # [list](https://www.unicode.org/cldr/charts/46/supplemental/territory_information.html). - # For more information, see [Standardized codes](https://google.aip.dev/143). - # If set, then results will be boosted based on the region_code provided. - # @param place_id [::String] - # Optional. An id corresponding to a place, such as a store id or region id. - # When specified, we use the price from the local inventory with the matching - # product's - # {::Google::Cloud::Retail::V2::LocalInventory#place_id LocalInventory.place_id} - # for revenue optimization. - # @param user_attributes [::Hash{::String => ::Google::Cloud::Retail::V2::StringList, ::Hash}] - # Optional. The user attributes that could be used for personalization of - # search results. - # * Populate at most 100 key-value pairs per query. - # * Only supports string keys and repeated string values. - # * Duplcate keys are not allowed within a single query. - # - # Example: - # user_attributes: [ - # { key: "pets" - # value { - # values: "dog" - # values: "cat" - # } - # }, - # { key: "state" - # value { - # values: "CA" - # } - # } - # ] - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Retail::V2::SearchResponse::SearchResult>] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Retail::V2::SearchResponse::SearchResult>] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::SearchService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::SearchRequest.new - # - # # Call the search method. - # result = client.search request - # - # # The returned object is of type Gapic::PagedEnumerable. You can iterate - # # over elements, and API calls will be issued to fetch pages as needed. - # result.each do |item| - # # Each element is of type ::Google::Cloud::Retail::V2::SearchResponse::SearchResult. - # p item - # end - # - def search request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::SearchRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.search.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.search.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.search.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @search_service_stub.search request, options do |result, operation| - result = ::Gapic::Rest::PagedEnumerable.new @search_service_stub, :search, "results", request, result, options - yield result, operation if block_given? - throw :response, result - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Configuration class for the SearchService REST API. - # - # This class represents the configuration for SearchService REST, - # providing control over timeouts, retry behavior, logging, transport - # parameters, and other low-level controls. Certain parameters can also be - # applied individually to specific RPCs. See - # {::Google::Cloud::Retail::V2::SearchService::Rest::Client::Configuration::Rpcs} - # for a list of RPCs that can be configured independently. - # - # Configuration can be applied globally to all clients, or to a single client - # on construction. - # - # @example - # - # # Modify the global config, setting the timeout for - # # search to 20 seconds, - # # and all remaining timeouts to 10 seconds. - # ::Google::Cloud::Retail::V2::SearchService::Rest::Client.configure do |config| - # config.timeout = 10.0 - # config.rpcs.search.timeout = 20.0 - # end - # - # # Apply the above configuration only to a new client. - # client = ::Google::Cloud::Retail::V2::SearchService::Rest::Client.new do |config| - # config.timeout = 10.0 - # config.rpcs.search.timeout = 20.0 - # end - # - # @!attribute [rw] endpoint - # A custom service endpoint, as a hostname or hostname:port. The default is - # nil, indicating to use the default endpoint in the current universe domain. - # @return [::String,nil] - # @!attribute [rw] credentials - # Credentials to send with calls. You may provide any of the following types: - # * (`String`) The path to a service account key file in JSON format - # * (`Hash`) A service account key as a Hash - # * (`Google::Auth::Credentials`) A googleauth credentials object - # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) - # * (`Signet::OAuth2::Client`) A signet oauth2 client object - # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) - # * (`nil`) indicating no credentials - # - # Warning: If you accept a credential configuration (JSON file or Hash) from an - # external source for authentication to Google Cloud, you must validate it before - # providing it to a Google API client library. Providing an unvalidated credential - # configuration to Google APIs can compromise the security of your systems and data. - # For more information, refer to [Validate credential configurations from external - # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). - # @return [::Object] - # @!attribute [rw] scope - # The OAuth scopes - # @return [::Array<::String>] - # @!attribute [rw] lib_name - # The library name as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] lib_version - # The library version as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] timeout - # The call timeout in seconds. - # @return [::Numeric] - # @!attribute [rw] metadata - # Additional headers to be sent with the call. - # @return [::Hash{::Symbol=>::String}] - # @!attribute [rw] retry_policy - # The retry policy. The value is a hash with the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # @return [::Hash] - # @!attribute [rw] quota_project - # A separate project against which to charge quota. - # @return [::String] - # @!attribute [rw] universe_domain - # The universe domain within which to make requests. This determines the - # default endpoint URL. The default value of nil uses the environment - # universe (usually the default "googleapis.com" universe). - # @return [::String,nil] - # @!attribute [rw] logger - # A custom logger to use for request/response debug logging, or the value - # `:default` (the default) to construct a default logger, or `nil` to - # explicitly disable logging. - # @return [::Logger,:default,nil] - # - class Configuration - extend ::Gapic::Config - - # @private - # The endpoint specific to the default "googleapis.com" universe. Deprecated. - DEFAULT_ENDPOINT = "retail.googleapis.com" - - config_attr :endpoint, nil, ::String, nil - config_attr :credentials, nil do |value| - allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] - allowed.any? { |klass| klass === value } - end - config_attr :scope, nil, ::String, ::Array, nil - config_attr :lib_name, nil, ::String, nil - config_attr :lib_version, nil, ::String, nil - config_attr :timeout, nil, ::Numeric, nil - config_attr :metadata, nil, ::Hash, nil - config_attr :retry_policy, nil, ::Hash, ::Proc, nil - config_attr :quota_project, nil, ::String, nil - config_attr :universe_domain, nil, ::String, nil - config_attr :logger, :default, ::Logger, nil, :default - - # @private - def initialize parent_config = nil - @parent_config = parent_config unless parent_config.nil? - - yield self if block_given? - end - - ## - # Configurations for individual RPCs - # @return [Rpcs] - # - def rpcs - @rpcs ||= begin - parent_rpcs = nil - parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) - Rpcs.new parent_rpcs - end - end - - ## - # Configuration RPC class for the SearchService API. - # - # Includes fields providing the configuration for each RPC in this service. - # Each configuration object is of type `Gapic::Config::Method` and includes - # the following configuration fields: - # - # * `timeout` (*type:* `Numeric`) - The call timeout in seconds - # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers - # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields - # include the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # - class Rpcs - ## - # RPC-specific configuration for `search` - # @return [::Gapic::Config::Method] - # - attr_reader :search - - # @private - def initialize parent_rpcs = nil - search_config = parent_rpcs.search if parent_rpcs.respond_to? :search - @search = ::Gapic::Config::Method.new search_config - - yield self if block_given? - end - end - end - end - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/rest/service_stub.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/rest/service_stub.rb deleted file mode 100644 index 826122ca8f8d..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service/rest/service_stub.rb +++ /dev/null @@ -1,151 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "google/cloud/retail/v2/search_service_pb" - -module Google - module Cloud - module Retail - module V2 - module SearchService - module Rest - ## - # REST service stub for the SearchService service. - # Service stub contains baseline method implementations - # including transcoding, making the REST call, and deserialing the response. - # - class ServiceStub - # @private - def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger: - # These require statements are intentionally placed here to initialize - # the REST modules only when it's required. - require "gapic/rest" - - @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, - endpoint_template: endpoint_template, - universe_domain: universe_domain, - credentials: credentials, - numeric_enums: true, - service_name: self.class, - raise_faraday_errors: false, - logger: logger - end - - ## - # The effective universe domain - # - # @return [String] - # - def universe_domain - @client_stub.universe_domain - end - - ## - # The effective endpoint - # - # @return [String] - # - def endpoint - @client_stub.endpoint - end - - ## - # The logger used for request/response debug logging. - # - # @return [Logger] - # - def logger stub: false - stub ? @client_stub.stub_logger : @client_stub.logger - end - - ## - # Baseline implementation for the search REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::SearchRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::SearchResponse] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::SearchResponse] - # A result object deserialized from the server's reply - def search request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_search_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "search", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Retail::V2::SearchResponse.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # @private - # - # GRPC transcoding helper method for the search REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::SearchRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_search_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :post, - uri_template: "/v2/{placement}:search", - body: "*", - matches: [ - ["placement", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/placements/[^/]+/?$}, false] - ] - ) - .with_bindings( - uri_method: :post, - uri_template: "/v2/{placement}:search", - body: "*", - matches: [ - ["placement", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/servingConfigs/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - end - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service_pb.rb deleted file mode 100644 index 286deb6e40e7..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service_pb.rb +++ /dev/null @@ -1,61 +0,0 @@ -# frozen_string_literal: true -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/retail/v2/search_service.proto - -require 'google/protobuf' - -require 'google/api/annotations_pb' -require 'google/api/client_pb' -require 'google/api/field_behavior_pb' -require 'google/api/resource_pb' -require 'google/cloud/retail/v2/common_pb' -require 'google/cloud/retail/v2/product_pb' -require 'google/protobuf/field_mask_pb' -require 'google/protobuf/struct_pb' - - -descriptor_data = "\n+google/cloud/retail/v2/search_service.proto\x12\x16google.cloud.retail.v2\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a#google/cloud/retail/v2/common.proto\x1a$google/cloud/retail/v2/product.proto\x1a google/protobuf/field_mask.proto\x1a\x1cgoogle/protobuf/struct.proto\"4\n\x15ProductAttributeValue\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t\"\\\n\x18ProductAttributeInterval\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x32\n\x08interval\x18\x02 \x01(\x0b\x32 .google.cloud.retail.v2.Interval\"\xe8\x01\n\x04Tile\x12P\n\x17product_attribute_value\x18\x01 \x01(\x0b\x32-.google.cloud.retail.v2.ProductAttributeValueH\x00\x12V\n\x1aproduct_attribute_interval\x18\x02 \x01(\x0b\x32\x30.google.cloud.retail.v2.ProductAttributeIntervalH\x00\x12!\n\x19representative_product_id\x18\x03 \x01(\tB\x13\n\x11product_attribute\"\x8d\x1c\n\rSearchRequest\x12\x16\n\tplacement\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x31\n\x06\x62ranch\x18\x02 \x01(\tB!\xfa\x41\x1e\n\x1cretail.googleapis.com/Branch\x12\r\n\x05query\x18\x03 \x01(\t\x12\x17\n\nvisitor_id\x18\x04 \x01(\tB\x03\xe0\x41\x02\x12\x33\n\tuser_info\x18\x05 \x01(\x0b\x32 .google.cloud.retail.v2.UserInfo\x12\x11\n\tpage_size\x18\x07 \x01(\x05\x12\x12\n\npage_token\x18\x08 \x01(\t\x12\x0e\n\x06offset\x18\t \x01(\x05\x12\x0e\n\x06\x66ilter\x18\n \x01(\t\x12\x18\n\x10\x63\x61nonical_filter\x18\x1c \x01(\t\x12\x10\n\x08order_by\x18\x0b \x01(\t\x12\x44\n\x0b\x66\x61\x63\x65t_specs\x18\x0c \x03(\x0b\x32/.google.cloud.retail.v2.SearchRequest.FacetSpec\x12V\n\x12\x64ynamic_facet_spec\x18\x15 \x01(\x0b\x32\x36.google.cloud.retail.v2.SearchRequest.DynamicFacetSpecB\x02\x18\x01\x12\x43\n\nboost_spec\x18\r \x01(\x0b\x32/.google.cloud.retail.v2.SearchRequest.BoostSpec\x12V\n\x14query_expansion_spec\x18\x0e \x01(\x0b\x32\x38.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec\x12\x1b\n\x13variant_rollup_keys\x18\x11 \x03(\t\x12\x17\n\x0fpage_categories\x18\x17 \x03(\t\x12\x45\n\x0bsearch_mode\x18\x1f \x01(\x0e\x32\x30.google.cloud.retail.v2.SearchRequest.SearchMode\x12W\n\x14personalization_spec\x18 \x01(\x0b\x32\x39.google.cloud.retail.v2.SearchRequest.PersonalizationSpec\x12\x41\n\x06labels\x18\" \x03(\x0b\x32\x31.google.cloud.retail.v2.SearchRequest.LabelsEntry\x12]\n\x15spell_correction_spec\x18# \x01(\x0b\x32\x39.google.cloud.retail.v2.SearchRequest.SpellCorrectionSpecH\x00\x88\x01\x01\x12\x0e\n\x06\x65ntity\x18& \x01(\t\x12g\n\x1a\x63onversational_search_spec\x18( \x01(\x0b\x32>.google.cloud.retail.v2.SearchRequest.ConversationalSearchSpecB\x03\xe0\x41\x01\x12[\n\x14tile_navigation_spec\x18) \x01(\x0b\x32\x38.google.cloud.retail.v2.SearchRequest.TileNavigationSpecB\x03\xe0\x41\x01\x12\x1a\n\rlanguage_code\x18+ \x01(\tB\x03\xe0\x41\x01\x12\x18\n\x0bregion_code\x18, \x01(\tB\x03\xe0\x41\x01\x12\x15\n\x08place_id\x18. \x01(\tB\x03\xe0\x41\x01\x12W\n\x0fuser_attributes\x18/ \x03(\x0b\x32\x39.google.cloud.retail.v2.SearchRequest.UserAttributesEntryB\x03\xe0\x41\x01\x1a\x91\x03\n\tFacetSpec\x12P\n\tfacet_key\x18\x01 \x01(\x0b\x32\x38.google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKeyB\x03\xe0\x41\x02\x12\r\n\x05limit\x18\x02 \x01(\x05\x12\x1c\n\x14\x65xcluded_filter_keys\x18\x03 \x03(\t\x12\x1f\n\x17\x65nable_dynamic_position\x18\x04 \x01(\x08\x1a\xe3\x01\n\x08\x46\x61\x63\x65tKey\x12\x10\n\x03key\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x33\n\tintervals\x18\x02 \x03(\x0b\x32 .google.cloud.retail.v2.Interval\x12\x19\n\x11restricted_values\x18\x03 \x03(\t\x12\x10\n\x08prefixes\x18\x08 \x03(\t\x12\x10\n\x08\x63ontains\x18\t \x03(\t\x12\x18\n\x10\x63\x61se_insensitive\x18\n \x01(\x08\x12\x10\n\x08order_by\x18\x04 \x01(\t\x12\r\n\x05query\x18\x05 \x01(\t\x12\x16\n\x0ereturn_min_max\x18\x0b \x01(\x08\x1a\x96\x01\n\x10\x44ynamicFacetSpec\x12I\n\x04mode\x18\x01 \x01(\x0e\x32;.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode\"7\n\x04Mode\x12\x14\n\x10MODE_UNSPECIFIED\x10\x00\x12\x0c\n\x08\x44ISABLED\x10\x01\x12\x0b\n\x07\x45NABLED\x10\x02\x1a\xee\x01\n\tBoostSpec\x12\x61\n\x15\x63ondition_boost_specs\x18\x01 \x03(\x0b\x32\x42.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec\x12\'\n\x1askip_boost_spec_validation\x18\x02 \x01(\x08H\x00\x88\x01\x01\x1a\x36\n\x12\x43onditionBoostSpec\x12\x11\n\tcondition\x18\x01 \x01(\t\x12\r\n\x05\x62oost\x18\x02 \x01(\x02\x42\x1d\n\x1b_skip_boost_spec_validation\x1a\xcb\x01\n\x12QueryExpansionSpec\x12U\n\tcondition\x18\x01 \x01(\x0e\x32\x42.google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition\x12\x1e\n\x16pin_unexpanded_results\x18\x02 \x01(\x08\">\n\tCondition\x12\x19\n\x15\x43ONDITION_UNSPECIFIED\x10\x00\x12\x0c\n\x08\x44ISABLED\x10\x01\x12\x08\n\x04\x41UTO\x10\x03\x1a\x99\x01\n\x13PersonalizationSpec\x12L\n\x04mode\x18\x01 \x01(\x0e\x32>.google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode\"4\n\x04Mode\x12\x14\n\x10MODE_UNSPECIFIED\x10\x00\x12\x08\n\x04\x41UTO\x10\x01\x12\x0c\n\x08\x44ISABLED\x10\x02\x1a\xa0\x01\n\x13SpellCorrectionSpec\x12L\n\x04mode\x18\x01 \x01(\x0e\x32>.google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode\";\n\x04Mode\x12\x14\n\x10MODE_UNSPECIFIED\x10\x00\x12\x13\n\x0fSUGGESTION_ONLY\x10\x01\x12\x08\n\x04\x41UTO\x10\x02\x1a\x97\x04\n\x18\x43onversationalSearchSpec\x12\'\n\x1f\x66ollowup_conversation_requested\x18\x01 \x01(\x08\x12\x17\n\x0f\x63onversation_id\x18\x02 \x01(\t\x12^\n\x0buser_answer\x18\x03 \x01(\x0b\x32I.google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec.UserAnswer\x1a\xd8\x02\n\nUserAnswer\x12\x15\n\x0btext_answer\x18\x01 \x01(\tH\x00\x12s\n\x0fselected_answer\x18\x02 \x01(\x0b\x32X.google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec.UserAnswer.SelectedAnswerH\x00\x1a\xb5\x01\n\x0eSelectedAnswer\x12S\n\x18product_attribute_values\x18\x01 \x03(\x0b\x32-.google.cloud.retail.v2.ProductAttributeValueB\x02\x18\x01\x12N\n\x17product_attribute_value\x18\x02 \x01(\x0b\x32-.google.cloud.retail.v2.ProductAttributeValueB\x06\n\x04type\x1al\n\x12TileNavigationSpec\x12!\n\x19tile_navigation_requested\x18\x01 \x01(\x08\x12\x33\n\rapplied_tiles\x18\x02 \x03(\x0b\x32\x1c.google.cloud.retail.v2.Tile\x1a-\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x1aY\n\x13UserAttributesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x31\n\x05value\x18\x02 \x01(\x0b\x32\".google.cloud.retail.v2.StringList:\x02\x38\x01\"[\n\nSearchMode\x12\x1b\n\x17SEARCH_MODE_UNSPECIFIED\x10\x00\x12\x17\n\x13PRODUCT_SEARCH_ONLY\x10\x01\x12\x17\n\x13\x46\x41\x43\x45TED_SEARCH_ONLY\x10\x02\x42\x18\n\x16_spell_correction_spec\"\xa5\x14\n\x0eSearchResponse\x12\x44\n\x07results\x18\x01 \x03(\x0b\x32\x33.google.cloud.retail.v2.SearchResponse.SearchResult\x12<\n\x06\x66\x61\x63\x65ts\x18\x02 \x03(\x0b\x32,.google.cloud.retail.v2.SearchResponse.Facet\x12\x12\n\ntotal_size\x18\x03 \x01(\x05\x12\x17\n\x0f\x63orrected_query\x18\x04 \x01(\t\x12\x19\n\x11\x61ttribution_token\x18\x05 \x01(\t\x12\x17\n\x0fnext_page_token\x18\x06 \x01(\t\x12W\n\x14query_expansion_info\x18\x07 \x01(\x0b\x32\x39.google.cloud.retail.v2.SearchResponse.QueryExpansionInfo\x12\x14\n\x0credirect_uri\x18\n \x01(\t\x12\x18\n\x10\x61pplied_controls\x18\x0c \x03(\t\x12H\n\x14pin_control_metadata\x18\x16 \x01(\x0b\x32*.google.cloud.retail.v2.PinControlMetadata\x12i\n\x1dinvalid_condition_boost_specs\x18\x0e \x03(\x0b\x32\x42.google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec\x12?\n\x0f\x65xperiment_info\x18\x11 \x03(\x0b\x32&.google.cloud.retail.v2.ExperimentInfo\x12g\n\x1c\x63onversational_search_result\x18\x12 \x01(\x0b\x32\x41.google.cloud.retail.v2.SearchResponse.ConversationalSearchResult\x12[\n\x16tile_navigation_result\x18\x13 \x01(\x0b\x32;.google.cloud.retail.v2.SearchResponse.TileNavigationResult\x1a\xc5\x05\n\x0cSearchResult\x12\n\n\x02id\x18\x01 \x01(\t\x12\x30\n\x07product\x18\x02 \x01(\x0b\x32\x1f.google.cloud.retail.v2.Product\x12\x1e\n\x16matching_variant_count\x18\x03 \x01(\x05\x12o\n\x17matching_variant_fields\x18\x04 \x03(\x0b\x32N.google.cloud.retail.v2.SearchResponse.SearchResult.MatchingVariantFieldsEntry\x12k\n\x15variant_rollup_values\x18\x05 \x03(\x0b\x32L.google.cloud.retail.v2.SearchResponse.SearchResult.VariantRollupValuesEntry\x12\x17\n\x0fpersonal_labels\x18\x07 \x03(\t\x12Z\n\x0cmodel_scores\x18\x08 \x03(\x0b\x32\x44.google.cloud.retail.v2.SearchResponse.SearchResult.ModelScoresEntry\x1aX\n\x1aMatchingVariantFieldsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12)\n\x05value\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMask:\x02\x38\x01\x1aR\n\x18VariantRollupValuesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12%\n\x05value\x18\x02 \x01(\x0b\x32\x16.google.protobuf.Value:\x02\x38\x01\x1aV\n\x10ModelScoresEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x31\n\x05value\x18\x02 \x01(\x0b\x32\".google.cloud.retail.v2.DoubleList:\x02\x38\x01\x1a\x8e\x02\n\x05\x46\x61\x63\x65t\x12\x0b\n\x03key\x18\x01 \x01(\t\x12G\n\x06values\x18\x02 \x03(\x0b\x32\x37.google.cloud.retail.v2.SearchResponse.Facet.FacetValue\x12\x15\n\rdynamic_facet\x18\x03 \x01(\x08\x1a\x97\x01\n\nFacetValue\x12\x0f\n\x05value\x18\x01 \x01(\tH\x00\x12\x34\n\x08interval\x18\x02 \x01(\x0b\x32 .google.cloud.retail.v2.IntervalH\x00\x12\r\n\x05\x63ount\x18\x03 \x01(\x03\x12\x11\n\tmin_value\x18\x05 \x01(\x01\x12\x11\n\tmax_value\x18\x06 \x01(\x01\x42\r\n\x0b\x66\x61\x63\x65t_value\x1aI\n\x12QueryExpansionInfo\x12\x16\n\x0e\x65xpanded_query\x18\x01 \x01(\x08\x12\x1b\n\x13pinned_result_count\x18\x02 \x01(\x03\x1a\xff\x04\n\x1a\x43onversationalSearchResult\x12\x17\n\x0f\x63onversation_id\x18\x01 \x01(\t\x12\x15\n\rrefined_query\x18\x02 \x01(\t\x12r\n\x12\x61\x64\x64itional_filters\x18\x03 \x03(\x0b\x32R.google.cloud.retail.v2.SearchResponse.ConversationalSearchResult.AdditionalFilterB\x02\x18\x01\x12\x19\n\x11\x66ollowup_question\x18\x04 \x01(\t\x12l\n\x11suggested_answers\x18\x05 \x03(\x0b\x32Q.google.cloud.retail.v2.SearchResponse.ConversationalSearchResult.SuggestedAnswer\x12m\n\x11\x61\x64\x64itional_filter\x18\x06 \x01(\x0b\x32R.google.cloud.retail.v2.SearchResponse.ConversationalSearchResult.AdditionalFilter\x1a\x61\n\x0fSuggestedAnswer\x12N\n\x17product_attribute_value\x18\x01 \x01(\x0b\x32-.google.cloud.retail.v2.ProductAttributeValue\x1a\x62\n\x10\x41\x64\x64itionalFilter\x12N\n\x17product_attribute_value\x18\x01 \x01(\x0b\x32-.google.cloud.retail.v2.ProductAttributeValue\x1a\x43\n\x14TileNavigationResult\x12+\n\x05tiles\x18\x01 \x03(\x0b\x32\x1c.google.cloud.retail.v2.Tile\"\xfb\x02\n\x0e\x45xperimentInfo\x12\x63\n\x19serving_config_experiment\x18\x02 \x01(\x0b\x32>.google.cloud.retail.v2.ExperimentInfo.ServingConfigExperimentH\x00\x12\x39\n\nexperiment\x18\x01 \x01(\tB%\xfa\x41\"\n retail.googleapis.com/Experiment\x1a\xb1\x01\n\x17ServingConfigExperiment\x12I\n\x17original_serving_config\x18\x01 \x01(\tB(\xfa\x41%\n#retail.googleapis.com/ServingConfig\x12K\n\x19\x65xperiment_serving_config\x18\x02 \x01(\tB(\xfa\x41%\n#retail.googleapis.com/ServingConfigB\x15\n\x13\x65xperiment_metadata2\xd8\x02\n\rSearchService\x12\xfb\x01\n\x06Search\x12%.google.cloud.retail.v2.SearchRequest\x1a&.google.cloud.retail.v2.SearchResponse\"\xa1\x01\x82\xd3\xe4\x93\x02\x9a\x01\"E/v2/{placement=projects/*/locations/*/catalogs/*/placements/*}:search:\x01*ZN\"I/v2/{placement=projects/*/locations/*/catalogs/*/servingConfigs/*}:search:\x01*\x1aI\xca\x41\x15retail.googleapis.com\xd2\x41.https://www.googleapis.com/auth/cloud-platformB\xb7\x02\n\x1a\x63om.google.cloud.retail.v2B\x12SearchServiceProtoP\x01Z2cloud.google.com/go/retail/apiv2/retailpb;retailpb\xa2\x02\x06RETAIL\xaa\x02\x16Google.Cloud.Retail.V2\xca\x02\x16Google\\Cloud\\Retail\\V2\xea\x02\x19Google::Cloud::Retail::V2\xea\x41w\n retail.googleapis.com/Experiment\x12Sprojects/{project}/locations/{location}/catalogs/{catalog}/experiments/{experiment}b\x06proto3" - -pool = ::Google::Protobuf::DescriptorPool.generated_pool -pool.add_serialized_file(descriptor_data) - -module Google - module Cloud - module Retail - module V2 - ProductAttributeValue = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ProductAttributeValue").msgclass - ProductAttributeInterval = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ProductAttributeInterval").msgclass - Tile = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.Tile").msgclass - SearchRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchRequest").msgclass - SearchRequest::FacetSpec = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchRequest.FacetSpec").msgclass - SearchRequest::FacetSpec::FacetKey = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey").msgclass - SearchRequest::DynamicFacetSpec = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchRequest.DynamicFacetSpec").msgclass - SearchRequest::DynamicFacetSpec::Mode = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode").enummodule - SearchRequest::BoostSpec = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchRequest.BoostSpec").msgclass - SearchRequest::BoostSpec::ConditionBoostSpec = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec").msgclass - SearchRequest::QueryExpansionSpec = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchRequest.QueryExpansionSpec").msgclass - SearchRequest::QueryExpansionSpec::Condition = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition").enummodule - SearchRequest::PersonalizationSpec = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchRequest.PersonalizationSpec").msgclass - SearchRequest::PersonalizationSpec::Mode = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode").enummodule - SearchRequest::SpellCorrectionSpec = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec").msgclass - SearchRequest::SpellCorrectionSpec::Mode = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode").enummodule - SearchRequest::ConversationalSearchSpec = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec").msgclass - SearchRequest::ConversationalSearchSpec::UserAnswer = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec.UserAnswer").msgclass - SearchRequest::ConversationalSearchSpec::UserAnswer::SelectedAnswer = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec.UserAnswer.SelectedAnswer").msgclass - SearchRequest::TileNavigationSpec = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchRequest.TileNavigationSpec").msgclass - SearchRequest::SearchMode = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchRequest.SearchMode").enummodule - SearchResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchResponse").msgclass - SearchResponse::SearchResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchResponse.SearchResult").msgclass - SearchResponse::Facet = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchResponse.Facet").msgclass - SearchResponse::Facet::FacetValue = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchResponse.Facet.FacetValue").msgclass - SearchResponse::QueryExpansionInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchResponse.QueryExpansionInfo").msgclass - SearchResponse::ConversationalSearchResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchResponse.ConversationalSearchResult").msgclass - SearchResponse::ConversationalSearchResult::SuggestedAnswer = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchResponse.ConversationalSearchResult.SuggestedAnswer").msgclass - SearchResponse::ConversationalSearchResult::AdditionalFilter = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchResponse.ConversationalSearchResult.AdditionalFilter").msgclass - SearchResponse::TileNavigationResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.SearchResponse.TileNavigationResult").msgclass - ExperimentInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ExperimentInfo").msgclass - ExperimentInfo::ServingConfigExperiment = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ExperimentInfo.ServingConfigExperiment").msgclass - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service_services_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service_services_pb.rb deleted file mode 100644 index 48bf05ab1516..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/search_service_services_pb.rb +++ /dev/null @@ -1,51 +0,0 @@ -# Generated by the protocol buffer compiler. DO NOT EDIT! -# Source: google/cloud/retail/v2/search_service.proto for package 'Google.Cloud.Retail.V2' -# Original file comments: -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -require 'grpc' -require 'google/cloud/retail/v2/search_service_pb' - -module Google - module Cloud - module Retail - module V2 - module SearchService - # Service for search. - # - # This feature is only available for users who have Retail Search enabled. - # Enable Retail Search on Cloud Console before using this feature. - class Service - - include ::GRPC::GenericService - - self.marshal_class_method = :encode - self.unmarshal_class_method = :decode - self.service_name = 'google.cloud.retail.v2.SearchService' - - # Performs a search. - # - # This feature is only available for users who have Retail Search enabled. - # Enable Retail Search on Cloud Console before using this feature. - rpc :Search, ::Google::Cloud::Retail::V2::SearchRequest, ::Google::Cloud::Retail::V2::SearchResponse - end - - Stub = Service.rpc_stub_class - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_pb.rb deleted file mode 100644 index 151bee6ebbef..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_pb.rb +++ /dev/null @@ -1,27 +0,0 @@ -# frozen_string_literal: true -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/retail/v2/serving_config.proto - -require 'google/protobuf' - -require 'google/api/field_behavior_pb' -require 'google/api/resource_pb' -require 'google/cloud/retail/v2/common_pb' -require 'google/cloud/retail/v2/search_service_pb' - - -descriptor_data = "\n+google/cloud/retail/v2/serving_config.proto\x12\x16google.cloud.retail.v2\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a#google/cloud/retail/v2/common.proto\x1a+google/cloud/retail/v2/search_service.proto\"\x96\x08\n\rServingConfig\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x05\x12\x19\n\x0c\x64isplay_name\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\x10\n\x08model_id\x18\x03 \x01(\t\x12\x1d\n\x15price_reranking_level\x18\x04 \x01(\t\x12\x19\n\x11\x66\x61\x63\x65t_control_ids\x18\x05 \x03(\t\x12R\n\x12\x64ynamic_facet_spec\x18\x06 \x01(\x0b\x32\x36.google.cloud.retail.v2.SearchRequest.DynamicFacetSpec\x12\x19\n\x11\x62oost_control_ids\x18\x07 \x03(\t\x12\x1a\n\x12\x66ilter_control_ids\x18\t \x03(\t\x12\x1c\n\x14redirect_control_ids\x18\n \x03(\t\x12#\n\x1btwoway_synonyms_control_ids\x18\x12 \x03(\t\x12#\n\x1boneway_synonyms_control_ids\x18\x0c \x03(\t\x12$\n\x1c\x64o_not_associate_control_ids\x18\r \x03(\t\x12\x1f\n\x17replacement_control_ids\x18\x0e \x03(\t\x12\x1a\n\x12ignore_control_ids\x18\x0f \x03(\t\x12\x17\n\x0f\x64iversity_level\x18\x08 \x01(\t\x12K\n\x0e\x64iversity_type\x18\x14 \x01(\x0e\x32\x33.google.cloud.retail.v2.ServingConfig.DiversityType\x12$\n\x1c\x65nable_category_filter_level\x18\x10 \x01(\t\x12\x1c\n\x14ignore_recs_denylist\x18\x18 \x01(\x08\x12W\n\x14personalization_spec\x18\x15 \x01(\x0b\x32\x39.google.cloud.retail.v2.SearchRequest.PersonalizationSpec\x12\x44\n\x0esolution_types\x18\x13 \x03(\x0e\x32$.google.cloud.retail.v2.SolutionTypeB\x06\xe0\x41\x02\xe0\x41\x05\"d\n\rDiversityType\x12\x1e\n\x1a\x44IVERSITY_TYPE_UNSPECIFIED\x10\x00\x12\x18\n\x14RULE_BASED_DIVERSITY\x10\x02\x12\x19\n\x15\x44\x41TA_DRIVEN_DIVERSITY\x10\x03:\x85\x01\xea\x41\x81\x01\n#retail.googleapis.com/ServingConfig\x12Zprojects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}B\xbd\x01\n\x1a\x63om.google.cloud.retail.v2B\x12ServingConfigProtoP\x01Z2cloud.google.com/go/retail/apiv2/retailpb;retailpb\xa2\x02\x06RETAIL\xaa\x02\x16Google.Cloud.Retail.V2\xca\x02\x16Google\\Cloud\\Retail\\V2\xea\x02\x19Google::Cloud::Retail::V2b\x06proto3" - -pool = ::Google::Protobuf::DescriptorPool.generated_pool -pool.add_serialized_file(descriptor_data) - -module Google - module Cloud - module Retail - module V2 - ServingConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ServingConfig").msgclass - ServingConfig::DiversityType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ServingConfig.DiversityType").enummodule - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service.rb deleted file mode 100644 index 4a0503a4322d..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service.rb +++ /dev/null @@ -1,55 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "gapic/common" -require "gapic/config" -require "gapic/config/method" - -require "google/cloud/retail/v2/version" - -require "google/cloud/retail/v2/serving_config_service/credentials" -require "google/cloud/retail/v2/serving_config_service/paths" -require "google/cloud/retail/v2/serving_config_service/client" -require "google/cloud/retail/v2/serving_config_service/rest" - -module Google - module Cloud - module Retail - module V2 - ## - # Service for modifying ServingConfig. - # - # @example Load this service and instantiate a gRPC client - # - # require "google/cloud/retail/v2/serving_config_service" - # client = ::Google::Cloud::Retail::V2::ServingConfigService::Client.new - # - # @example Load this service and instantiate a REST client - # - # require "google/cloud/retail/v2/serving_config_service/rest" - # client = ::Google::Cloud::Retail::V2::ServingConfigService::Rest::Client.new - # - module ServingConfigService - end - end - end - end -end - -helper_path = ::File.join __dir__, "serving_config_service", "helpers.rb" -require "google/cloud/retail/v2/serving_config_service/helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/client.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/client.rb deleted file mode 100644 index 1baa4825c690..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/client.rb +++ /dev/null @@ -1,1102 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "google/cloud/errors" -require "google/cloud/retail/v2/serving_config_service_pb" -require "google/cloud/location" - -module Google - module Cloud - module Retail - module V2 - module ServingConfigService - ## - # Client for the ServingConfigService service. - # - # Service for modifying ServingConfig. - # - class Client - # @private - API_VERSION = "" - - # @private - DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" - - include Paths - - # @private - attr_reader :serving_config_service_stub - - ## - # Configure the ServingConfigService Client class. - # - # See {::Google::Cloud::Retail::V2::ServingConfigService::Client::Configuration} - # for a description of the configuration fields. - # - # @example - # - # # Modify the configuration for all ServingConfigService clients - # ::Google::Cloud::Retail::V2::ServingConfigService::Client.configure do |config| - # config.timeout = 10.0 - # end - # - # @yield [config] Configure the Client client. - # @yieldparam config [Client::Configuration] - # - # @return [Client::Configuration] - # - def self.configure - @configure ||= begin - namespace = ["Google", "Cloud", "Retail", "V2"] - parent_config = while namespace.any? - parent_name = namespace.join "::" - parent_const = const_get parent_name - break parent_const.configure if parent_const.respond_to? :configure - namespace.pop - end - default_config = Client::Configuration.new parent_config - - default_config - end - yield @configure if block_given? - @configure - end - - ## - # Configure the ServingConfigService Client instance. - # - # The configuration is set to the derived mode, meaning that values can be changed, - # but structural changes (adding new fields, etc.) are not allowed. Structural changes - # should be made on {Client.configure}. - # - # See {::Google::Cloud::Retail::V2::ServingConfigService::Client::Configuration} - # for a description of the configuration fields. - # - # @yield [config] Configure the Client client. - # @yieldparam config [Client::Configuration] - # - # @return [Client::Configuration] - # - def configure - yield @config if block_given? - @config - end - - ## - # The effective universe domain - # - # @return [String] - # - def universe_domain - @serving_config_service_stub.universe_domain - end - - ## - # Create a new ServingConfigService client object. - # - # @example - # - # # Create a client using the default configuration - # client = ::Google::Cloud::Retail::V2::ServingConfigService::Client.new - # - # # Create a client using a custom configuration - # client = ::Google::Cloud::Retail::V2::ServingConfigService::Client.new do |config| - # config.timeout = 10.0 - # end - # - # @yield [config] Configure the ServingConfigService client. - # @yieldparam config [Client::Configuration] - # - def initialize - # These require statements are intentionally placed here to initialize - # the gRPC module only when it's required. - # See https://github.com/googleapis/toolkit/issues/446 - require "gapic/grpc" - require "google/cloud/retail/v2/serving_config_service_services_pb" - - # Create the configuration object - @config = Configuration.new Client.configure - - # Yield the configuration if needed - yield @config if block_given? - - # Create credentials - credentials = @config.credentials - # Use self-signed JWT if the endpoint is unchanged from default, - # but only if the default endpoint does not have a region prefix. - enable_self_signed_jwt = @config.endpoint.nil? || - (@config.endpoint == Configuration::DEFAULT_ENDPOINT && - !@config.endpoint.split(".").first.include?("-")) - credentials ||= Credentials.default scope: @config.scope, - enable_self_signed_jwt: enable_self_signed_jwt - if credentials.is_a?(::String) || credentials.is_a?(::Hash) - credentials = Credentials.new credentials, scope: @config.scope - end - @quota_project_id = @config.quota_project - @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id - - @serving_config_service_stub = ::Gapic::ServiceStub.new( - ::Google::Cloud::Retail::V2::ServingConfigService::Stub, - credentials: credentials, - endpoint: @config.endpoint, - endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, - universe_domain: @config.universe_domain, - channel_args: @config.channel_args, - interceptors: @config.interceptors, - channel_pool_config: @config.channel_pool, - logger: @config.logger - ) - - @serving_config_service_stub.stub_logger&.info do |entry| - entry.set_system_name - entry.set_service - entry.message = "Created client for #{entry.service}" - entry.set_credentials_fields credentials - entry.set "customEndpoint", @config.endpoint if @config.endpoint - entry.set "defaultTimeout", @config.timeout if @config.timeout - entry.set "quotaProject", @quota_project_id if @quota_project_id - end - - @location_client = Google::Cloud::Location::Locations::Client.new do |config| - config.credentials = credentials - config.quota_project = @quota_project_id - config.endpoint = @serving_config_service_stub.endpoint - config.universe_domain = @serving_config_service_stub.universe_domain - config.logger = @serving_config_service_stub.logger if config.respond_to? :logger= - end - end - - ## - # Get the associated client for mix-in of the Locations. - # - # @return [Google::Cloud::Location::Locations::Client] - # - attr_reader :location_client - - ## - # The logger used for request/response debug logging. - # - # @return [Logger] - # - def logger - @serving_config_service_stub.logger - end - - # Service calls - - ## - # Creates a ServingConfig. - # - # A maximum of 100 {::Google::Cloud::Retail::V2::ServingConfig ServingConfig}s are - # allowed in a {::Google::Cloud::Retail::V2::Catalog Catalog}, otherwise a - # FAILED_PRECONDITION error is returned. - # - # @overload create_serving_config(request, options = nil) - # Pass arguments to `create_serving_config` via a request object, either of type - # {::Google::Cloud::Retail::V2::CreateServingConfigRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::CreateServingConfigRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload create_serving_config(parent: nil, serving_config: nil, serving_config_id: nil) - # Pass arguments to `create_serving_config` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. Full resource name of parent. Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - # @param serving_config [::Google::Cloud::Retail::V2::ServingConfig, ::Hash] - # Required. The ServingConfig to create. - # @param serving_config_id [::String] - # Required. The ID to use for the ServingConfig, which will become the final - # component of the ServingConfig's resource name. - # - # This value should be 4-63 characters, and valid characters - # are /[a-z][0-9]-_/. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Cloud::Retail::V2::ServingConfig] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Cloud::Retail::V2::ServingConfig] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ServingConfigService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::CreateServingConfigRequest.new - # - # # Call the create_serving_config method. - # result = client.create_serving_config request - # - # # The returned object is of type Google::Cloud::Retail::V2::ServingConfig. - # p result - # - def create_serving_config request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::CreateServingConfigRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.create_serving_config.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.parent - header_params["parent"] = request.parent - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.create_serving_config.timeout, - metadata: metadata, - retry_policy: @config.rpcs.create_serving_config.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @serving_config_service_stub.call_rpc :create_serving_config, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Deletes a ServingConfig. - # - # Returns a NotFound error if the ServingConfig does not exist. - # - # @overload delete_serving_config(request, options = nil) - # Pass arguments to `delete_serving_config` via a request object, either of type - # {::Google::Cloud::Retail::V2::DeleteServingConfigRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::DeleteServingConfigRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload delete_serving_config(name: nil) - # Pass arguments to `delete_serving_config` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # Required. The resource name of the ServingConfig to delete. Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Protobuf::Empty] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Protobuf::Empty] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ServingConfigService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::DeleteServingConfigRequest.new - # - # # Call the delete_serving_config method. - # result = client.delete_serving_config request - # - # # The returned object is of type Google::Protobuf::Empty. - # p result - # - def delete_serving_config request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::DeleteServingConfigRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.delete_serving_config.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.name - header_params["name"] = request.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.delete_serving_config.timeout, - metadata: metadata, - retry_policy: @config.rpcs.delete_serving_config.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @serving_config_service_stub.call_rpc :delete_serving_config, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Updates a ServingConfig. - # - # @overload update_serving_config(request, options = nil) - # Pass arguments to `update_serving_config` via a request object, either of type - # {::Google::Cloud::Retail::V2::UpdateServingConfigRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::UpdateServingConfigRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload update_serving_config(serving_config: nil, update_mask: nil) - # Pass arguments to `update_serving_config` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param serving_config [::Google::Cloud::Retail::V2::ServingConfig, ::Hash] - # Required. The ServingConfig to update. - # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] - # Indicates which fields in the provided - # {::Google::Cloud::Retail::V2::ServingConfig ServingConfig} to update. The - # following are NOT supported: - # - # * {::Google::Cloud::Retail::V2::ServingConfig#name ServingConfig.name} - # - # If not set, all supported fields are updated. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Cloud::Retail::V2::ServingConfig] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Cloud::Retail::V2::ServingConfig] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ServingConfigService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::UpdateServingConfigRequest.new - # - # # Call the update_serving_config method. - # result = client.update_serving_config request - # - # # The returned object is of type Google::Cloud::Retail::V2::ServingConfig. - # p result - # - def update_serving_config request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::UpdateServingConfigRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.update_serving_config.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.serving_config&.name - header_params["serving_config.name"] = request.serving_config.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.update_serving_config.timeout, - metadata: metadata, - retry_policy: @config.rpcs.update_serving_config.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @serving_config_service_stub.call_rpc :update_serving_config, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Gets a ServingConfig. - # - # Returns a NotFound error if the ServingConfig does not exist. - # - # @overload get_serving_config(request, options = nil) - # Pass arguments to `get_serving_config` via a request object, either of type - # {::Google::Cloud::Retail::V2::GetServingConfigRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::GetServingConfigRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload get_serving_config(name: nil) - # Pass arguments to `get_serving_config` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # Required. The resource name of the ServingConfig to get. Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Cloud::Retail::V2::ServingConfig] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Cloud::Retail::V2::ServingConfig] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ServingConfigService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::GetServingConfigRequest.new - # - # # Call the get_serving_config method. - # result = client.get_serving_config request - # - # # The returned object is of type Google::Cloud::Retail::V2::ServingConfig. - # p result - # - def get_serving_config request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::GetServingConfigRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.get_serving_config.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.name - header_params["name"] = request.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.get_serving_config.timeout, - metadata: metadata, - retry_policy: @config.rpcs.get_serving_config.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @serving_config_service_stub.call_rpc :get_serving_config, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Lists all ServingConfigs linked to this catalog. - # - # @overload list_serving_configs(request, options = nil) - # Pass arguments to `list_serving_configs` via a request object, either of type - # {::Google::Cloud::Retail::V2::ListServingConfigsRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::ListServingConfigsRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload list_serving_configs(parent: nil, page_size: nil, page_token: nil) - # Pass arguments to `list_serving_configs` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. The catalog resource name. Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - # @param page_size [::Integer] - # Optional. Maximum number of results to return. If unspecified, defaults - # to 100. If a value greater than 100 is provided, at most 100 results are - # returned. - # @param page_token [::String] - # Optional. A page token, received from a previous `ListServingConfigs` call. - # Provide this to retrieve the subsequent page. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Retail::V2::ServingConfig>] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::PagedEnumerable<::Google::Cloud::Retail::V2::ServingConfig>] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ServingConfigService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::ListServingConfigsRequest.new - # - # # Call the list_serving_configs method. - # result = client.list_serving_configs request - # - # # The returned object is of type Gapic::PagedEnumerable. You can iterate - # # over elements, and API calls will be issued to fetch pages as needed. - # result.each do |item| - # # Each element is of type ::Google::Cloud::Retail::V2::ServingConfig. - # p item - # end - # - def list_serving_configs request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ListServingConfigsRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.list_serving_configs.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.parent - header_params["parent"] = request.parent - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.list_serving_configs.timeout, - metadata: metadata, - retry_policy: @config.rpcs.list_serving_configs.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @serving_config_service_stub.call_rpc :list_serving_configs, request, options: options do |response, operation| - response = ::Gapic::PagedEnumerable.new @serving_config_service_stub, :list_serving_configs, request, response, operation, options - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Enables a Control on the specified ServingConfig. - # The control is added in the last position of the list of controls - # it belongs to (e.g. if it's a facet spec control it will be applied - # in the last position of servingConfig.facetSpecIds) - # Returns a ALREADY_EXISTS error if the control has already been applied. - # Returns a FAILED_PRECONDITION error if the addition could exceed maximum - # number of control allowed for that type of control. - # - # @overload add_control(request, options = nil) - # Pass arguments to `add_control` via a request object, either of type - # {::Google::Cloud::Retail::V2::AddControlRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::AddControlRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload add_control(serving_config: nil, control_id: nil) - # Pass arguments to `add_control` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param serving_config [::String] - # Required. The source ServingConfig resource name . Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` - # @param control_id [::String] - # Required. The id of the control to apply. Assumed to be in the same catalog - # as the serving config - if id is not found a NOT_FOUND error is returned. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Cloud::Retail::V2::ServingConfig] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Cloud::Retail::V2::ServingConfig] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ServingConfigService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::AddControlRequest.new - # - # # Call the add_control method. - # result = client.add_control request - # - # # The returned object is of type Google::Cloud::Retail::V2::ServingConfig. - # p result - # - def add_control request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::AddControlRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.add_control.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.serving_config - header_params["serving_config"] = request.serving_config - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.add_control.timeout, - metadata: metadata, - retry_policy: @config.rpcs.add_control.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @serving_config_service_stub.call_rpc :add_control, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Disables a Control on the specified ServingConfig. - # The control is removed from the ServingConfig. - # Returns a NOT_FOUND error if the Control is not enabled for the - # ServingConfig. - # - # @overload remove_control(request, options = nil) - # Pass arguments to `remove_control` via a request object, either of type - # {::Google::Cloud::Retail::V2::RemoveControlRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::RemoveControlRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload remove_control(serving_config: nil, control_id: nil) - # Pass arguments to `remove_control` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param serving_config [::String] - # Required. The source ServingConfig resource name . Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` - # @param control_id [::String] - # Required. The id of the control to apply. Assumed to be in the same catalog - # as the serving config. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Cloud::Retail::V2::ServingConfig] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Cloud::Retail::V2::ServingConfig] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ServingConfigService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::RemoveControlRequest.new - # - # # Call the remove_control method. - # result = client.remove_control request - # - # # The returned object is of type Google::Cloud::Retail::V2::ServingConfig. - # p result - # - def remove_control request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::RemoveControlRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.remove_control.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.serving_config - header_params["serving_config"] = request.serving_config - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.remove_control.timeout, - metadata: metadata, - retry_policy: @config.rpcs.remove_control.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @serving_config_service_stub.call_rpc :remove_control, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Configuration class for the ServingConfigService API. - # - # This class represents the configuration for ServingConfigService, - # providing control over timeouts, retry behavior, logging, transport - # parameters, and other low-level controls. Certain parameters can also be - # applied individually to specific RPCs. See - # {::Google::Cloud::Retail::V2::ServingConfigService::Client::Configuration::Rpcs} - # for a list of RPCs that can be configured independently. - # - # Configuration can be applied globally to all clients, or to a single client - # on construction. - # - # @example - # - # # Modify the global config, setting the timeout for - # # create_serving_config to 20 seconds, - # # and all remaining timeouts to 10 seconds. - # ::Google::Cloud::Retail::V2::ServingConfigService::Client.configure do |config| - # config.timeout = 10.0 - # config.rpcs.create_serving_config.timeout = 20.0 - # end - # - # # Apply the above configuration only to a new client. - # client = ::Google::Cloud::Retail::V2::ServingConfigService::Client.new do |config| - # config.timeout = 10.0 - # config.rpcs.create_serving_config.timeout = 20.0 - # end - # - # @!attribute [rw] endpoint - # A custom service endpoint, as a hostname or hostname:port. The default is - # nil, indicating to use the default endpoint in the current universe domain. - # @return [::String,nil] - # @!attribute [rw] credentials - # Credentials to send with calls. You may provide any of the following types: - # * (`Google::Auth::Credentials`) A googleauth credentials object - # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) - # * (`Signet::OAuth2::Client`) A signet oauth2 client object - # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) - # * (`GRPC::Core::Channel`) a gRPC channel with included credentials - # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object - # * (`nil`) indicating no credentials - # - # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials - # is deprecated. Providing an unvalidated credential configuration to - # Google APIs can compromise the security of your systems and data. - # - # @example - # - # # The recommended way to provide credentials is to use the `make_creds` method - # # on the appropriate credentials class for your environment. - # - # require "googleauth" - # - # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds( - # json_key_io: ::File.open("/path/to/keyfile.json") - # ) - # - # client = ::Google::Cloud::Retail::V2::ServingConfigService::Client.new do |config| - # config.credentials = credentials - # end - # - # @note Warning: If you accept a credential configuration (JSON file or Hash) from an - # external source for authentication to Google Cloud, you must validate it before - # providing it to a Google API client library. Providing an unvalidated credential - # configuration to Google APIs can compromise the security of your systems and data. - # For more information, refer to [Validate credential configurations from external - # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). - # @return [::Object] - # @!attribute [rw] scope - # The OAuth scopes - # @return [::Array<::String>] - # @!attribute [rw] lib_name - # The library name as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] lib_version - # The library version as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] channel_args - # Extra parameters passed to the gRPC channel. Note: this is ignored if a - # `GRPC::Core::Channel` object is provided as the credential. - # @return [::Hash] - # @!attribute [rw] interceptors - # An array of interceptors that are run before calls are executed. - # @return [::Array<::GRPC::ClientInterceptor>] - # @!attribute [rw] timeout - # The call timeout in seconds. - # @return [::Numeric] - # @!attribute [rw] metadata - # Additional gRPC headers to be sent with the call. - # @return [::Hash{::Symbol=>::String}] - # @!attribute [rw] retry_policy - # The retry policy. The value is a hash with the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # @return [::Hash] - # @!attribute [rw] quota_project - # A separate project against which to charge quota. - # @return [::String] - # @!attribute [rw] universe_domain - # The universe domain within which to make requests. This determines the - # default endpoint URL. The default value of nil uses the environment - # universe (usually the default "googleapis.com" universe). - # @return [::String,nil] - # @!attribute [rw] logger - # A custom logger to use for request/response debug logging, or the value - # `:default` (the default) to construct a default logger, or `nil` to - # explicitly disable logging. - # @return [::Logger,:default,nil] - # - class Configuration - extend ::Gapic::Config - - # @private - # The endpoint specific to the default "googleapis.com" universe. Deprecated. - DEFAULT_ENDPOINT = "retail.googleapis.com" - - config_attr :endpoint, nil, ::String, nil - config_attr :credentials, nil do |value| - allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] - allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel - allowed.any? { |klass| klass === value } - end - config_attr :scope, nil, ::String, ::Array, nil - config_attr :lib_name, nil, ::String, nil - config_attr :lib_version, nil, ::String, nil - config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) - config_attr :interceptors, nil, ::Array, nil - config_attr :timeout, nil, ::Numeric, nil - config_attr :metadata, nil, ::Hash, nil - config_attr :retry_policy, nil, ::Hash, ::Proc, nil - config_attr :quota_project, nil, ::String, nil - config_attr :universe_domain, nil, ::String, nil - config_attr :logger, :default, ::Logger, nil, :default - - # @private - def initialize parent_config = nil - @parent_config = parent_config unless parent_config.nil? - - yield self if block_given? - end - - ## - # Configurations for individual RPCs - # @return [Rpcs] - # - def rpcs - @rpcs ||= begin - parent_rpcs = nil - parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) - Rpcs.new parent_rpcs - end - end - - ## - # Configuration for the channel pool - # @return [::Gapic::ServiceStub::ChannelPool::Configuration] - # - def channel_pool - @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new - end - - ## - # Configuration RPC class for the ServingConfigService API. - # - # Includes fields providing the configuration for each RPC in this service. - # Each configuration object is of type `Gapic::Config::Method` and includes - # the following configuration fields: - # - # * `timeout` (*type:* `Numeric`) - The call timeout in seconds - # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers - # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields - # include the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # - class Rpcs - ## - # RPC-specific configuration for `create_serving_config` - # @return [::Gapic::Config::Method] - # - attr_reader :create_serving_config - ## - # RPC-specific configuration for `delete_serving_config` - # @return [::Gapic::Config::Method] - # - attr_reader :delete_serving_config - ## - # RPC-specific configuration for `update_serving_config` - # @return [::Gapic::Config::Method] - # - attr_reader :update_serving_config - ## - # RPC-specific configuration for `get_serving_config` - # @return [::Gapic::Config::Method] - # - attr_reader :get_serving_config - ## - # RPC-specific configuration for `list_serving_configs` - # @return [::Gapic::Config::Method] - # - attr_reader :list_serving_configs - ## - # RPC-specific configuration for `add_control` - # @return [::Gapic::Config::Method] - # - attr_reader :add_control - ## - # RPC-specific configuration for `remove_control` - # @return [::Gapic::Config::Method] - # - attr_reader :remove_control - - # @private - def initialize parent_rpcs = nil - create_serving_config_config = parent_rpcs.create_serving_config if parent_rpcs.respond_to? :create_serving_config - @create_serving_config = ::Gapic::Config::Method.new create_serving_config_config - delete_serving_config_config = parent_rpcs.delete_serving_config if parent_rpcs.respond_to? :delete_serving_config - @delete_serving_config = ::Gapic::Config::Method.new delete_serving_config_config - update_serving_config_config = parent_rpcs.update_serving_config if parent_rpcs.respond_to? :update_serving_config - @update_serving_config = ::Gapic::Config::Method.new update_serving_config_config - get_serving_config_config = parent_rpcs.get_serving_config if parent_rpcs.respond_to? :get_serving_config - @get_serving_config = ::Gapic::Config::Method.new get_serving_config_config - list_serving_configs_config = parent_rpcs.list_serving_configs if parent_rpcs.respond_to? :list_serving_configs - @list_serving_configs = ::Gapic::Config::Method.new list_serving_configs_config - add_control_config = parent_rpcs.add_control if parent_rpcs.respond_to? :add_control - @add_control = ::Gapic::Config::Method.new add_control_config - remove_control_config = parent_rpcs.remove_control if parent_rpcs.respond_to? :remove_control - @remove_control = ::Gapic::Config::Method.new remove_control_config - - yield self if block_given? - end - end - end - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/credentials.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/credentials.rb deleted file mode 100644 index c42ba1c10eee..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/credentials.rb +++ /dev/null @@ -1,51 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "googleauth" - -module Google - module Cloud - module Retail - module V2 - module ServingConfigService - # Credentials for the ServingConfigService API. - class Credentials < ::Google::Auth::Credentials - self.scope = [ - "https://www.googleapis.com/auth/cloud-platform" - ] - self.env_vars = [ - "RETAIL_CREDENTIALS", - "RETAIL_KEYFILE", - "GOOGLE_CLOUD_CREDENTIALS", - "GOOGLE_CLOUD_KEYFILE", - "GCLOUD_KEYFILE", - "RETAIL_CREDENTIALS_JSON", - "RETAIL_KEYFILE_JSON", - "GOOGLE_CLOUD_CREDENTIALS_JSON", - "GOOGLE_CLOUD_KEYFILE_JSON", - "GCLOUD_KEYFILE_JSON" - ] - self.paths = [ - "~/.config/google_cloud/application_default_credentials.json" - ] - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/paths.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/paths.rb deleted file mode 100644 index bb9d885a6589..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/paths.rb +++ /dev/null @@ -1,73 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Cloud - module Retail - module V2 - module ServingConfigService - # Path helper methods for the ServingConfigService API. - module Paths - ## - # Create a fully-qualified Catalog resource string. - # - # The resource will be in the following format: - # - # `projects/{project}/locations/{location}/catalogs/{catalog}` - # - # @param project [String] - # @param location [String] - # @param catalog [String] - # - # @return [::String] - def catalog_path project:, location:, catalog: - raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" - raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" - - "projects/#{project}/locations/#{location}/catalogs/#{catalog}" - end - - ## - # Create a fully-qualified ServingConfig resource string. - # - # The resource will be in the following format: - # - # `projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}` - # - # @param project [String] - # @param location [String] - # @param catalog [String] - # @param serving_config [String] - # - # @return [::String] - def serving_config_path project:, location:, catalog:, serving_config: - raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" - raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" - raise ::ArgumentError, "catalog cannot contain /" if catalog.to_s.include? "/" - - "projects/#{project}/locations/#{location}/catalogs/#{catalog}/servingConfigs/#{serving_config}" - end - - extend self - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/rest.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/rest.rb deleted file mode 100644 index f2b31df2bbc7..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/rest.rb +++ /dev/null @@ -1,52 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "gapic/rest" -require "gapic/config" -require "gapic/config/method" - -require "google/cloud/retail/v2/version" - -require "google/cloud/retail/v2/serving_config_service/credentials" -require "google/cloud/retail/v2/serving_config_service/paths" -require "google/cloud/retail/v2/serving_config_service/rest/client" - -module Google - module Cloud - module Retail - module V2 - ## - # Service for modifying ServingConfig. - # - # To load this service and instantiate a REST client: - # - # require "google/cloud/retail/v2/serving_config_service/rest" - # client = ::Google::Cloud::Retail::V2::ServingConfigService::Rest::Client.new - # - module ServingConfigService - # Client for the REST transport - module Rest - end - end - end - end - end -end - -helper_path = ::File.join __dir__, "rest", "helpers.rb" -require "google/cloud/retail/v2/serving_config_service/rest/helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/rest/client.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/rest/client.rb deleted file mode 100644 index 6974da79ed98..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/rest/client.rb +++ /dev/null @@ -1,1010 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "google/cloud/errors" -require "google/cloud/retail/v2/serving_config_service_pb" -require "google/cloud/retail/v2/serving_config_service/rest/service_stub" -require "google/cloud/location/rest" - -module Google - module Cloud - module Retail - module V2 - module ServingConfigService - module Rest - ## - # REST client for the ServingConfigService service. - # - # Service for modifying ServingConfig. - # - class Client - # @private - API_VERSION = "" - - # @private - DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" - - include Paths - - # @private - attr_reader :serving_config_service_stub - - ## - # Configure the ServingConfigService Client class. - # - # See {::Google::Cloud::Retail::V2::ServingConfigService::Rest::Client::Configuration} - # for a description of the configuration fields. - # - # @example - # - # # Modify the configuration for all ServingConfigService clients - # ::Google::Cloud::Retail::V2::ServingConfigService::Rest::Client.configure do |config| - # config.timeout = 10.0 - # end - # - # @yield [config] Configure the Client client. - # @yieldparam config [Client::Configuration] - # - # @return [Client::Configuration] - # - def self.configure - @configure ||= begin - namespace = ["Google", "Cloud", "Retail", "V2"] - parent_config = while namespace.any? - parent_name = namespace.join "::" - parent_const = const_get parent_name - break parent_const.configure if parent_const.respond_to? :configure - namespace.pop - end - default_config = Client::Configuration.new parent_config - - default_config - end - yield @configure if block_given? - @configure - end - - ## - # Configure the ServingConfigService Client instance. - # - # The configuration is set to the derived mode, meaning that values can be changed, - # but structural changes (adding new fields, etc.) are not allowed. Structural changes - # should be made on {Client.configure}. - # - # See {::Google::Cloud::Retail::V2::ServingConfigService::Rest::Client::Configuration} - # for a description of the configuration fields. - # - # @yield [config] Configure the Client client. - # @yieldparam config [Client::Configuration] - # - # @return [Client::Configuration] - # - def configure - yield @config if block_given? - @config - end - - ## - # The effective universe domain - # - # @return [String] - # - def universe_domain - @serving_config_service_stub.universe_domain - end - - ## - # Create a new ServingConfigService REST client object. - # - # @example - # - # # Create a client using the default configuration - # client = ::Google::Cloud::Retail::V2::ServingConfigService::Rest::Client.new - # - # # Create a client using a custom configuration - # client = ::Google::Cloud::Retail::V2::ServingConfigService::Rest::Client.new do |config| - # config.timeout = 10.0 - # end - # - # @yield [config] Configure the ServingConfigService client. - # @yieldparam config [Client::Configuration] - # - def initialize - # Create the configuration object - @config = Configuration.new Client.configure - - # Yield the configuration if needed - yield @config if block_given? - - # Create credentials - credentials = @config.credentials - # Use self-signed JWT if the endpoint is unchanged from default, - # but only if the default endpoint does not have a region prefix. - enable_self_signed_jwt = @config.endpoint.nil? || - (@config.endpoint == Configuration::DEFAULT_ENDPOINT && - !@config.endpoint.split(".").first.include?("-")) - credentials ||= Credentials.default scope: @config.scope, - enable_self_signed_jwt: enable_self_signed_jwt - if credentials.is_a?(::String) || credentials.is_a?(::Hash) - credentials = Credentials.new credentials, scope: @config.scope - end - - @quota_project_id = @config.quota_project - @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id - - @serving_config_service_stub = ::Google::Cloud::Retail::V2::ServingConfigService::Rest::ServiceStub.new( - endpoint: @config.endpoint, - endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, - universe_domain: @config.universe_domain, - credentials: credentials, - logger: @config.logger - ) - - @serving_config_service_stub.logger(stub: true)&.info do |entry| - entry.set_system_name - entry.set_service - entry.message = "Created client for #{entry.service}" - entry.set_credentials_fields credentials - entry.set "customEndpoint", @config.endpoint if @config.endpoint - entry.set "defaultTimeout", @config.timeout if @config.timeout - entry.set "quotaProject", @quota_project_id if @quota_project_id - end - - @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config| - config.credentials = credentials - config.quota_project = @quota_project_id - config.endpoint = @serving_config_service_stub.endpoint - config.universe_domain = @serving_config_service_stub.universe_domain - config.logger = @serving_config_service_stub.logger if config.respond_to? :logger= - end - end - - ## - # Get the associated client for mix-in of the Locations. - # - # @return [Google::Cloud::Location::Locations::Rest::Client] - # - attr_reader :location_client - - ## - # The logger used for request/response debug logging. - # - # @return [Logger] - # - def logger - @serving_config_service_stub.logger - end - - # Service calls - - ## - # Creates a ServingConfig. - # - # A maximum of 100 {::Google::Cloud::Retail::V2::ServingConfig ServingConfig}s are - # allowed in a {::Google::Cloud::Retail::V2::Catalog Catalog}, otherwise a - # FAILED_PRECONDITION error is returned. - # - # @overload create_serving_config(request, options = nil) - # Pass arguments to `create_serving_config` via a request object, either of type - # {::Google::Cloud::Retail::V2::CreateServingConfigRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::CreateServingConfigRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload create_serving_config(parent: nil, serving_config: nil, serving_config_id: nil) - # Pass arguments to `create_serving_config` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. Full resource name of parent. Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - # @param serving_config [::Google::Cloud::Retail::V2::ServingConfig, ::Hash] - # Required. The ServingConfig to create. - # @param serving_config_id [::String] - # Required. The ID to use for the ServingConfig, which will become the final - # component of the ServingConfig's resource name. - # - # This value should be 4-63 characters, and valid characters - # are /[a-z][0-9]-_/. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::ServingConfig] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::ServingConfig] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ServingConfigService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::CreateServingConfigRequest.new - # - # # Call the create_serving_config method. - # result = client.create_serving_config request - # - # # The returned object is of type Google::Cloud::Retail::V2::ServingConfig. - # p result - # - def create_serving_config request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::CreateServingConfigRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.create_serving_config.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.create_serving_config.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.create_serving_config.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @serving_config_service_stub.create_serving_config request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Deletes a ServingConfig. - # - # Returns a NotFound error if the ServingConfig does not exist. - # - # @overload delete_serving_config(request, options = nil) - # Pass arguments to `delete_serving_config` via a request object, either of type - # {::Google::Cloud::Retail::V2::DeleteServingConfigRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::DeleteServingConfigRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload delete_serving_config(name: nil) - # Pass arguments to `delete_serving_config` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # Required. The resource name of the ServingConfig to delete. Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Protobuf::Empty] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Protobuf::Empty] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ServingConfigService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::DeleteServingConfigRequest.new - # - # # Call the delete_serving_config method. - # result = client.delete_serving_config request - # - # # The returned object is of type Google::Protobuf::Empty. - # p result - # - def delete_serving_config request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::DeleteServingConfigRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.delete_serving_config.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.delete_serving_config.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.delete_serving_config.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @serving_config_service_stub.delete_serving_config request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Updates a ServingConfig. - # - # @overload update_serving_config(request, options = nil) - # Pass arguments to `update_serving_config` via a request object, either of type - # {::Google::Cloud::Retail::V2::UpdateServingConfigRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::UpdateServingConfigRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload update_serving_config(serving_config: nil, update_mask: nil) - # Pass arguments to `update_serving_config` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param serving_config [::Google::Cloud::Retail::V2::ServingConfig, ::Hash] - # Required. The ServingConfig to update. - # @param update_mask [::Google::Protobuf::FieldMask, ::Hash] - # Indicates which fields in the provided - # {::Google::Cloud::Retail::V2::ServingConfig ServingConfig} to update. The - # following are NOT supported: - # - # * {::Google::Cloud::Retail::V2::ServingConfig#name ServingConfig.name} - # - # If not set, all supported fields are updated. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::ServingConfig] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::ServingConfig] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ServingConfigService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::UpdateServingConfigRequest.new - # - # # Call the update_serving_config method. - # result = client.update_serving_config request - # - # # The returned object is of type Google::Cloud::Retail::V2::ServingConfig. - # p result - # - def update_serving_config request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::UpdateServingConfigRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.update_serving_config.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.update_serving_config.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.update_serving_config.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @serving_config_service_stub.update_serving_config request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Gets a ServingConfig. - # - # Returns a NotFound error if the ServingConfig does not exist. - # - # @overload get_serving_config(request, options = nil) - # Pass arguments to `get_serving_config` via a request object, either of type - # {::Google::Cloud::Retail::V2::GetServingConfigRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::GetServingConfigRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload get_serving_config(name: nil) - # Pass arguments to `get_serving_config` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # Required. The resource name of the ServingConfig to get. Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::ServingConfig] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::ServingConfig] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ServingConfigService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::GetServingConfigRequest.new - # - # # Call the get_serving_config method. - # result = client.get_serving_config request - # - # # The returned object is of type Google::Cloud::Retail::V2::ServingConfig. - # p result - # - def get_serving_config request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::GetServingConfigRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.get_serving_config.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.get_serving_config.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.get_serving_config.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @serving_config_service_stub.get_serving_config request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Lists all ServingConfigs linked to this catalog. - # - # @overload list_serving_configs(request, options = nil) - # Pass arguments to `list_serving_configs` via a request object, either of type - # {::Google::Cloud::Retail::V2::ListServingConfigsRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::ListServingConfigsRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload list_serving_configs(parent: nil, page_size: nil, page_token: nil) - # Pass arguments to `list_serving_configs` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. The catalog resource name. Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - # @param page_size [::Integer] - # Optional. Maximum number of results to return. If unspecified, defaults - # to 100. If a value greater than 100 is provided, at most 100 results are - # returned. - # @param page_token [::String] - # Optional. A page token, received from a previous `ListServingConfigs` call. - # Provide this to retrieve the subsequent page. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Retail::V2::ServingConfig>] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Retail::V2::ServingConfig>] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ServingConfigService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::ListServingConfigsRequest.new - # - # # Call the list_serving_configs method. - # result = client.list_serving_configs request - # - # # The returned object is of type Gapic::PagedEnumerable. You can iterate - # # over elements, and API calls will be issued to fetch pages as needed. - # result.each do |item| - # # Each element is of type ::Google::Cloud::Retail::V2::ServingConfig. - # p item - # end - # - def list_serving_configs request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ListServingConfigsRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.list_serving_configs.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.list_serving_configs.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.list_serving_configs.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @serving_config_service_stub.list_serving_configs request, options do |result, operation| - result = ::Gapic::Rest::PagedEnumerable.new @serving_config_service_stub, :list_serving_configs, "serving_configs", request, result, options - yield result, operation if block_given? - throw :response, result - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Enables a Control on the specified ServingConfig. - # The control is added in the last position of the list of controls - # it belongs to (e.g. if it's a facet spec control it will be applied - # in the last position of servingConfig.facetSpecIds) - # Returns a ALREADY_EXISTS error if the control has already been applied. - # Returns a FAILED_PRECONDITION error if the addition could exceed maximum - # number of control allowed for that type of control. - # - # @overload add_control(request, options = nil) - # Pass arguments to `add_control` via a request object, either of type - # {::Google::Cloud::Retail::V2::AddControlRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::AddControlRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload add_control(serving_config: nil, control_id: nil) - # Pass arguments to `add_control` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param serving_config [::String] - # Required. The source ServingConfig resource name . Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` - # @param control_id [::String] - # Required. The id of the control to apply. Assumed to be in the same catalog - # as the serving config - if id is not found a NOT_FOUND error is returned. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::ServingConfig] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::ServingConfig] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ServingConfigService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::AddControlRequest.new - # - # # Call the add_control method. - # result = client.add_control request - # - # # The returned object is of type Google::Cloud::Retail::V2::ServingConfig. - # p result - # - def add_control request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::AddControlRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.add_control.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.add_control.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.add_control.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @serving_config_service_stub.add_control request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Disables a Control on the specified ServingConfig. - # The control is removed from the ServingConfig. - # Returns a NOT_FOUND error if the Control is not enabled for the - # ServingConfig. - # - # @overload remove_control(request, options = nil) - # Pass arguments to `remove_control` via a request object, either of type - # {::Google::Cloud::Retail::V2::RemoveControlRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::RemoveControlRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload remove_control(serving_config: nil, control_id: nil) - # Pass arguments to `remove_control` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param serving_config [::String] - # Required. The source ServingConfig resource name . Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` - # @param control_id [::String] - # Required. The id of the control to apply. Assumed to be in the same catalog - # as the serving config. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::ServingConfig] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::ServingConfig] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::ServingConfigService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::RemoveControlRequest.new - # - # # Call the remove_control method. - # result = client.remove_control request - # - # # The returned object is of type Google::Cloud::Retail::V2::ServingConfig. - # p result - # - def remove_control request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::RemoveControlRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.remove_control.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.remove_control.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.remove_control.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @serving_config_service_stub.remove_control request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Configuration class for the ServingConfigService REST API. - # - # This class represents the configuration for ServingConfigService REST, - # providing control over timeouts, retry behavior, logging, transport - # parameters, and other low-level controls. Certain parameters can also be - # applied individually to specific RPCs. See - # {::Google::Cloud::Retail::V2::ServingConfigService::Rest::Client::Configuration::Rpcs} - # for a list of RPCs that can be configured independently. - # - # Configuration can be applied globally to all clients, or to a single client - # on construction. - # - # @example - # - # # Modify the global config, setting the timeout for - # # create_serving_config to 20 seconds, - # # and all remaining timeouts to 10 seconds. - # ::Google::Cloud::Retail::V2::ServingConfigService::Rest::Client.configure do |config| - # config.timeout = 10.0 - # config.rpcs.create_serving_config.timeout = 20.0 - # end - # - # # Apply the above configuration only to a new client. - # client = ::Google::Cloud::Retail::V2::ServingConfigService::Rest::Client.new do |config| - # config.timeout = 10.0 - # config.rpcs.create_serving_config.timeout = 20.0 - # end - # - # @!attribute [rw] endpoint - # A custom service endpoint, as a hostname or hostname:port. The default is - # nil, indicating to use the default endpoint in the current universe domain. - # @return [::String,nil] - # @!attribute [rw] credentials - # Credentials to send with calls. You may provide any of the following types: - # * (`String`) The path to a service account key file in JSON format - # * (`Hash`) A service account key as a Hash - # * (`Google::Auth::Credentials`) A googleauth credentials object - # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) - # * (`Signet::OAuth2::Client`) A signet oauth2 client object - # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) - # * (`nil`) indicating no credentials - # - # Warning: If you accept a credential configuration (JSON file or Hash) from an - # external source for authentication to Google Cloud, you must validate it before - # providing it to a Google API client library. Providing an unvalidated credential - # configuration to Google APIs can compromise the security of your systems and data. - # For more information, refer to [Validate credential configurations from external - # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). - # @return [::Object] - # @!attribute [rw] scope - # The OAuth scopes - # @return [::Array<::String>] - # @!attribute [rw] lib_name - # The library name as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] lib_version - # The library version as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] timeout - # The call timeout in seconds. - # @return [::Numeric] - # @!attribute [rw] metadata - # Additional headers to be sent with the call. - # @return [::Hash{::Symbol=>::String}] - # @!attribute [rw] retry_policy - # The retry policy. The value is a hash with the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # @return [::Hash] - # @!attribute [rw] quota_project - # A separate project against which to charge quota. - # @return [::String] - # @!attribute [rw] universe_domain - # The universe domain within which to make requests. This determines the - # default endpoint URL. The default value of nil uses the environment - # universe (usually the default "googleapis.com" universe). - # @return [::String,nil] - # @!attribute [rw] logger - # A custom logger to use for request/response debug logging, or the value - # `:default` (the default) to construct a default logger, or `nil` to - # explicitly disable logging. - # @return [::Logger,:default,nil] - # - class Configuration - extend ::Gapic::Config - - # @private - # The endpoint specific to the default "googleapis.com" universe. Deprecated. - DEFAULT_ENDPOINT = "retail.googleapis.com" - - config_attr :endpoint, nil, ::String, nil - config_attr :credentials, nil do |value| - allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] - allowed.any? { |klass| klass === value } - end - config_attr :scope, nil, ::String, ::Array, nil - config_attr :lib_name, nil, ::String, nil - config_attr :lib_version, nil, ::String, nil - config_attr :timeout, nil, ::Numeric, nil - config_attr :metadata, nil, ::Hash, nil - config_attr :retry_policy, nil, ::Hash, ::Proc, nil - config_attr :quota_project, nil, ::String, nil - config_attr :universe_domain, nil, ::String, nil - config_attr :logger, :default, ::Logger, nil, :default - - # @private - def initialize parent_config = nil - @parent_config = parent_config unless parent_config.nil? - - yield self if block_given? - end - - ## - # Configurations for individual RPCs - # @return [Rpcs] - # - def rpcs - @rpcs ||= begin - parent_rpcs = nil - parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) - Rpcs.new parent_rpcs - end - end - - ## - # Configuration RPC class for the ServingConfigService API. - # - # Includes fields providing the configuration for each RPC in this service. - # Each configuration object is of type `Gapic::Config::Method` and includes - # the following configuration fields: - # - # * `timeout` (*type:* `Numeric`) - The call timeout in seconds - # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers - # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields - # include the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # - class Rpcs - ## - # RPC-specific configuration for `create_serving_config` - # @return [::Gapic::Config::Method] - # - attr_reader :create_serving_config - ## - # RPC-specific configuration for `delete_serving_config` - # @return [::Gapic::Config::Method] - # - attr_reader :delete_serving_config - ## - # RPC-specific configuration for `update_serving_config` - # @return [::Gapic::Config::Method] - # - attr_reader :update_serving_config - ## - # RPC-specific configuration for `get_serving_config` - # @return [::Gapic::Config::Method] - # - attr_reader :get_serving_config - ## - # RPC-specific configuration for `list_serving_configs` - # @return [::Gapic::Config::Method] - # - attr_reader :list_serving_configs - ## - # RPC-specific configuration for `add_control` - # @return [::Gapic::Config::Method] - # - attr_reader :add_control - ## - # RPC-specific configuration for `remove_control` - # @return [::Gapic::Config::Method] - # - attr_reader :remove_control - - # @private - def initialize parent_rpcs = nil - create_serving_config_config = parent_rpcs.create_serving_config if parent_rpcs.respond_to? :create_serving_config - @create_serving_config = ::Gapic::Config::Method.new create_serving_config_config - delete_serving_config_config = parent_rpcs.delete_serving_config if parent_rpcs.respond_to? :delete_serving_config - @delete_serving_config = ::Gapic::Config::Method.new delete_serving_config_config - update_serving_config_config = parent_rpcs.update_serving_config if parent_rpcs.respond_to? :update_serving_config - @update_serving_config = ::Gapic::Config::Method.new update_serving_config_config - get_serving_config_config = parent_rpcs.get_serving_config if parent_rpcs.respond_to? :get_serving_config - @get_serving_config = ::Gapic::Config::Method.new get_serving_config_config - list_serving_configs_config = parent_rpcs.list_serving_configs if parent_rpcs.respond_to? :list_serving_configs - @list_serving_configs = ::Gapic::Config::Method.new list_serving_configs_config - add_control_config = parent_rpcs.add_control if parent_rpcs.respond_to? :add_control - @add_control = ::Gapic::Config::Method.new add_control_config - remove_control_config = parent_rpcs.remove_control if parent_rpcs.respond_to? :remove_control - @remove_control = ::Gapic::Config::Method.new remove_control_config - - yield self if block_given? - end - end - end - end - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/rest/service_stub.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/rest/service_stub.rb deleted file mode 100644 index ade51caaf6b9..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service/rest/service_stub.rb +++ /dev/null @@ -1,512 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "google/cloud/retail/v2/serving_config_service_pb" - -module Google - module Cloud - module Retail - module V2 - module ServingConfigService - module Rest - ## - # REST service stub for the ServingConfigService service. - # Service stub contains baseline method implementations - # including transcoding, making the REST call, and deserialing the response. - # - class ServiceStub - # @private - def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger: - # These require statements are intentionally placed here to initialize - # the REST modules only when it's required. - require "gapic/rest" - - @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, - endpoint_template: endpoint_template, - universe_domain: universe_domain, - credentials: credentials, - numeric_enums: true, - service_name: self.class, - raise_faraday_errors: false, - logger: logger - end - - ## - # The effective universe domain - # - # @return [String] - # - def universe_domain - @client_stub.universe_domain - end - - ## - # The effective endpoint - # - # @return [String] - # - def endpoint - @client_stub.endpoint - end - - ## - # The logger used for request/response debug logging. - # - # @return [Logger] - # - def logger stub: false - stub ? @client_stub.stub_logger : @client_stub.logger - end - - ## - # Baseline implementation for the create_serving_config REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::CreateServingConfigRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::ServingConfig] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::ServingConfig] - # A result object deserialized from the server's reply - def create_serving_config request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_create_serving_config_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "create_serving_config", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Retail::V2::ServingConfig.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the delete_serving_config REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::DeleteServingConfigRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Protobuf::Empty] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Protobuf::Empty] - # A result object deserialized from the server's reply - def delete_serving_config request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_delete_serving_config_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "delete_serving_config", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the update_serving_config REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::UpdateServingConfigRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::ServingConfig] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::ServingConfig] - # A result object deserialized from the server's reply - def update_serving_config request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_update_serving_config_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "update_serving_config", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Retail::V2::ServingConfig.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the get_serving_config REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::GetServingConfigRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::ServingConfig] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::ServingConfig] - # A result object deserialized from the server's reply - def get_serving_config request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_get_serving_config_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "get_serving_config", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Retail::V2::ServingConfig.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the list_serving_configs REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::ListServingConfigsRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::ListServingConfigsResponse] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::ListServingConfigsResponse] - # A result object deserialized from the server's reply - def list_serving_configs request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_list_serving_configs_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "list_serving_configs", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Retail::V2::ListServingConfigsResponse.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the add_control REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::AddControlRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::ServingConfig] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::ServingConfig] - # A result object deserialized from the server's reply - def add_control request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_add_control_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "add_control", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Retail::V2::ServingConfig.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the remove_control REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::RemoveControlRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::ServingConfig] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::ServingConfig] - # A result object deserialized from the server's reply - def remove_control request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_remove_control_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "remove_control", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Retail::V2::ServingConfig.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # @private - # - # GRPC transcoding helper method for the create_serving_config REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::CreateServingConfigRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_create_serving_config_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :post, - uri_template: "/v2/{parent}/servingConfigs", - body: "serving_config", - matches: [ - ["parent", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the delete_serving_config REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::DeleteServingConfigRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_delete_serving_config_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :delete, - uri_template: "/v2/{name}", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/servingConfigs/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the update_serving_config REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::UpdateServingConfigRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_update_serving_config_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :patch, - uri_template: "/v2/{serving_config.name}", - body: "serving_config", - matches: [ - ["serving_config.name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/servingConfigs/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the get_serving_config REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::GetServingConfigRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_get_serving_config_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :get, - uri_template: "/v2/{name}", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/servingConfigs/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the list_serving_configs REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::ListServingConfigsRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_list_serving_configs_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :get, - uri_template: "/v2/{parent}/servingConfigs", - matches: [ - ["parent", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the add_control REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::AddControlRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_add_control_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :post, - uri_template: "/v2/{serving_config}:addControl", - body: "*", - matches: [ - ["serving_config", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/servingConfigs/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the remove_control REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::RemoveControlRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_remove_control_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :post, - uri_template: "/v2/{serving_config}:removeControl", - body: "*", - matches: [ - ["serving_config", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/servingConfigs/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - end - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service_pb.rb deleted file mode 100644 index 8fb9b76b0e85..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service_pb.rb +++ /dev/null @@ -1,36 +0,0 @@ -# frozen_string_literal: true -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/retail/v2/serving_config_service.proto - -require 'google/protobuf' - -require 'google/api/annotations_pb' -require 'google/api/client_pb' -require 'google/api/field_behavior_pb' -require 'google/api/resource_pb' -require 'google/cloud/retail/v2/serving_config_pb' -require 'google/protobuf/empty_pb' -require 'google/protobuf/field_mask_pb' - - -descriptor_data = "\n3google/cloud/retail/v2/serving_config_service.proto\x12\x16google.cloud.retail.v2\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a+google/cloud/retail/v2/serving_config.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\"\xb7\x01\n\x1a\x43reateServingConfigRequest\x12\x35\n\x06parent\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\n\x1dretail.googleapis.com/Catalog\x12\x42\n\x0eserving_config\x18\x02 \x01(\x0b\x32%.google.cloud.retail.v2.ServingConfigB\x03\xe0\x41\x02\x12\x1e\n\x11serving_config_id\x18\x03 \x01(\tB\x03\xe0\x41\x02\"\x91\x01\n\x1aUpdateServingConfigRequest\x12\x42\n\x0eserving_config\x18\x01 \x01(\x0b\x32%.google.cloud.retail.v2.ServingConfigB\x03\xe0\x41\x02\x12/\n\x0bupdate_mask\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMask\"W\n\x1a\x44\x65leteServingConfigRequest\x12\x39\n\x04name\x18\x01 \x01(\tB+\xe0\x41\x02\xfa\x41%\n#retail.googleapis.com/ServingConfig\"T\n\x17GetServingConfigRequest\x12\x39\n\x04name\x18\x01 \x01(\tB+\xe0\x41\x02\xfa\x41%\n#retail.googleapis.com/ServingConfig\"\x83\x01\n\x19ListServingConfigsRequest\x12\x35\n\x06parent\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\n\x1dretail.googleapis.com/Catalog\x12\x16\n\tpage_size\x18\x02 \x01(\x05\x42\x03\xe0\x41\x01\x12\x17\n\npage_token\x18\x03 \x01(\tB\x03\xe0\x41\x01\"u\n\x1aListServingConfigsResponse\x12>\n\x0fserving_configs\x18\x01 \x03(\x0b\x32%.google.cloud.retail.v2.ServingConfig\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t\"q\n\x11\x41\x64\x64\x43ontrolRequest\x12\x43\n\x0eserving_config\x18\x01 \x01(\tB+\xe0\x41\x02\xfa\x41%\n#retail.googleapis.com/ServingConfig\x12\x17\n\ncontrol_id\x18\x02 \x01(\tB\x03\xe0\x41\x02\"t\n\x14RemoveControlRequest\x12\x43\n\x0eserving_config\x18\x01 \x01(\tB+\xe0\x41\x02\xfa\x41%\n#retail.googleapis.com/ServingConfig\x12\x17\n\ncontrol_id\x18\x02 \x01(\tB\x03\xe0\x41\x02\x32\xb2\x0c\n\x14ServingConfigService\x12\xf1\x01\n\x13\x43reateServingConfig\x12\x32.google.cloud.retail.v2.CreateServingConfigRequest\x1a%.google.cloud.retail.v2.ServingConfig\"\x7f\xda\x41\'parent,serving_config,serving_config_id\x82\xd3\xe4\x93\x02O\"=/v2/{parent=projects/*/locations/*/catalogs/*}/servingConfigs:\x0eserving_config\x12\xaf\x01\n\x13\x44\x65leteServingConfig\x12\x32.google.cloud.retail.v2.DeleteServingConfigRequest\x1a\x16.google.protobuf.Empty\"L\xda\x41\x04name\x82\xd3\xe4\x93\x02?*=/v2/{name=projects/*/locations/*/catalogs/*/servingConfigs/*}\x12\xf4\x01\n\x13UpdateServingConfig\x12\x32.google.cloud.retail.v2.UpdateServingConfigRequest\x1a%.google.cloud.retail.v2.ServingConfig\"\x81\x01\xda\x41\x1aserving_config,update_mask\x82\xd3\xe4\x93\x02^2L/v2/{serving_config.name=projects/*/locations/*/catalogs/*/servingConfigs/*}:\x0eserving_config\x12\xb8\x01\n\x10GetServingConfig\x12/.google.cloud.retail.v2.GetServingConfigRequest\x1a%.google.cloud.retail.v2.ServingConfig\"L\xda\x41\x04name\x82\xd3\xe4\x93\x02?\x12=/v2/{name=projects/*/locations/*/catalogs/*/servingConfigs/*}\x12\xcb\x01\n\x12ListServingConfigs\x12\x31.google.cloud.retail.v2.ListServingConfigsRequest\x1a\x32.google.cloud.retail.v2.ListServingConfigsResponse\"N\xda\x41\x06parent\x82\xd3\xe4\x93\x02?\x12=/v2/{parent=projects/*/locations/*/catalogs/*}/servingConfigs\x12\xce\x01\n\nAddControl\x12).google.cloud.retail.v2.AddControlRequest\x1a%.google.cloud.retail.v2.ServingConfig\"n\xda\x41\x0eserving_config\x82\xd3\xe4\x93\x02W\"R/v2/{serving_config=projects/*/locations/*/catalogs/*/servingConfigs/*}:addControl:\x01*\x12\xd7\x01\n\rRemoveControl\x12,.google.cloud.retail.v2.RemoveControlRequest\x1a%.google.cloud.retail.v2.ServingConfig\"q\xda\x41\x0eserving_config\x82\xd3\xe4\x93\x02Z\"U/v2/{serving_config=projects/*/locations/*/catalogs/*/servingConfigs/*}:removeControl:\x01*\x1aI\xca\x41\x15retail.googleapis.com\xd2\x41.https://www.googleapis.com/auth/cloud-platformB\xc4\x01\n\x1a\x63om.google.cloud.retail.v2B\x19ServingConfigServiceProtoP\x01Z2cloud.google.com/go/retail/apiv2/retailpb;retailpb\xa2\x02\x06RETAIL\xaa\x02\x16Google.Cloud.Retail.V2\xca\x02\x16Google\\Cloud\\Retail\\V2\xea\x02\x19Google::Cloud::Retail::V2b\x06proto3" - -pool = ::Google::Protobuf::DescriptorPool.generated_pool -pool.add_serialized_file(descriptor_data) - -module Google - module Cloud - module Retail - module V2 - CreateServingConfigRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CreateServingConfigRequest").msgclass - UpdateServingConfigRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.UpdateServingConfigRequest").msgclass - DeleteServingConfigRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.DeleteServingConfigRequest").msgclass - GetServingConfigRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.GetServingConfigRequest").msgclass - ListServingConfigsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ListServingConfigsRequest").msgclass - ListServingConfigsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ListServingConfigsResponse").msgclass - AddControlRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.AddControlRequest").msgclass - RemoveControlRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.RemoveControlRequest").msgclass - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service_services_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service_services_pb.rb deleted file mode 100644 index ae1db2fde215..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/serving_config_service_services_pb.rb +++ /dev/null @@ -1,74 +0,0 @@ -# Generated by the protocol buffer compiler. DO NOT EDIT! -# Source: google/cloud/retail/v2/serving_config_service.proto for package 'Google.Cloud.Retail.V2' -# Original file comments: -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -require 'grpc' -require 'google/cloud/retail/v2/serving_config_service_pb' - -module Google - module Cloud - module Retail - module V2 - module ServingConfigService - # Service for modifying ServingConfig. - class Service - - include ::GRPC::GenericService - - self.marshal_class_method = :encode - self.unmarshal_class_method = :decode - self.service_name = 'google.cloud.retail.v2.ServingConfigService' - - # Creates a ServingConfig. - # - # A maximum of 100 [ServingConfig][google.cloud.retail.v2.ServingConfig]s are - # allowed in a [Catalog][google.cloud.retail.v2.Catalog], otherwise a - # FAILED_PRECONDITION error is returned. - rpc :CreateServingConfig, ::Google::Cloud::Retail::V2::CreateServingConfigRequest, ::Google::Cloud::Retail::V2::ServingConfig - # Deletes a ServingConfig. - # - # Returns a NotFound error if the ServingConfig does not exist. - rpc :DeleteServingConfig, ::Google::Cloud::Retail::V2::DeleteServingConfigRequest, ::Google::Protobuf::Empty - # Updates a ServingConfig. - rpc :UpdateServingConfig, ::Google::Cloud::Retail::V2::UpdateServingConfigRequest, ::Google::Cloud::Retail::V2::ServingConfig - # Gets a ServingConfig. - # - # Returns a NotFound error if the ServingConfig does not exist. - rpc :GetServingConfig, ::Google::Cloud::Retail::V2::GetServingConfigRequest, ::Google::Cloud::Retail::V2::ServingConfig - # Lists all ServingConfigs linked to this catalog. - rpc :ListServingConfigs, ::Google::Cloud::Retail::V2::ListServingConfigsRequest, ::Google::Cloud::Retail::V2::ListServingConfigsResponse - # Enables a Control on the specified ServingConfig. - # The control is added in the last position of the list of controls - # it belongs to (e.g. if it's a facet spec control it will be applied - # in the last position of servingConfig.facetSpecIds) - # Returns a ALREADY_EXISTS error if the control has already been applied. - # Returns a FAILED_PRECONDITION error if the addition could exceed maximum - # number of control allowed for that type of control. - rpc :AddControl, ::Google::Cloud::Retail::V2::AddControlRequest, ::Google::Cloud::Retail::V2::ServingConfig - # Disables a Control on the specified ServingConfig. - # The control is removed from the ServingConfig. - # Returns a NOT_FOUND error if the Control is not enabled for the - # ServingConfig. - rpc :RemoveControl, ::Google::Cloud::Retail::V2::RemoveControlRequest, ::Google::Cloud::Retail::V2::ServingConfig - end - - Stub = Service.rpc_stub_class - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_pb.rb deleted file mode 100644 index f7da172ecbbd..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_pb.rb +++ /dev/null @@ -1,30 +0,0 @@ -# frozen_string_literal: true -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/retail/v2/user_event.proto - -require 'google/protobuf' - -require 'google/api/field_behavior_pb' -require 'google/cloud/retail/v2/common_pb' -require 'google/cloud/retail/v2/product_pb' -require 'google/protobuf/timestamp_pb' -require 'google/protobuf/wrappers_pb' - - -descriptor_data = "\n\'google/cloud/retail/v2/user_event.proto\x12\x16google.cloud.retail.v2\x1a\x1fgoogle/api/field_behavior.proto\x1a#google/cloud/retail/v2/common.proto\x1a$google/cloud/retail/v2/product.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1egoogle/protobuf/wrappers.proto\"\x97\x06\n\tUserEvent\x12\x17\n\nevent_type\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x17\n\nvisitor_id\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\x12\n\nsession_id\x18\x15 \x01(\t\x12.\n\nevent_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x16\n\x0e\x65xperiment_ids\x18\x04 \x03(\t\x12\x19\n\x11\x61ttribution_token\x18\x05 \x01(\t\x12>\n\x0fproduct_details\x18\x06 \x03(\x0b\x32%.google.cloud.retail.v2.ProductDetail\x12\x43\n\x11\x63ompletion_detail\x18\x16 \x01(\x0b\x32(.google.cloud.retail.v2.CompletionDetail\x12\x45\n\nattributes\x18\x07 \x03(\x0b\x32\x31.google.cloud.retail.v2.UserEvent.AttributesEntry\x12\x0f\n\x07\x63\x61rt_id\x18\x08 \x01(\t\x12I\n\x14purchase_transaction\x18\t \x01(\x0b\x32+.google.cloud.retail.v2.PurchaseTransaction\x12\x14\n\x0csearch_query\x18\n \x01(\t\x12\x0e\n\x06\x66ilter\x18\x10 \x01(\t\x12\x10\n\x08order_by\x18\x11 \x01(\t\x12\x0e\n\x06offset\x18\x12 \x01(\x05\x12\x17\n\x0fpage_categories\x18\x0b \x03(\t\x12\x33\n\tuser_info\x18\x0c \x01(\x0b\x32 .google.cloud.retail.v2.UserInfo\x12\x0b\n\x03uri\x18\r \x01(\t\x12\x14\n\x0creferrer_uri\x18\x0e \x01(\t\x12\x14\n\x0cpage_view_id\x18\x0f \x01(\t\x12\x0e\n\x06\x65ntity\x18\x17 \x01(\t\x1aZ\n\x0f\x41ttributesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x36\n\x05value\x18\x02 \x01(\x0b\x32\'.google.cloud.retail.v2.CustomAttribute:\x02\x38\x01\"u\n\rProductDetail\x12\x35\n\x07product\x18\x01 \x01(\x0b\x32\x1f.google.cloud.retail.v2.ProductB\x03\xe0\x41\x02\x12-\n\x08quantity\x18\x02 \x01(\x0b\x32\x1b.google.protobuf.Int32Value\"p\n\x10\x43ompletionDetail\x12$\n\x1c\x63ompletion_attribution_token\x18\x01 \x01(\t\x12\x1b\n\x13selected_suggestion\x18\x02 \x01(\t\x12\x19\n\x11selected_position\x18\x03 \x01(\x05\"n\n\x13PurchaseTransaction\x12\n\n\x02id\x18\x01 \x01(\t\x12\x14\n\x07revenue\x18\x02 \x01(\x02\x42\x03\xe0\x41\x02\x12\x0b\n\x03tax\x18\x03 \x01(\x02\x12\x0c\n\x04\x63ost\x18\x04 \x01(\x02\x12\x1a\n\rcurrency_code\x18\x05 \x01(\tB\x03\xe0\x41\x02\x42\xb9\x01\n\x1a\x63om.google.cloud.retail.v2B\x0eUserEventProtoP\x01Z2cloud.google.com/go/retail/apiv2/retailpb;retailpb\xa2\x02\x06RETAIL\xaa\x02\x16Google.Cloud.Retail.V2\xca\x02\x16Google\\Cloud\\Retail\\V2\xea\x02\x19Google::Cloud::Retail::V2b\x06proto3" - -pool = ::Google::Protobuf::DescriptorPool.generated_pool -pool.add_serialized_file(descriptor_data) - -module Google - module Cloud - module Retail - module V2 - UserEvent = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.UserEvent").msgclass - ProductDetail = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.ProductDetail").msgclass - CompletionDetail = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CompletionDetail").msgclass - PurchaseTransaction = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.PurchaseTransaction").msgclass - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service.rb deleted file mode 100644 index 7ff44608d216..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service.rb +++ /dev/null @@ -1,56 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "gapic/common" -require "gapic/config" -require "gapic/config/method" - -require "google/cloud/retail/v2/version" - -require "google/cloud/retail/v2/user_event_service/credentials" -require "google/cloud/retail/v2/user_event_service/paths" -require "google/cloud/retail/v2/user_event_service/operations" -require "google/cloud/retail/v2/user_event_service/client" -require "google/cloud/retail/v2/user_event_service/rest" - -module Google - module Cloud - module Retail - module V2 - ## - # Service for ingesting end user actions on the customer website. - # - # @example Load this service and instantiate a gRPC client - # - # require "google/cloud/retail/v2/user_event_service" - # client = ::Google::Cloud::Retail::V2::UserEventService::Client.new - # - # @example Load this service and instantiate a REST client - # - # require "google/cloud/retail/v2/user_event_service/rest" - # client = ::Google::Cloud::Retail::V2::UserEventService::Rest::Client.new - # - module UserEventService - end - end - end - end -end - -helper_path = ::File.join __dir__, "user_event_service", "helpers.rb" -require "google/cloud/retail/v2/user_event_service/helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/client.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/client.rb deleted file mode 100644 index b7852fd0e142..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/client.rb +++ /dev/null @@ -1,1008 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "google/cloud/errors" -require "google/cloud/retail/v2/user_event_service_pb" -require "google/cloud/location" - -module Google - module Cloud - module Retail - module V2 - module UserEventService - ## - # Client for the UserEventService service. - # - # Service for ingesting end user actions on the customer website. - # - class Client - # @private - API_VERSION = "" - - # @private - DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" - - include Paths - - # @private - attr_reader :user_event_service_stub - - ## - # Configure the UserEventService Client class. - # - # See {::Google::Cloud::Retail::V2::UserEventService::Client::Configuration} - # for a description of the configuration fields. - # - # @example - # - # # Modify the configuration for all UserEventService clients - # ::Google::Cloud::Retail::V2::UserEventService::Client.configure do |config| - # config.timeout = 10.0 - # end - # - # @yield [config] Configure the Client client. - # @yieldparam config [Client::Configuration] - # - # @return [Client::Configuration] - # - def self.configure - @configure ||= begin - namespace = ["Google", "Cloud", "Retail", "V2"] - parent_config = while namespace.any? - parent_name = namespace.join "::" - parent_const = const_get parent_name - break parent_const.configure if parent_const.respond_to? :configure - namespace.pop - end - default_config = Client::Configuration.new parent_config - - default_config.timeout = 10.0 - default_config.retry_policy = { - initial_delay: 0.1, max_delay: 5.0, multiplier: 1.3, retry_codes: [14, 4] - } - - default_config.rpcs.purge_user_events.timeout = 30.0 - default_config.rpcs.purge_user_events.retry_policy = { - initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [14, 4] - } - - default_config.rpcs.import_user_events.timeout = 600.0 - default_config.rpcs.import_user_events.retry_policy = { - initial_delay: 0.1, max_delay: 300.0, multiplier: 1.3, retry_codes: [14, 4] - } - - default_config - end - yield @configure if block_given? - @configure - end - - ## - # Configure the UserEventService Client instance. - # - # The configuration is set to the derived mode, meaning that values can be changed, - # but structural changes (adding new fields, etc.) are not allowed. Structural changes - # should be made on {Client.configure}. - # - # See {::Google::Cloud::Retail::V2::UserEventService::Client::Configuration} - # for a description of the configuration fields. - # - # @yield [config] Configure the Client client. - # @yieldparam config [Client::Configuration] - # - # @return [Client::Configuration] - # - def configure - yield @config if block_given? - @config - end - - ## - # The effective universe domain - # - # @return [String] - # - def universe_domain - @user_event_service_stub.universe_domain - end - - ## - # Create a new UserEventService client object. - # - # @example - # - # # Create a client using the default configuration - # client = ::Google::Cloud::Retail::V2::UserEventService::Client.new - # - # # Create a client using a custom configuration - # client = ::Google::Cloud::Retail::V2::UserEventService::Client.new do |config| - # config.timeout = 10.0 - # end - # - # @yield [config] Configure the UserEventService client. - # @yieldparam config [Client::Configuration] - # - def initialize - # These require statements are intentionally placed here to initialize - # the gRPC module only when it's required. - # See https://github.com/googleapis/toolkit/issues/446 - require "gapic/grpc" - require "google/cloud/retail/v2/user_event_service_services_pb" - - # Create the configuration object - @config = Configuration.new Client.configure - - # Yield the configuration if needed - yield @config if block_given? - - # Create credentials - credentials = @config.credentials - # Use self-signed JWT if the endpoint is unchanged from default, - # but only if the default endpoint does not have a region prefix. - enable_self_signed_jwt = @config.endpoint.nil? || - (@config.endpoint == Configuration::DEFAULT_ENDPOINT && - !@config.endpoint.split(".").first.include?("-")) - credentials ||= Credentials.default scope: @config.scope, - enable_self_signed_jwt: enable_self_signed_jwt - if credentials.is_a?(::String) || credentials.is_a?(::Hash) - credentials = Credentials.new credentials, scope: @config.scope - end - @quota_project_id = @config.quota_project - @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id - - @operations_client = Operations.new do |config| - config.credentials = credentials - config.quota_project = @quota_project_id - config.endpoint = @config.endpoint - config.universe_domain = @config.universe_domain - end - - @user_event_service_stub = ::Gapic::ServiceStub.new( - ::Google::Cloud::Retail::V2::UserEventService::Stub, - credentials: credentials, - endpoint: @config.endpoint, - endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, - universe_domain: @config.universe_domain, - channel_args: @config.channel_args, - interceptors: @config.interceptors, - channel_pool_config: @config.channel_pool, - logger: @config.logger - ) - - @user_event_service_stub.stub_logger&.info do |entry| - entry.set_system_name - entry.set_service - entry.message = "Created client for #{entry.service}" - entry.set_credentials_fields credentials - entry.set "customEndpoint", @config.endpoint if @config.endpoint - entry.set "defaultTimeout", @config.timeout if @config.timeout - entry.set "quotaProject", @quota_project_id if @quota_project_id - end - - @location_client = Google::Cloud::Location::Locations::Client.new do |config| - config.credentials = credentials - config.quota_project = @quota_project_id - config.endpoint = @user_event_service_stub.endpoint - config.universe_domain = @user_event_service_stub.universe_domain - config.logger = @user_event_service_stub.logger if config.respond_to? :logger= - end - end - - ## - # Get the associated client for long-running operations. - # - # @return [::Google::Cloud::Retail::V2::UserEventService::Operations] - # - attr_reader :operations_client - - ## - # Get the associated client for mix-in of the Locations. - # - # @return [Google::Cloud::Location::Locations::Client] - # - attr_reader :location_client - - ## - # The logger used for request/response debug logging. - # - # @return [Logger] - # - def logger - @user_event_service_stub.logger - end - - # Service calls - - ## - # Writes a single user event. - # - # @overload write_user_event(request, options = nil) - # Pass arguments to `write_user_event` via a request object, either of type - # {::Google::Cloud::Retail::V2::WriteUserEventRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::WriteUserEventRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload write_user_event(parent: nil, user_event: nil, write_async: nil) - # Pass arguments to `write_user_event` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. The parent catalog resource name, such as - # `projects/1234/locations/global/catalogs/default_catalog`. - # @param user_event [::Google::Cloud::Retail::V2::UserEvent, ::Hash] - # Required. User event to write. - # @param write_async [::Boolean] - # If set to true, the user event will be written asynchronously after - # validation, and the API will respond without waiting for the write. - # Therefore, silent failures can occur even if the API returns success. In - # case of silent failures, error messages can be found in Stackdriver logs. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Cloud::Retail::V2::UserEvent] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Cloud::Retail::V2::UserEvent] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::UserEventService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::WriteUserEventRequest.new - # - # # Call the write_user_event method. - # result = client.write_user_event request - # - # # The returned object is of type Google::Cloud::Retail::V2::UserEvent. - # p result - # - def write_user_event request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::WriteUserEventRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.write_user_event.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.parent - header_params["parent"] = request.parent - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.write_user_event.timeout, - metadata: metadata, - retry_policy: @config.rpcs.write_user_event.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @user_event_service_stub.call_rpc :write_user_event, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Writes a single user event from the browser. - # - # For larger user event payload over 16 KB, the POST method should be used - # instead, otherwise a 400 Bad Request error is returned. - # - # This method is used only by the Retail API JavaScript pixel and Google Tag - # Manager. Users should not call this method directly. - # - # @overload collect_user_event(request, options = nil) - # Pass arguments to `collect_user_event` via a request object, either of type - # {::Google::Cloud::Retail::V2::CollectUserEventRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::CollectUserEventRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload collect_user_event(prebuilt_rule: nil, parent: nil, user_event: nil, uri: nil, ets: nil, raw_json: nil) - # Pass arguments to `collect_user_event` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param prebuilt_rule [::String] - # The prebuilt rule name that can convert a specific type of raw_json. - # For example: "ga4_bq" rule for the GA4 user event schema. - # @param parent [::String] - # Required. The parent catalog name, such as - # `projects/1234/locations/global/catalogs/default_catalog`. - # @param user_event [::String] - # Required. URL encoded UserEvent proto with a length limit of 2,000,000 - # characters. - # @param uri [::String] - # The URL including cgi-parameters but excluding the hash fragment with a - # length limit of 5,000 characters. This is often more useful than the - # referer URL, because many browsers only send the domain for 3rd party - # requests. - # @param ets [::Integer] - # The event timestamp in milliseconds. This prevents browser caching of - # otherwise identical get requests. The name is abbreviated to reduce the - # payload bytes. - # @param raw_json [::String] - # An arbitrary serialized JSON string that contains necessary information - # that can comprise a user event. When this field is specified, the - # user_event field will be ignored. Note: line-delimited JSON is not - # supported, a single JSON only. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Api::HttpBody] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Api::HttpBody] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::UserEventService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::CollectUserEventRequest.new - # - # # Call the collect_user_event method. - # result = client.collect_user_event request - # - # # The returned object is of type Google::Api::HttpBody. - # p result - # - def collect_user_event request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::CollectUserEventRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.collect_user_event.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.parent - header_params["parent"] = request.parent - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.collect_user_event.timeout, - metadata: metadata, - retry_policy: @config.rpcs.collect_user_event.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @user_event_service_stub.call_rpc :collect_user_event, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Deletes permanently all user events specified by the filter provided. - # Depending on the number of events specified by the filter, this operation - # could take hours or days to complete. To test a filter, use the list - # command first. - # - # @overload purge_user_events(request, options = nil) - # Pass arguments to `purge_user_events` via a request object, either of type - # {::Google::Cloud::Retail::V2::PurgeUserEventsRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::PurgeUserEventsRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload purge_user_events(parent: nil, filter: nil, force: nil) - # Pass arguments to `purge_user_events` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. The resource name of the catalog under which the events are - # created. The format is - # `projects/${projectId}/locations/global/catalogs/${catalogId}` - # @param filter [::String] - # Required. The filter string to specify the events to be deleted with a - # length limit of 5,000 characters. Empty string filter is not allowed. The - # eligible fields for filtering are: - # - # * `eventType`: Double quoted - # {::Google::Cloud::Retail::V2::UserEvent#event_type UserEvent.event_type} string. - # * `eventTime`: in ISO 8601 "zulu" format. - # * `visitorId`: Double quoted string. Specifying this will delete all - # events associated with a visitor. - # * `userId`: Double quoted string. Specifying this will delete all events - # associated with a user. - # - # Examples: - # - # * Deleting all events in a time range: - # `eventTime > "2012-04-23T18:25:43.511Z" - # eventTime < "2012-04-23T18:30:43.511Z"` - # * Deleting specific eventType in time range: - # `eventTime > "2012-04-23T18:25:43.511Z" eventType = "detail-page-view"` - # * Deleting all events for a specific visitor: - # `visitorId = "visitor1024"` - # - # The filtering fields are assumed to have an implicit AND. - # @param force [::Boolean] - # Actually perform the purge. - # If `force` is set to false, the method will return the expected purge count - # without deleting any user events. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::Operation] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::UserEventService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::PurgeUserEventsRequest.new - # - # # Call the purge_user_events method. - # result = client.purge_user_events request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def purge_user_events request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::PurgeUserEventsRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.purge_user_events.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.parent - header_params["parent"] = request.parent - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.purge_user_events.timeout, - metadata: metadata, - retry_policy: @config.rpcs.purge_user_events.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @user_event_service_stub.call_rpc :purge_user_events, request, options: options do |response, operation| - response = ::Gapic::Operation.new response, @operations_client, options: options - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Bulk import of User events. Request processing might be - # synchronous. Events that already exist are skipped. - # Use this method for backfilling historical user events. - # - # `Operation.response` is of type `ImportResponse`. Note that it is - # possible for a subset of the items to be successfully inserted. - # `Operation.metadata` is of type `ImportMetadata`. - # - # @overload import_user_events(request, options = nil) - # Pass arguments to `import_user_events` via a request object, either of type - # {::Google::Cloud::Retail::V2::ImportUserEventsRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::ImportUserEventsRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload import_user_events(parent: nil, input_config: nil, errors_config: nil) - # Pass arguments to `import_user_events` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. `projects/1234/locations/global/catalogs/default_catalog` - # @param input_config [::Google::Cloud::Retail::V2::UserEventInputConfig, ::Hash] - # Required. The desired input location of the data. - # @param errors_config [::Google::Cloud::Retail::V2::ImportErrorsConfig, ::Hash] - # The desired location of errors incurred during the Import. Cannot be set - # for inline user event imports. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::Operation] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::UserEventService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::ImportUserEventsRequest.new - # - # # Call the import_user_events method. - # result = client.import_user_events request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def import_user_events request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ImportUserEventsRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.import_user_events.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.parent - header_params["parent"] = request.parent - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.import_user_events.timeout, - metadata: metadata, - retry_policy: @config.rpcs.import_user_events.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @user_event_service_stub.call_rpc :import_user_events, request, options: options do |response, operation| - response = ::Gapic::Operation.new response, @operations_client, options: options - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Starts a user-event rejoin operation with latest product catalog. Events - # are not annotated with detailed product information for products that are - # missing from the catalog when the user event is ingested. These - # events are stored as unjoined events with limited usage on training and - # serving. You can use this method to start a join operation on specified - # events with the latest version of product catalog. You can also use this - # method to correct events joined with the wrong product catalog. A rejoin - # operation can take hours or days to complete. - # - # @overload rejoin_user_events(request, options = nil) - # Pass arguments to `rejoin_user_events` via a request object, either of type - # {::Google::Cloud::Retail::V2::RejoinUserEventsRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::RejoinUserEventsRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload rejoin_user_events(parent: nil, user_event_rejoin_scope: nil) - # Pass arguments to `rejoin_user_events` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. The parent catalog resource name, such as - # `projects/1234/locations/global/catalogs/default_catalog`. - # @param user_event_rejoin_scope [::Google::Cloud::Retail::V2::RejoinUserEventsRequest::UserEventRejoinScope] - # The type of the user event rejoin to define the scope and range of the user - # events to be rejoined with the latest product catalog. Defaults to - # `USER_EVENT_REJOIN_SCOPE_UNSPECIFIED` if this field is not set, or set to - # an invalid integer value. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::Operation] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::UserEventService::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::RejoinUserEventsRequest.new - # - # # Call the rejoin_user_events method. - # result = client.rejoin_user_events request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def rejoin_user_events request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::RejoinUserEventsRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.rejoin_user_events.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.parent - header_params["parent"] = request.parent - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.rejoin_user_events.timeout, - metadata: metadata, - retry_policy: @config.rpcs.rejoin_user_events.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @user_event_service_stub.call_rpc :rejoin_user_events, request, options: options do |response, operation| - response = ::Gapic::Operation.new response, @operations_client, options: options - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Configuration class for the UserEventService API. - # - # This class represents the configuration for UserEventService, - # providing control over timeouts, retry behavior, logging, transport - # parameters, and other low-level controls. Certain parameters can also be - # applied individually to specific RPCs. See - # {::Google::Cloud::Retail::V2::UserEventService::Client::Configuration::Rpcs} - # for a list of RPCs that can be configured independently. - # - # Configuration can be applied globally to all clients, or to a single client - # on construction. - # - # @example - # - # # Modify the global config, setting the timeout for - # # write_user_event to 20 seconds, - # # and all remaining timeouts to 10 seconds. - # ::Google::Cloud::Retail::V2::UserEventService::Client.configure do |config| - # config.timeout = 10.0 - # config.rpcs.write_user_event.timeout = 20.0 - # end - # - # # Apply the above configuration only to a new client. - # client = ::Google::Cloud::Retail::V2::UserEventService::Client.new do |config| - # config.timeout = 10.0 - # config.rpcs.write_user_event.timeout = 20.0 - # end - # - # @!attribute [rw] endpoint - # A custom service endpoint, as a hostname or hostname:port. The default is - # nil, indicating to use the default endpoint in the current universe domain. - # @return [::String,nil] - # @!attribute [rw] credentials - # Credentials to send with calls. You may provide any of the following types: - # * (`Google::Auth::Credentials`) A googleauth credentials object - # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) - # * (`Signet::OAuth2::Client`) A signet oauth2 client object - # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) - # * (`GRPC::Core::Channel`) a gRPC channel with included credentials - # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object - # * (`nil`) indicating no credentials - # - # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials - # is deprecated. Providing an unvalidated credential configuration to - # Google APIs can compromise the security of your systems and data. - # - # @example - # - # # The recommended way to provide credentials is to use the `make_creds` method - # # on the appropriate credentials class for your environment. - # - # require "googleauth" - # - # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds( - # json_key_io: ::File.open("/path/to/keyfile.json") - # ) - # - # client = ::Google::Cloud::Retail::V2::UserEventService::Client.new do |config| - # config.credentials = credentials - # end - # - # @note Warning: If you accept a credential configuration (JSON file or Hash) from an - # external source for authentication to Google Cloud, you must validate it before - # providing it to a Google API client library. Providing an unvalidated credential - # configuration to Google APIs can compromise the security of your systems and data. - # For more information, refer to [Validate credential configurations from external - # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). - # @return [::Object] - # @!attribute [rw] scope - # The OAuth scopes - # @return [::Array<::String>] - # @!attribute [rw] lib_name - # The library name as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] lib_version - # The library version as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] channel_args - # Extra parameters passed to the gRPC channel. Note: this is ignored if a - # `GRPC::Core::Channel` object is provided as the credential. - # @return [::Hash] - # @!attribute [rw] interceptors - # An array of interceptors that are run before calls are executed. - # @return [::Array<::GRPC::ClientInterceptor>] - # @!attribute [rw] timeout - # The call timeout in seconds. - # @return [::Numeric] - # @!attribute [rw] metadata - # Additional gRPC headers to be sent with the call. - # @return [::Hash{::Symbol=>::String}] - # @!attribute [rw] retry_policy - # The retry policy. The value is a hash with the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # @return [::Hash] - # @!attribute [rw] quota_project - # A separate project against which to charge quota. - # @return [::String] - # @!attribute [rw] universe_domain - # The universe domain within which to make requests. This determines the - # default endpoint URL. The default value of nil uses the environment - # universe (usually the default "googleapis.com" universe). - # @return [::String,nil] - # @!attribute [rw] logger - # A custom logger to use for request/response debug logging, or the value - # `:default` (the default) to construct a default logger, or `nil` to - # explicitly disable logging. - # @return [::Logger,:default,nil] - # - class Configuration - extend ::Gapic::Config - - # @private - # The endpoint specific to the default "googleapis.com" universe. Deprecated. - DEFAULT_ENDPOINT = "retail.googleapis.com" - - config_attr :endpoint, nil, ::String, nil - config_attr :credentials, nil do |value| - allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] - allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel - allowed.any? { |klass| klass === value } - end - config_attr :scope, nil, ::String, ::Array, nil - config_attr :lib_name, nil, ::String, nil - config_attr :lib_version, nil, ::String, nil - config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) - config_attr :interceptors, nil, ::Array, nil - config_attr :timeout, nil, ::Numeric, nil - config_attr :metadata, nil, ::Hash, nil - config_attr :retry_policy, nil, ::Hash, ::Proc, nil - config_attr :quota_project, nil, ::String, nil - config_attr :universe_domain, nil, ::String, nil - config_attr :logger, :default, ::Logger, nil, :default - - # @private - def initialize parent_config = nil - @parent_config = parent_config unless parent_config.nil? - - yield self if block_given? - end - - ## - # Configurations for individual RPCs - # @return [Rpcs] - # - def rpcs - @rpcs ||= begin - parent_rpcs = nil - parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) - Rpcs.new parent_rpcs - end - end - - ## - # Configuration for the channel pool - # @return [::Gapic::ServiceStub::ChannelPool::Configuration] - # - def channel_pool - @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new - end - - ## - # Configuration RPC class for the UserEventService API. - # - # Includes fields providing the configuration for each RPC in this service. - # Each configuration object is of type `Gapic::Config::Method` and includes - # the following configuration fields: - # - # * `timeout` (*type:* `Numeric`) - The call timeout in seconds - # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers - # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields - # include the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # - class Rpcs - ## - # RPC-specific configuration for `write_user_event` - # @return [::Gapic::Config::Method] - # - attr_reader :write_user_event - ## - # RPC-specific configuration for `collect_user_event` - # @return [::Gapic::Config::Method] - # - attr_reader :collect_user_event - ## - # RPC-specific configuration for `purge_user_events` - # @return [::Gapic::Config::Method] - # - attr_reader :purge_user_events - ## - # RPC-specific configuration for `import_user_events` - # @return [::Gapic::Config::Method] - # - attr_reader :import_user_events - ## - # RPC-specific configuration for `rejoin_user_events` - # @return [::Gapic::Config::Method] - # - attr_reader :rejoin_user_events - - # @private - def initialize parent_rpcs = nil - write_user_event_config = parent_rpcs.write_user_event if parent_rpcs.respond_to? :write_user_event - @write_user_event = ::Gapic::Config::Method.new write_user_event_config - collect_user_event_config = parent_rpcs.collect_user_event if parent_rpcs.respond_to? :collect_user_event - @collect_user_event = ::Gapic::Config::Method.new collect_user_event_config - purge_user_events_config = parent_rpcs.purge_user_events if parent_rpcs.respond_to? :purge_user_events - @purge_user_events = ::Gapic::Config::Method.new purge_user_events_config - import_user_events_config = parent_rpcs.import_user_events if parent_rpcs.respond_to? :import_user_events - @import_user_events = ::Gapic::Config::Method.new import_user_events_config - rejoin_user_events_config = parent_rpcs.rejoin_user_events if parent_rpcs.respond_to? :rejoin_user_events - @rejoin_user_events = ::Gapic::Config::Method.new rejoin_user_events_config - - yield self if block_given? - end - end - end - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/credentials.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/credentials.rb deleted file mode 100644 index d7842cfcb893..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/credentials.rb +++ /dev/null @@ -1,51 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "googleauth" - -module Google - module Cloud - module Retail - module V2 - module UserEventService - # Credentials for the UserEventService API. - class Credentials < ::Google::Auth::Credentials - self.scope = [ - "https://www.googleapis.com/auth/cloud-platform" - ] - self.env_vars = [ - "RETAIL_CREDENTIALS", - "RETAIL_KEYFILE", - "GOOGLE_CLOUD_CREDENTIALS", - "GOOGLE_CLOUD_KEYFILE", - "GCLOUD_KEYFILE", - "RETAIL_CREDENTIALS_JSON", - "RETAIL_KEYFILE_JSON", - "GOOGLE_CLOUD_CREDENTIALS_JSON", - "GOOGLE_CLOUD_KEYFILE_JSON", - "GCLOUD_KEYFILE_JSON" - ] - self.paths = [ - "~/.config/google_cloud/application_default_credentials.json" - ] - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/operations.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/operations.rb deleted file mode 100644 index 77846fecafab..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/operations.rb +++ /dev/null @@ -1,843 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "gapic/operation" -require "google/longrunning/operations_pb" - -module Google - module Cloud - module Retail - module V2 - module UserEventService - # Service that implements Longrunning Operations API. - class Operations - # @private - API_VERSION = "" - - # @private - DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" - - # @private - attr_reader :operations_stub - - ## - # Configuration for the UserEventService Operations API. - # - # @yield [config] Configure the Operations client. - # @yieldparam config [Operations::Configuration] - # - # @return [Operations::Configuration] - # - def self.configure - @configure ||= Operations::Configuration.new - yield @configure if block_given? - @configure - end - - ## - # Configure the UserEventService Operations instance. - # - # The configuration is set to the derived mode, meaning that values can be changed, - # but structural changes (adding new fields, etc.) are not allowed. Structural changes - # should be made on {Operations.configure}. - # - # @yield [config] Configure the Operations client. - # @yieldparam config [Operations::Configuration] - # - # @return [Operations::Configuration] - # - def configure - yield @config if block_given? - @config - end - - ## - # The effective universe domain - # - # @return [String] - # - def universe_domain - @operations_stub.universe_domain - end - - ## - # Create a new Operations client object. - # - # @yield [config] Configure the Client client. - # @yieldparam config [Operations::Configuration] - # - def initialize - # These require statements are intentionally placed here to initialize - # the gRPC module only when it's required. - # See https://github.com/googleapis/toolkit/issues/446 - require "gapic/grpc" - require "google/longrunning/operations_services_pb" - - # Create the configuration object - @config = Configuration.new Operations.configure - - # Yield the configuration if needed - yield @config if block_given? - - # Create credentials - credentials = @config.credentials - credentials ||= Credentials.default scope: @config.scope - if credentials.is_a?(::String) || credentials.is_a?(::Hash) - credentials = Credentials.new credentials, scope: @config.scope - end - @quota_project_id = @config.quota_project - @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id - - @operations_stub = ::Gapic::ServiceStub.new( - ::Google::Longrunning::Operations::Stub, - credentials: credentials, - endpoint: @config.endpoint, - endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, - universe_domain: @config.universe_domain, - channel_args: @config.channel_args, - interceptors: @config.interceptors, - channel_pool_config: @config.channel_pool - ) - - # Used by an LRO wrapper for some methods of this service - @operations_client = self - end - - # Service calls - - ## - # Lists operations that match the specified filter in the request. If the - # server doesn't support this method, it returns `UNIMPLEMENTED`. - # - # @overload list_operations(request, options = nil) - # Pass arguments to `list_operations` via a request object, either of type - # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::ListOperationsRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload list_operations(name: nil, filter: nil, page_size: nil, page_token: nil, return_partial_success: nil) - # Pass arguments to `list_operations` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation's parent resource. - # @param filter [::String] - # The standard list filter. - # @param page_size [::Integer] - # The standard list page size. - # @param page_token [::String] - # The standard list page token. - # @param return_partial_success [::Boolean] - # When set to `true`, operations that are reachable are returned as normal, - # and those that are unreachable are returned in the - # [ListOperationsResponse.unreachable] field. - # - # This can only be `true` when reading across collections e.g. when `parent` - # is set to `"projects/example/locations/-"`. - # - # This field is not by default supported and will result in an - # `UNIMPLEMENTED` error if set unless explicitly documented otherwise in - # service or product specific documentation. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::PagedEnumerable<::Gapic::Operation>] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::PagedEnumerable<::Gapic::Operation>] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::ListOperationsRequest.new - # - # # Call the list_operations method. - # result = client.list_operations request - # - # # The returned object is of type Gapic::PagedEnumerable. You can iterate - # # over elements, and API calls will be issued to fetch pages as needed. - # result.each do |item| - # # Each element is of type ::Google::Longrunning::Operation. - # p item - # end - # - def list_operations request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::ListOperationsRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.list_operations.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.name - header_params["name"] = request.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.list_operations.timeout, - metadata: metadata, - retry_policy: @config.rpcs.list_operations.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.call_rpc :list_operations, request, options: options do |response, operation| - wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client } - response = ::Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Gets the latest state of a long-running operation. Clients can use this - # method to poll the operation result at intervals as recommended by the API - # service. - # - # @overload get_operation(request, options = nil) - # Pass arguments to `get_operation` via a request object, either of type - # {::Google::Longrunning::GetOperationRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::GetOperationRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload get_operation(name: nil) - # Pass arguments to `get_operation` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation resource. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::Operation] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::GetOperationRequest.new - # - # # Call the get_operation method. - # result = client.get_operation request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def get_operation request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::GetOperationRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.get_operation.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.name - header_params["name"] = request.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.get_operation.timeout, - metadata: metadata, - retry_policy: @config.rpcs.get_operation.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.call_rpc :get_operation, request, options: options do |response, operation| - response = ::Gapic::Operation.new response, @operations_client, options: options - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Deletes a long-running operation. This method indicates that the client is - # no longer interested in the operation result. It does not cancel the - # operation. If the server doesn't support this method, it returns - # `google.rpc.Code.UNIMPLEMENTED`. - # - # @overload delete_operation(request, options = nil) - # Pass arguments to `delete_operation` via a request object, either of type - # {::Google::Longrunning::DeleteOperationRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::DeleteOperationRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload delete_operation(name: nil) - # Pass arguments to `delete_operation` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation resource to be deleted. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Protobuf::Empty] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Protobuf::Empty] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::DeleteOperationRequest.new - # - # # Call the delete_operation method. - # result = client.delete_operation request - # - # # The returned object is of type Google::Protobuf::Empty. - # p result - # - def delete_operation request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::DeleteOperationRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.delete_operation.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.name - header_params["name"] = request.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.delete_operation.timeout, - metadata: metadata, - retry_policy: @config.rpcs.delete_operation.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.call_rpc :delete_operation, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Starts asynchronous cancellation on a long-running operation. The server - # makes a best effort to cancel the operation, but success is not - # guaranteed. If the server doesn't support this method, it returns - # `google.rpc.Code.UNIMPLEMENTED`. Clients can use - # Operations.GetOperation or - # other methods to check whether the cancellation succeeded or whether the - # operation completed despite cancellation. On successful cancellation, - # the operation is not deleted; instead, it becomes an operation with - # an {::Google::Longrunning::Operation#error Operation.error} value with a - # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to - # `Code.CANCELLED`. - # - # @overload cancel_operation(request, options = nil) - # Pass arguments to `cancel_operation` via a request object, either of type - # {::Google::Longrunning::CancelOperationRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::CancelOperationRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload cancel_operation(name: nil) - # Pass arguments to `cancel_operation` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation resource to be cancelled. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Google::Protobuf::Empty] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Google::Protobuf::Empty] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::CancelOperationRequest.new - # - # # Call the cancel_operation method. - # result = client.cancel_operation request - # - # # The returned object is of type Google::Protobuf::Empty. - # p result - # - def cancel_operation request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::CancelOperationRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.cancel_operation.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - header_params = {} - if request.name - header_params["name"] = request.name - end - - request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&") - metadata[:"x-goog-request-params"] ||= request_params_header - - options.apply_defaults timeout: @config.rpcs.cancel_operation.timeout, - metadata: metadata, - retry_policy: @config.rpcs.cancel_operation.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation| - yield response, operation if block_given? - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Waits until the specified long-running operation is done or reaches at most - # a specified timeout, returning the latest state. If the operation is - # already done, the latest state is immediately returned. If the timeout - # specified is greater than the default HTTP/RPC timeout, the HTTP/RPC - # timeout is used. If the server does not support this method, it returns - # `google.rpc.Code.UNIMPLEMENTED`. - # Note that this method is on a best-effort basis. It may return the latest - # state before the specified timeout (including immediately), meaning even an - # immediate response is no guarantee that the operation is done. - # - # @overload wait_operation(request, options = nil) - # Pass arguments to `wait_operation` via a request object, either of type - # {::Google::Longrunning::WaitOperationRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::WaitOperationRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. - # - # @overload wait_operation(name: nil, timeout: nil) - # Pass arguments to `wait_operation` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation resource to wait on. - # @param timeout [::Google::Protobuf::Duration, ::Hash] - # The maximum duration to wait before timing out. If left blank, the wait - # will be at most the time permitted by the underlying HTTP/RPC protocol. - # If RPC context deadline is also specified, the shorter one will be used. - # - # @yield [response, operation] Access the result along with the RPC operation - # @yieldparam response [::Gapic::Operation] - # @yieldparam operation [::GRPC::ActiveCall::Operation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the RPC is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::WaitOperationRequest.new - # - # # Call the wait_operation method. - # result = client.wait_operation request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def wait_operation request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::WaitOperationRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - metadata = @config.rpcs.wait_operation.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION - metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.wait_operation.timeout, - metadata: metadata, - retry_policy: @config.rpcs.wait_operation.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation| - response = ::Gapic::Operation.new response, @operations_client, options: options - yield response, operation if block_given? - throw :response, response - end - rescue ::GRPC::BadStatus => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Configuration class for the Operations API. - # - # This class represents the configuration for Operations, - # providing control over timeouts, retry behavior, logging, transport - # parameters, and other low-level controls. Certain parameters can also be - # applied individually to specific RPCs. See - # {::Google::Longrunning::Operations::Client::Configuration::Rpcs} - # for a list of RPCs that can be configured independently. - # - # Configuration can be applied globally to all clients, or to a single client - # on construction. - # - # @example - # - # # Modify the global config, setting the timeout for - # # list_operations to 20 seconds, - # # and all remaining timeouts to 10 seconds. - # ::Google::Longrunning::Operations::Client.configure do |config| - # config.timeout = 10.0 - # config.rpcs.list_operations.timeout = 20.0 - # end - # - # # Apply the above configuration only to a new client. - # client = ::Google::Longrunning::Operations::Client.new do |config| - # config.timeout = 10.0 - # config.rpcs.list_operations.timeout = 20.0 - # end - # - # @!attribute [rw] endpoint - # A custom service endpoint, as a hostname or hostname:port. The default is - # nil, indicating to use the default endpoint in the current universe domain. - # @return [::String,nil] - # @!attribute [rw] credentials - # Credentials to send with calls. You may provide any of the following types: - # * (`Google::Auth::Credentials`) A googleauth credentials object - # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) - # * (`Signet::OAuth2::Client`) A signet oauth2 client object - # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) - # * (`GRPC::Core::Channel`) a gRPC channel with included credentials - # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object - # * (`nil`) indicating no credentials - # - # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials - # is deprecated. Providing an unvalidated credential configuration to - # Google APIs can compromise the security of your systems and data. - # - # @example - # - # # The recommended way to provide credentials is to use the `make_creds` method - # # on the appropriate credentials class for your environment. - # - # require "googleauth" - # - # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds( - # json_key_io: ::File.open("/path/to/keyfile.json") - # ) - # - # client = ::Google::Longrunning::Operations::Client.new do |config| - # config.credentials = credentials - # end - # - # @note Warning: If you accept a credential configuration (JSON file or Hash) from an - # external source for authentication to Google Cloud, you must validate it before - # providing it to a Google API client library. Providing an unvalidated credential - # configuration to Google APIs can compromise the security of your systems and data. - # For more information, refer to [Validate credential configurations from external - # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). - # @return [::Object] - # @!attribute [rw] scope - # The OAuth scopes - # @return [::Array<::String>] - # @!attribute [rw] lib_name - # The library name as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] lib_version - # The library version as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] channel_args - # Extra parameters passed to the gRPC channel. Note: this is ignored if a - # `GRPC::Core::Channel` object is provided as the credential. - # @return [::Hash] - # @!attribute [rw] interceptors - # An array of interceptors that are run before calls are executed. - # @return [::Array<::GRPC::ClientInterceptor>] - # @!attribute [rw] timeout - # The call timeout in seconds. - # @return [::Numeric] - # @!attribute [rw] metadata - # Additional gRPC headers to be sent with the call. - # @return [::Hash{::Symbol=>::String}] - # @!attribute [rw] retry_policy - # The retry policy. The value is a hash with the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # @return [::Hash] - # @!attribute [rw] quota_project - # A separate project against which to charge quota. - # @return [::String] - # @!attribute [rw] universe_domain - # The universe domain within which to make requests. This determines the - # default endpoint URL. The default value of nil uses the environment - # universe (usually the default "googleapis.com" universe). - # @return [::String,nil] - # @!attribute [rw] logger - # A custom logger to use for request/response debug logging, or the value - # `:default` (the default) to construct a default logger, or `nil` to - # explicitly disable logging. - # @return [::Logger,:default,nil] - # - class Configuration - extend ::Gapic::Config - - # @private - # The endpoint specific to the default "googleapis.com" universe. Deprecated. - DEFAULT_ENDPOINT = "retail.googleapis.com" - - config_attr :endpoint, nil, ::String, nil - config_attr :credentials, nil do |value| - allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] - allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel - allowed.any? { |klass| klass === value } - end - config_attr :scope, nil, ::String, ::Array, nil - config_attr :lib_name, nil, ::String, nil - config_attr :lib_version, nil, ::String, nil - config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) - config_attr :interceptors, nil, ::Array, nil - config_attr :timeout, nil, ::Numeric, nil - config_attr :metadata, nil, ::Hash, nil - config_attr :retry_policy, nil, ::Hash, ::Proc, nil - config_attr :quota_project, nil, ::String, nil - config_attr :universe_domain, nil, ::String, nil - config_attr :logger, :default, ::Logger, nil, :default - - # @private - def initialize parent_config = nil - @parent_config = parent_config unless parent_config.nil? - - yield self if block_given? - end - - ## - # Configurations for individual RPCs - # @return [Rpcs] - # - def rpcs - @rpcs ||= begin - parent_rpcs = nil - parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) - Rpcs.new parent_rpcs - end - end - - ## - # Configuration for the channel pool - # @return [::Gapic::ServiceStub::ChannelPool::Configuration] - # - def channel_pool - @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new - end - - ## - # Configuration RPC class for the Operations API. - # - # Includes fields providing the configuration for each RPC in this service. - # Each configuration object is of type `Gapic::Config::Method` and includes - # the following configuration fields: - # - # * `timeout` (*type:* `Numeric`) - The call timeout in seconds - # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers - # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields - # include the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # - class Rpcs - ## - # RPC-specific configuration for `list_operations` - # @return [::Gapic::Config::Method] - # - attr_reader :list_operations - ## - # RPC-specific configuration for `get_operation` - # @return [::Gapic::Config::Method] - # - attr_reader :get_operation - ## - # RPC-specific configuration for `delete_operation` - # @return [::Gapic::Config::Method] - # - attr_reader :delete_operation - ## - # RPC-specific configuration for `cancel_operation` - # @return [::Gapic::Config::Method] - # - attr_reader :cancel_operation - ## - # RPC-specific configuration for `wait_operation` - # @return [::Gapic::Config::Method] - # - attr_reader :wait_operation - - # @private - def initialize parent_rpcs = nil - list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations - @list_operations = ::Gapic::Config::Method.new list_operations_config - get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation - @get_operation = ::Gapic::Config::Method.new get_operation_config - delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation - @delete_operation = ::Gapic::Config::Method.new delete_operation_config - cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation - @cancel_operation = ::Gapic::Config::Method.new cancel_operation_config - wait_operation_config = parent_rpcs.wait_operation if parent_rpcs.respond_to? :wait_operation - @wait_operation = ::Gapic::Config::Method.new wait_operation_config - - yield self if block_given? - end - end - end - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/paths.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/paths.rb deleted file mode 100644 index 83bc1611ec7f..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/paths.rb +++ /dev/null @@ -1,75 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Cloud - module Retail - module V2 - module UserEventService - # Path helper methods for the UserEventService API. - module Paths - ## - # Create a fully-qualified Catalog resource string. - # - # The resource will be in the following format: - # - # `projects/{project}/locations/{location}/catalogs/{catalog}` - # - # @param project [String] - # @param location [String] - # @param catalog [String] - # - # @return [::String] - def catalog_path project:, location:, catalog: - raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" - raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" - - "projects/#{project}/locations/#{location}/catalogs/#{catalog}" - end - - ## - # Create a fully-qualified Product resource string. - # - # The resource will be in the following format: - # - # `projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}` - # - # @param project [String] - # @param location [String] - # @param catalog [String] - # @param branch [String] - # @param product [String] - # - # @return [::String] - def product_path project:, location:, catalog:, branch:, product: - raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" - raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" - raise ::ArgumentError, "catalog cannot contain /" if catalog.to_s.include? "/" - raise ::ArgumentError, "branch cannot contain /" if branch.to_s.include? "/" - - "projects/#{project}/locations/#{location}/catalogs/#{catalog}/branches/#{branch}/products/#{product}" - end - - extend self - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/rest.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/rest.rb deleted file mode 100644 index dfa91294298f..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/rest.rb +++ /dev/null @@ -1,53 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "gapic/rest" -require "gapic/config" -require "gapic/config/method" - -require "google/cloud/retail/v2/version" - -require "google/cloud/retail/v2/user_event_service/credentials" -require "google/cloud/retail/v2/user_event_service/paths" -require "google/cloud/retail/v2/user_event_service/rest/operations" -require "google/cloud/retail/v2/user_event_service/rest/client" - -module Google - module Cloud - module Retail - module V2 - ## - # Service for ingesting end user actions on the customer website. - # - # To load this service and instantiate a REST client: - # - # require "google/cloud/retail/v2/user_event_service/rest" - # client = ::Google::Cloud::Retail::V2::UserEventService::Rest::Client.new - # - module UserEventService - # Client for the REST transport - module Rest - end - end - end - end - end -end - -helper_path = ::File.join __dir__, "rest", "helpers.rb" -require "google/cloud/retail/v2/user_event_service/rest/helpers" if ::File.file? helper_path diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/rest/client.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/rest/client.rb deleted file mode 100644 index 623b46759f10..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/rest/client.rb +++ /dev/null @@ -1,930 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "google/cloud/errors" -require "google/cloud/retail/v2/user_event_service_pb" -require "google/cloud/retail/v2/user_event_service/rest/service_stub" -require "google/cloud/location/rest" - -module Google - module Cloud - module Retail - module V2 - module UserEventService - module Rest - ## - # REST client for the UserEventService service. - # - # Service for ingesting end user actions on the customer website. - # - class Client - # @private - API_VERSION = "" - - # @private - DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" - - include Paths - - # @private - attr_reader :user_event_service_stub - - ## - # Configure the UserEventService Client class. - # - # See {::Google::Cloud::Retail::V2::UserEventService::Rest::Client::Configuration} - # for a description of the configuration fields. - # - # @example - # - # # Modify the configuration for all UserEventService clients - # ::Google::Cloud::Retail::V2::UserEventService::Rest::Client.configure do |config| - # config.timeout = 10.0 - # end - # - # @yield [config] Configure the Client client. - # @yieldparam config [Client::Configuration] - # - # @return [Client::Configuration] - # - def self.configure - @configure ||= begin - namespace = ["Google", "Cloud", "Retail", "V2"] - parent_config = while namespace.any? - parent_name = namespace.join "::" - parent_const = const_get parent_name - break parent_const.configure if parent_const.respond_to? :configure - namespace.pop - end - default_config = Client::Configuration.new parent_config - - default_config.timeout = 10.0 - default_config.retry_policy = { - initial_delay: 0.1, max_delay: 5.0, multiplier: 1.3, retry_codes: [14, 4] - } - - default_config.rpcs.purge_user_events.timeout = 30.0 - default_config.rpcs.purge_user_events.retry_policy = { - initial_delay: 0.1, max_delay: 30.0, multiplier: 1.3, retry_codes: [14, 4] - } - - default_config.rpcs.import_user_events.timeout = 600.0 - default_config.rpcs.import_user_events.retry_policy = { - initial_delay: 0.1, max_delay: 300.0, multiplier: 1.3, retry_codes: [14, 4] - } - - default_config - end - yield @configure if block_given? - @configure - end - - ## - # Configure the UserEventService Client instance. - # - # The configuration is set to the derived mode, meaning that values can be changed, - # but structural changes (adding new fields, etc.) are not allowed. Structural changes - # should be made on {Client.configure}. - # - # See {::Google::Cloud::Retail::V2::UserEventService::Rest::Client::Configuration} - # for a description of the configuration fields. - # - # @yield [config] Configure the Client client. - # @yieldparam config [Client::Configuration] - # - # @return [Client::Configuration] - # - def configure - yield @config if block_given? - @config - end - - ## - # The effective universe domain - # - # @return [String] - # - def universe_domain - @user_event_service_stub.universe_domain - end - - ## - # Create a new UserEventService REST client object. - # - # @example - # - # # Create a client using the default configuration - # client = ::Google::Cloud::Retail::V2::UserEventService::Rest::Client.new - # - # # Create a client using a custom configuration - # client = ::Google::Cloud::Retail::V2::UserEventService::Rest::Client.new do |config| - # config.timeout = 10.0 - # end - # - # @yield [config] Configure the UserEventService client. - # @yieldparam config [Client::Configuration] - # - def initialize - # Create the configuration object - @config = Configuration.new Client.configure - - # Yield the configuration if needed - yield @config if block_given? - - # Create credentials - credentials = @config.credentials - # Use self-signed JWT if the endpoint is unchanged from default, - # but only if the default endpoint does not have a region prefix. - enable_self_signed_jwt = @config.endpoint.nil? || - (@config.endpoint == Configuration::DEFAULT_ENDPOINT && - !@config.endpoint.split(".").first.include?("-")) - credentials ||= Credentials.default scope: @config.scope, - enable_self_signed_jwt: enable_self_signed_jwt - if credentials.is_a?(::String) || credentials.is_a?(::Hash) - credentials = Credentials.new credentials, scope: @config.scope - end - - @quota_project_id = @config.quota_project - @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id - - @operations_client = ::Google::Cloud::Retail::V2::UserEventService::Rest::Operations.new do |config| - config.credentials = credentials - config.quota_project = @quota_project_id - config.endpoint = @config.endpoint - config.universe_domain = @config.universe_domain - end - - @user_event_service_stub = ::Google::Cloud::Retail::V2::UserEventService::Rest::ServiceStub.new( - endpoint: @config.endpoint, - endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, - universe_domain: @config.universe_domain, - credentials: credentials, - logger: @config.logger - ) - - @user_event_service_stub.logger(stub: true)&.info do |entry| - entry.set_system_name - entry.set_service - entry.message = "Created client for #{entry.service}" - entry.set_credentials_fields credentials - entry.set "customEndpoint", @config.endpoint if @config.endpoint - entry.set "defaultTimeout", @config.timeout if @config.timeout - entry.set "quotaProject", @quota_project_id if @quota_project_id - end - - @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config| - config.credentials = credentials - config.quota_project = @quota_project_id - config.endpoint = @user_event_service_stub.endpoint - config.universe_domain = @user_event_service_stub.universe_domain - config.logger = @user_event_service_stub.logger if config.respond_to? :logger= - end - end - - ## - # Get the associated client for long-running operations. - # - # @return [::Google::Cloud::Retail::V2::UserEventService::Rest::Operations] - # - attr_reader :operations_client - - ## - # Get the associated client for mix-in of the Locations. - # - # @return [Google::Cloud::Location::Locations::Rest::Client] - # - attr_reader :location_client - - ## - # The logger used for request/response debug logging. - # - # @return [Logger] - # - def logger - @user_event_service_stub.logger - end - - # Service calls - - ## - # Writes a single user event. - # - # @overload write_user_event(request, options = nil) - # Pass arguments to `write_user_event` via a request object, either of type - # {::Google::Cloud::Retail::V2::WriteUserEventRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::WriteUserEventRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload write_user_event(parent: nil, user_event: nil, write_async: nil) - # Pass arguments to `write_user_event` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. The parent catalog resource name, such as - # `projects/1234/locations/global/catalogs/default_catalog`. - # @param user_event [::Google::Cloud::Retail::V2::UserEvent, ::Hash] - # Required. User event to write. - # @param write_async [::Boolean] - # If set to true, the user event will be written asynchronously after - # validation, and the API will respond without waiting for the write. - # Therefore, silent failures can occur even if the API returns success. In - # case of silent failures, error messages can be found in Stackdriver logs. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::UserEvent] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::UserEvent] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::UserEventService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::WriteUserEventRequest.new - # - # # Call the write_user_event method. - # result = client.write_user_event request - # - # # The returned object is of type Google::Cloud::Retail::V2::UserEvent. - # p result - # - def write_user_event request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::WriteUserEventRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.write_user_event.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.write_user_event.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.write_user_event.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @user_event_service_stub.write_user_event request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Writes a single user event from the browser. - # - # For larger user event payload over 16 KB, the POST method should be used - # instead, otherwise a 400 Bad Request error is returned. - # - # This method is used only by the Retail API JavaScript pixel and Google Tag - # Manager. Users should not call this method directly. - # - # @overload collect_user_event(request, options = nil) - # Pass arguments to `collect_user_event` via a request object, either of type - # {::Google::Cloud::Retail::V2::CollectUserEventRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::CollectUserEventRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload collect_user_event(prebuilt_rule: nil, parent: nil, user_event: nil, uri: nil, ets: nil, raw_json: nil) - # Pass arguments to `collect_user_event` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param prebuilt_rule [::String] - # The prebuilt rule name that can convert a specific type of raw_json. - # For example: "ga4_bq" rule for the GA4 user event schema. - # @param parent [::String] - # Required. The parent catalog name, such as - # `projects/1234/locations/global/catalogs/default_catalog`. - # @param user_event [::String] - # Required. URL encoded UserEvent proto with a length limit of 2,000,000 - # characters. - # @param uri [::String] - # The URL including cgi-parameters but excluding the hash fragment with a - # length limit of 5,000 characters. This is often more useful than the - # referer URL, because many browsers only send the domain for 3rd party - # requests. - # @param ets [::Integer] - # The event timestamp in milliseconds. This prevents browser caching of - # otherwise identical get requests. The name is abbreviated to reduce the - # payload bytes. - # @param raw_json [::String] - # An arbitrary serialized JSON string that contains necessary information - # that can comprise a user event. When this field is specified, the - # user_event field will be ignored. Note: line-delimited JSON is not - # supported, a single JSON only. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Api::HttpBody] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Api::HttpBody] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::UserEventService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::CollectUserEventRequest.new - # - # # Call the collect_user_event method. - # result = client.collect_user_event request - # - # # The returned object is of type Google::Api::HttpBody. - # p result - # - def collect_user_event request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::CollectUserEventRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.collect_user_event.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.collect_user_event.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.collect_user_event.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @user_event_service_stub.collect_user_event request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Deletes permanently all user events specified by the filter provided. - # Depending on the number of events specified by the filter, this operation - # could take hours or days to complete. To test a filter, use the list - # command first. - # - # @overload purge_user_events(request, options = nil) - # Pass arguments to `purge_user_events` via a request object, either of type - # {::Google::Cloud::Retail::V2::PurgeUserEventsRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::PurgeUserEventsRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload purge_user_events(parent: nil, filter: nil, force: nil) - # Pass arguments to `purge_user_events` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. The resource name of the catalog under which the events are - # created. The format is - # `projects/${projectId}/locations/global/catalogs/${catalogId}` - # @param filter [::String] - # Required. The filter string to specify the events to be deleted with a - # length limit of 5,000 characters. Empty string filter is not allowed. The - # eligible fields for filtering are: - # - # * `eventType`: Double quoted - # {::Google::Cloud::Retail::V2::UserEvent#event_type UserEvent.event_type} string. - # * `eventTime`: in ISO 8601 "zulu" format. - # * `visitorId`: Double quoted string. Specifying this will delete all - # events associated with a visitor. - # * `userId`: Double quoted string. Specifying this will delete all events - # associated with a user. - # - # Examples: - # - # * Deleting all events in a time range: - # `eventTime > "2012-04-23T18:25:43.511Z" - # eventTime < "2012-04-23T18:30:43.511Z"` - # * Deleting specific eventType in time range: - # `eventTime > "2012-04-23T18:25:43.511Z" eventType = "detail-page-view"` - # * Deleting all events for a specific visitor: - # `visitorId = "visitor1024"` - # - # The filtering fields are assumed to have an implicit AND. - # @param force [::Boolean] - # Actually perform the purge. - # If `force` is set to false, the method will return the expected purge count - # without deleting any user events. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Gapic::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::UserEventService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::PurgeUserEventsRequest.new - # - # # Call the purge_user_events method. - # result = client.purge_user_events request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def purge_user_events request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::PurgeUserEventsRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.purge_user_events.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.purge_user_events.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.purge_user_events.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @user_event_service_stub.purge_user_events request, options do |result, operation| - result = ::Gapic::Operation.new result, @operations_client, options: options - yield result, operation if block_given? - throw :response, result - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Bulk import of User events. Request processing might be - # synchronous. Events that already exist are skipped. - # Use this method for backfilling historical user events. - # - # `Operation.response` is of type `ImportResponse`. Note that it is - # possible for a subset of the items to be successfully inserted. - # `Operation.metadata` is of type `ImportMetadata`. - # - # @overload import_user_events(request, options = nil) - # Pass arguments to `import_user_events` via a request object, either of type - # {::Google::Cloud::Retail::V2::ImportUserEventsRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::ImportUserEventsRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload import_user_events(parent: nil, input_config: nil, errors_config: nil) - # Pass arguments to `import_user_events` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. `projects/1234/locations/global/catalogs/default_catalog` - # @param input_config [::Google::Cloud::Retail::V2::UserEventInputConfig, ::Hash] - # Required. The desired input location of the data. - # @param errors_config [::Google::Cloud::Retail::V2::ImportErrorsConfig, ::Hash] - # The desired location of errors incurred during the Import. Cannot be set - # for inline user event imports. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Gapic::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::UserEventService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::ImportUserEventsRequest.new - # - # # Call the import_user_events method. - # result = client.import_user_events request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def import_user_events request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::ImportUserEventsRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.import_user_events.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.import_user_events.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.import_user_events.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @user_event_service_stub.import_user_events request, options do |result, operation| - result = ::Gapic::Operation.new result, @operations_client, options: options - yield result, operation if block_given? - throw :response, result - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Starts a user-event rejoin operation with latest product catalog. Events - # are not annotated with detailed product information for products that are - # missing from the catalog when the user event is ingested. These - # events are stored as unjoined events with limited usage on training and - # serving. You can use this method to start a join operation on specified - # events with the latest version of product catalog. You can also use this - # method to correct events joined with the wrong product catalog. A rejoin - # operation can take hours or days to complete. - # - # @overload rejoin_user_events(request, options = nil) - # Pass arguments to `rejoin_user_events` via a request object, either of type - # {::Google::Cloud::Retail::V2::RejoinUserEventsRequest} or an equivalent Hash. - # - # @param request [::Google::Cloud::Retail::V2::RejoinUserEventsRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload rejoin_user_events(parent: nil, user_event_rejoin_scope: nil) - # Pass arguments to `rejoin_user_events` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param parent [::String] - # Required. The parent catalog resource name, such as - # `projects/1234/locations/global/catalogs/default_catalog`. - # @param user_event_rejoin_scope [::Google::Cloud::Retail::V2::RejoinUserEventsRequest::UserEventRejoinScope] - # The type of the user event rejoin to define the scope and range of the user - # events to be rejoined with the latest product catalog. Defaults to - # `USER_EVENT_REJOIN_SCOPE_UNSPECIFIED` if this field is not set, or set to - # an invalid integer value. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Gapic::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/cloud/retail/v2" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Cloud::Retail::V2::UserEventService::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Cloud::Retail::V2::RejoinUserEventsRequest.new - # - # # Call the rejoin_user_events method. - # result = client.rejoin_user_events request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def rejoin_user_events request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Retail::V2::RejoinUserEventsRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.rejoin_user_events.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.rejoin_user_events.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.rejoin_user_events.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @user_event_service_stub.rejoin_user_events request, options do |result, operation| - result = ::Gapic::Operation.new result, @operations_client, options: options - yield result, operation if block_given? - throw :response, result - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Configuration class for the UserEventService REST API. - # - # This class represents the configuration for UserEventService REST, - # providing control over timeouts, retry behavior, logging, transport - # parameters, and other low-level controls. Certain parameters can also be - # applied individually to specific RPCs. See - # {::Google::Cloud::Retail::V2::UserEventService::Rest::Client::Configuration::Rpcs} - # for a list of RPCs that can be configured independently. - # - # Configuration can be applied globally to all clients, or to a single client - # on construction. - # - # @example - # - # # Modify the global config, setting the timeout for - # # write_user_event to 20 seconds, - # # and all remaining timeouts to 10 seconds. - # ::Google::Cloud::Retail::V2::UserEventService::Rest::Client.configure do |config| - # config.timeout = 10.0 - # config.rpcs.write_user_event.timeout = 20.0 - # end - # - # # Apply the above configuration only to a new client. - # client = ::Google::Cloud::Retail::V2::UserEventService::Rest::Client.new do |config| - # config.timeout = 10.0 - # config.rpcs.write_user_event.timeout = 20.0 - # end - # - # @!attribute [rw] endpoint - # A custom service endpoint, as a hostname or hostname:port. The default is - # nil, indicating to use the default endpoint in the current universe domain. - # @return [::String,nil] - # @!attribute [rw] credentials - # Credentials to send with calls. You may provide any of the following types: - # * (`String`) The path to a service account key file in JSON format - # * (`Hash`) A service account key as a Hash - # * (`Google::Auth::Credentials`) A googleauth credentials object - # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) - # * (`Signet::OAuth2::Client`) A signet oauth2 client object - # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) - # * (`nil`) indicating no credentials - # - # Warning: If you accept a credential configuration (JSON file or Hash) from an - # external source for authentication to Google Cloud, you must validate it before - # providing it to a Google API client library. Providing an unvalidated credential - # configuration to Google APIs can compromise the security of your systems and data. - # For more information, refer to [Validate credential configurations from external - # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). - # @return [::Object] - # @!attribute [rw] scope - # The OAuth scopes - # @return [::Array<::String>] - # @!attribute [rw] lib_name - # The library name as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] lib_version - # The library version as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] timeout - # The call timeout in seconds. - # @return [::Numeric] - # @!attribute [rw] metadata - # Additional headers to be sent with the call. - # @return [::Hash{::Symbol=>::String}] - # @!attribute [rw] retry_policy - # The retry policy. The value is a hash with the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # @return [::Hash] - # @!attribute [rw] quota_project - # A separate project against which to charge quota. - # @return [::String] - # @!attribute [rw] universe_domain - # The universe domain within which to make requests. This determines the - # default endpoint URL. The default value of nil uses the environment - # universe (usually the default "googleapis.com" universe). - # @return [::String,nil] - # @!attribute [rw] logger - # A custom logger to use for request/response debug logging, or the value - # `:default` (the default) to construct a default logger, or `nil` to - # explicitly disable logging. - # @return [::Logger,:default,nil] - # - class Configuration - extend ::Gapic::Config - - # @private - # The endpoint specific to the default "googleapis.com" universe. Deprecated. - DEFAULT_ENDPOINT = "retail.googleapis.com" - - config_attr :endpoint, nil, ::String, nil - config_attr :credentials, nil do |value| - allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] - allowed.any? { |klass| klass === value } - end - config_attr :scope, nil, ::String, ::Array, nil - config_attr :lib_name, nil, ::String, nil - config_attr :lib_version, nil, ::String, nil - config_attr :timeout, nil, ::Numeric, nil - config_attr :metadata, nil, ::Hash, nil - config_attr :retry_policy, nil, ::Hash, ::Proc, nil - config_attr :quota_project, nil, ::String, nil - config_attr :universe_domain, nil, ::String, nil - config_attr :logger, :default, ::Logger, nil, :default - - # @private - def initialize parent_config = nil - @parent_config = parent_config unless parent_config.nil? - - yield self if block_given? - end - - ## - # Configurations for individual RPCs - # @return [Rpcs] - # - def rpcs - @rpcs ||= begin - parent_rpcs = nil - parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) - Rpcs.new parent_rpcs - end - end - - ## - # Configuration RPC class for the UserEventService API. - # - # Includes fields providing the configuration for each RPC in this service. - # Each configuration object is of type `Gapic::Config::Method` and includes - # the following configuration fields: - # - # * `timeout` (*type:* `Numeric`) - The call timeout in seconds - # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers - # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields - # include the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # - class Rpcs - ## - # RPC-specific configuration for `write_user_event` - # @return [::Gapic::Config::Method] - # - attr_reader :write_user_event - ## - # RPC-specific configuration for `collect_user_event` - # @return [::Gapic::Config::Method] - # - attr_reader :collect_user_event - ## - # RPC-specific configuration for `purge_user_events` - # @return [::Gapic::Config::Method] - # - attr_reader :purge_user_events - ## - # RPC-specific configuration for `import_user_events` - # @return [::Gapic::Config::Method] - # - attr_reader :import_user_events - ## - # RPC-specific configuration for `rejoin_user_events` - # @return [::Gapic::Config::Method] - # - attr_reader :rejoin_user_events - - # @private - def initialize parent_rpcs = nil - write_user_event_config = parent_rpcs.write_user_event if parent_rpcs.respond_to? :write_user_event - @write_user_event = ::Gapic::Config::Method.new write_user_event_config - collect_user_event_config = parent_rpcs.collect_user_event if parent_rpcs.respond_to? :collect_user_event - @collect_user_event = ::Gapic::Config::Method.new collect_user_event_config - purge_user_events_config = parent_rpcs.purge_user_events if parent_rpcs.respond_to? :purge_user_events - @purge_user_events = ::Gapic::Config::Method.new purge_user_events_config - import_user_events_config = parent_rpcs.import_user_events if parent_rpcs.respond_to? :import_user_events - @import_user_events = ::Gapic::Config::Method.new import_user_events_config - rejoin_user_events_config = parent_rpcs.rejoin_user_events if parent_rpcs.respond_to? :rejoin_user_events - @rejoin_user_events = ::Gapic::Config::Method.new rejoin_user_events_config - - yield self if block_given? - end - end - end - end - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/rest/operations.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/rest/operations.rb deleted file mode 100644 index 0cf60d8bffb9..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/rest/operations.rb +++ /dev/null @@ -1,962 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "gapic/operation" - -module Google - module Cloud - module Retail - module V2 - module UserEventService - module Rest - # Service that implements Longrunning Operations API. - class Operations - # @private - API_VERSION = "" - - # @private - DEFAULT_ENDPOINT_TEMPLATE = "retail.$UNIVERSE_DOMAIN$" - - # @private - attr_reader :operations_stub - - ## - # Configuration for the UserEventService Operations API. - # - # @yield [config] Configure the Operations client. - # @yieldparam config [Operations::Configuration] - # - # @return [Operations::Configuration] - # - def self.configure - @configure ||= Operations::Configuration.new - yield @configure if block_given? - @configure - end - - ## - # Configure the UserEventService Operations instance. - # - # The configuration is set to the derived mode, meaning that values can be changed, - # but structural changes (adding new fields, etc.) are not allowed. Structural changes - # should be made on {Operations.configure}. - # - # @yield [config] Configure the Operations client. - # @yieldparam config [Operations::Configuration] - # - # @return [Operations::Configuration] - # - def configure - yield @config if block_given? - @config - end - - ## - # The effective universe domain - # - # @return [String] - # - def universe_domain - @operations_stub.universe_domain - end - - ## - # Create a new Operations client object. - # - # @yield [config] Configure the Client client. - # @yieldparam config [Operations::Configuration] - # - def initialize - # Create the configuration object - @config = Configuration.new Operations.configure - - # Yield the configuration if needed - yield @config if block_given? - - # Create credentials - credentials = @config.credentials - credentials ||= Credentials.default scope: @config.scope - if credentials.is_a?(::String) || credentials.is_a?(::Hash) - credentials = Credentials.new credentials, scope: @config.scope - end - - @quota_project_id = @config.quota_project - @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id - - @operations_stub = OperationsServiceStub.new( - endpoint: @config.endpoint, - endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, - universe_domain: @config.universe_domain, - credentials: credentials - ) - - # Used by an LRO wrapper for some methods of this service - @operations_client = self - end - - # Service calls - - ## - # Lists operations that match the specified filter in the request. If the - # server doesn't support this method, it returns `UNIMPLEMENTED`. - # - # @overload list_operations(request, options = nil) - # Pass arguments to `list_operations` via a request object, either of type - # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::ListOperationsRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload list_operations(name: nil, filter: nil, page_size: nil, page_token: nil, return_partial_success: nil) - # Pass arguments to `list_operations` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation's parent resource. - # @param filter [::String] - # The standard list filter. - # @param page_size [::Integer] - # The standard list page size. - # @param page_token [::String] - # The standard list page token. - # @param return_partial_success [::Boolean] - # When set to `true`, operations that are reachable are returned as normal, - # and those that are unreachable are returned in the - # [ListOperationsResponse.unreachable] field. - # - # This can only be `true` when reading across collections e.g. when `parent` - # is set to `"projects/example/locations/-"`. - # - # This field is not by default supported and will result in an - # `UNIMPLEMENTED` error if set unless explicitly documented otherwise in - # service or product specific documentation. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Gapic::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::ListOperationsRequest.new - # - # # Call the list_operations method. - # result = client.list_operations request - # - # # The returned object is of type Gapic::PagedEnumerable. You can iterate - # # over elements, and API calls will be issued to fetch pages as needed. - # result.each do |item| - # # Each element is of type ::Google::Longrunning::Operation. - # p item - # end - # - def list_operations request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::ListOperationsRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.list_operations.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.list_operations.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.list_operations.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.list_operations request, options do |result, operation| - result = ::Gapic::Rest::PagedEnumerable.new @operations_stub, :list_operations, "operations", request, result, options - yield result, operation if block_given? - throw :response, result - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Gets the latest state of a long-running operation. Clients can use this - # method to poll the operation result at intervals as recommended by the API - # service. - # - # @overload get_operation(request, options = nil) - # Pass arguments to `get_operation` via a request object, either of type - # {::Google::Longrunning::GetOperationRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::GetOperationRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload get_operation(name: nil) - # Pass arguments to `get_operation` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation resource. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Gapic::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Gapic::Operation] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::GetOperationRequest.new - # - # # Call the get_operation method. - # result = client.get_operation request - # - # # The returned object is of type Gapic::Operation. You can use it to - # # check the status of an operation, cancel it, or wait for results. - # # Here is how to wait for a response. - # result.wait_until_done! timeout: 60 - # if result.response? - # p result.response - # else - # puts "No response received." - # end - # - def get_operation request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::GetOperationRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.get_operation.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.get_operation.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.get_operation.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.get_operation request, options do |result, operation| - result = ::Gapic::Operation.new result, @operations_client, options: options - yield result, operation if block_given? - throw :response, result - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Deletes a long-running operation. This method indicates that the client is - # no longer interested in the operation result. It does not cancel the - # operation. If the server doesn't support this method, it returns - # `google.rpc.Code.UNIMPLEMENTED`. - # - # @overload delete_operation(request, options = nil) - # Pass arguments to `delete_operation` via a request object, either of type - # {::Google::Longrunning::DeleteOperationRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::DeleteOperationRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload delete_operation(name: nil) - # Pass arguments to `delete_operation` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation resource to be deleted. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Protobuf::Empty] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Protobuf::Empty] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::DeleteOperationRequest.new - # - # # Call the delete_operation method. - # result = client.delete_operation request - # - # # The returned object is of type Google::Protobuf::Empty. - # p result - # - def delete_operation request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::DeleteOperationRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.delete_operation.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.delete_operation.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.delete_operation.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.delete_operation request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Starts asynchronous cancellation on a long-running operation. The server - # makes a best effort to cancel the operation, but success is not - # guaranteed. If the server doesn't support this method, it returns - # `google.rpc.Code.UNIMPLEMENTED`. Clients can use - # Operations.GetOperation or - # other methods to check whether the cancellation succeeded or whether the - # operation completed despite cancellation. On successful cancellation, - # the operation is not deleted; instead, it becomes an operation with - # an {::Google::Longrunning::Operation#error Operation.error} value with a - # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to - # `Code.CANCELLED`. - # - # @overload cancel_operation(request, options = nil) - # Pass arguments to `cancel_operation` via a request object, either of type - # {::Google::Longrunning::CancelOperationRequest} or an equivalent Hash. - # - # @param request [::Google::Longrunning::CancelOperationRequest, ::Hash] - # A request object representing the call parameters. Required. To specify no - # parameters, or to keep all the default parameter values, pass an empty Hash. - # @param options [::Gapic::CallOptions, ::Hash] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @overload cancel_operation(name: nil) - # Pass arguments to `cancel_operation` via keyword arguments. Note that at - # least one keyword argument is required. To specify no parameters, or to keep all - # the default parameter values, pass an empty Hash as a request object (see above). - # - # @param name [::String] - # The name of the operation resource to be cancelled. - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Protobuf::Empty] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Protobuf::Empty] - # - # @raise [::Google::Cloud::Error] if the REST call is aborted. - # - # @example Basic example - # require "google/longrunning" - # - # # Create a client object. The client can be reused for multiple calls. - # client = Google::Longrunning::Operations::Rest::Client.new - # - # # Create a request. To set request fields, pass in keyword arguments. - # request = Google::Longrunning::CancelOperationRequest.new - # - # # Call the cancel_operation method. - # result = client.cancel_operation request - # - # # The returned object is of type Google::Protobuf::Empty. - # p result - # - def cancel_operation request, options = nil - raise ::ArgumentError, "request must be provided" if request.nil? - - request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::CancelOperationRequest - - # Converts hash and nil to an options object - options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - - # Customize the options with defaults - call_metadata = @config.rpcs.cancel_operation.metadata.to_h - - # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers - call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \ - lib_name: @config.lib_name, lib_version: @config.lib_version, - gapic_version: ::Google::Cloud::Retail::V2::VERSION, - transports_version_send: [:rest] - - call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? - call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - - options.apply_defaults timeout: @config.rpcs.cancel_operation.timeout, - metadata: call_metadata, - retry_policy: @config.rpcs.cancel_operation.retry_policy - - options.apply_defaults timeout: @config.timeout, - metadata: @config.metadata, - retry_policy: @config.retry_policy - - @operations_stub.cancel_operation request, options do |result, operation| - yield result, operation if block_given? - end - rescue ::Gapic::Rest::Error => e - raise ::Google::Cloud::Error.from_error(e) - end - - ## - # Configuration class for the Operations REST API. - # - # This class represents the configuration for Operations REST, - # providing control over timeouts, retry behavior, logging, transport - # parameters, and other low-level controls. Certain parameters can also be - # applied individually to specific RPCs. See - # {::Google::Longrunning::Operations::Rest::Client::Configuration::Rpcs} - # for a list of RPCs that can be configured independently. - # - # Configuration can be applied globally to all clients, or to a single client - # on construction. - # - # @example - # - # # Modify the global config, setting the timeout for - # # list_operations to 20 seconds, - # # and all remaining timeouts to 10 seconds. - # ::Google::Longrunning::Operations::Rest::Client.configure do |config| - # config.timeout = 10.0 - # config.rpcs.list_operations.timeout = 20.0 - # end - # - # # Apply the above configuration only to a new client. - # client = ::Google::Longrunning::Operations::Rest::Client.new do |config| - # config.timeout = 10.0 - # config.rpcs.list_operations.timeout = 20.0 - # end - # - # @!attribute [rw] endpoint - # A custom service endpoint, as a hostname or hostname:port. The default is - # nil, indicating to use the default endpoint in the current universe domain. - # @return [::String,nil] - # @!attribute [rw] credentials - # Credentials to send with calls. You may provide any of the following types: - # * (`String`) The path to a service account key file in JSON format - # * (`Hash`) A service account key as a Hash - # * (`Google::Auth::Credentials`) A googleauth credentials object - # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) - # * (`Signet::OAuth2::Client`) A signet oauth2 client object - # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) - # * (`nil`) indicating no credentials - # - # Warning: If you accept a credential configuration (JSON file or Hash) from an - # external source for authentication to Google Cloud, you must validate it before - # providing it to a Google API client library. Providing an unvalidated credential - # configuration to Google APIs can compromise the security of your systems and data. - # For more information, refer to [Validate credential configurations from external - # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials). - # @return [::Object] - # @!attribute [rw] scope - # The OAuth scopes - # @return [::Array<::String>] - # @!attribute [rw] lib_name - # The library name as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] lib_version - # The library version as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] timeout - # The call timeout in seconds. - # @return [::Numeric] - # @!attribute [rw] metadata - # Additional headers to be sent with the call. - # @return [::Hash{::Symbol=>::String}] - # @!attribute [rw] retry_policy - # The retry policy. The value is a hash with the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # @return [::Hash] - # @!attribute [rw] quota_project - # A separate project against which to charge quota. - # @return [::String] - # @!attribute [rw] universe_domain - # The universe domain within which to make requests. This determines the - # default endpoint URL. The default value of nil uses the environment - # universe (usually the default "googleapis.com" universe). - # @return [::String,nil] - # @!attribute [rw] logger - # A custom logger to use for request/response debug logging, or the value - # `:default` (the default) to construct a default logger, or `nil` to - # explicitly disable logging. - # @return [::Logger,:default,nil] - # - class Configuration - extend ::Gapic::Config - - # @private - # The endpoint specific to the default "googleapis.com" universe. Deprecated. - DEFAULT_ENDPOINT = "retail.googleapis.com" - - config_attr :endpoint, nil, ::String, nil - config_attr :credentials, nil do |value| - allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil] - allowed.any? { |klass| klass === value } - end - config_attr :scope, nil, ::String, ::Array, nil - config_attr :lib_name, nil, ::String, nil - config_attr :lib_version, nil, ::String, nil - config_attr :timeout, nil, ::Numeric, nil - config_attr :metadata, nil, ::Hash, nil - config_attr :retry_policy, nil, ::Hash, ::Proc, nil - config_attr :quota_project, nil, ::String, nil - config_attr :universe_domain, nil, ::String, nil - config_attr :logger, :default, ::Logger, nil, :default - - # @private - def initialize parent_config = nil - @parent_config = parent_config unless parent_config.nil? - - yield self if block_given? - end - - ## - # Configurations for individual RPCs - # @return [Rpcs] - # - def rpcs - @rpcs ||= begin - parent_rpcs = nil - parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) - Rpcs.new parent_rpcs - end - end - - ## - # Configuration RPC class for the Operations API. - # - # Includes fields providing the configuration for each RPC in this service. - # Each configuration object is of type `Gapic::Config::Method` and includes - # the following configuration fields: - # - # * `timeout` (*type:* `Numeric`) - The call timeout in seconds - # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers - # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields - # include the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # - class Rpcs - ## - # RPC-specific configuration for `list_operations` - # @return [::Gapic::Config::Method] - # - attr_reader :list_operations - ## - # RPC-specific configuration for `get_operation` - # @return [::Gapic::Config::Method] - # - attr_reader :get_operation - ## - # RPC-specific configuration for `delete_operation` - # @return [::Gapic::Config::Method] - # - attr_reader :delete_operation - ## - # RPC-specific configuration for `cancel_operation` - # @return [::Gapic::Config::Method] - # - attr_reader :cancel_operation - - # @private - def initialize parent_rpcs = nil - list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations - @list_operations = ::Gapic::Config::Method.new list_operations_config - get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation - @get_operation = ::Gapic::Config::Method.new get_operation_config - delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation - @delete_operation = ::Gapic::Config::Method.new delete_operation_config - cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation - @cancel_operation = ::Gapic::Config::Method.new cancel_operation_config - - yield self if block_given? - end - end - end - end - - ## - # @private - # REST service stub for the Longrunning Operations API. - # Service stub contains baseline method implementations - # including transcoding, making the REST call, and deserialing the response. - class OperationsServiceStub - def initialize endpoint:, endpoint_template:, universe_domain:, credentials: - # These require statements are intentionally placed here to initialize - # the REST modules only when it's required. - require "gapic/rest" - - @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, - endpoint_template: endpoint_template, - universe_domain: universe_domain, - credentials: credentials - end - - ## - # Baseline implementation for the list_operations REST call - # - # @param request_pb [::Google::Longrunning::ListOperationsRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Longrunning::ListOperationsResponse] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Longrunning::ListOperationsResponse] - # A result object deserialized from the server's reply - def list_operations request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = OperationsServiceStub.transcode_list_operations_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "list_operations", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Longrunning::ListOperationsResponse.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the get_operation REST call - # - # @param request_pb [::Google::Longrunning::GetOperationRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Longrunning::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Longrunning::Operation] - # A result object deserialized from the server's reply - def get_operation request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = OperationsServiceStub.transcode_get_operation_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "get_operation", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the delete_operation REST call - # - # @param request_pb [::Google::Longrunning::DeleteOperationRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Protobuf::Empty] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Protobuf::Empty] - # A result object deserialized from the server's reply - def delete_operation request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = OperationsServiceStub.transcode_delete_operation_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "delete_operation", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the cancel_operation REST call - # - # @param request_pb [::Google::Longrunning::CancelOperationRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Protobuf::Empty] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Protobuf::Empty] - # A result object deserialized from the server's reply - def cancel_operation request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = OperationsServiceStub.transcode_cancel_operation_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "cancel_operation", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # @private - # - # GRPC transcoding helper method for the list_operations REST call - # - # @param request_pb [::Google::Longrunning::ListOperationsRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_list_operations_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :get, - uri_template: "/v2/{name}/operations", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/?$}, false] - ] - ) - .with_bindings( - uri_method: :get, - uri_template: "/v2/{name}/operations", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] - ] - ) - .with_bindings( - uri_method: :get, - uri_template: "/v2/{name}/operations", - matches: [ - ["name", %r{^projects/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the get_operation REST call - # - # @param request_pb [::Google::Longrunning::GetOperationRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_get_operation_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :get, - uri_template: "/v2/{name}", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/operations/[^/]+/?$}, false] - ] - ) - .with_bindings( - uri_method: :get, - uri_template: "/v2/{name}", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/branches/[^/]+/operations/[^/]+/?$}, false] - ] - ) - .with_bindings( - uri_method: :get, - uri_template: "/v2/{name}", - matches: [ - ["name", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/operations/[^/]+/?$}, false] - ] - ) - .with_bindings( - uri_method: :get, - uri_template: "/v2/{name}", - matches: [ - ["name", %r{^projects/[^/]+/operations/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the delete_operation REST call - # - # @param request_pb [::Google::Longrunning::DeleteOperationRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_delete_operation_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :delete, - uri_template: "/v1/{name}", - matches: [ - ["name", %r{^operations(?:/(?<__wildcard__>.*))?$}, true] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the cancel_operation REST call - # - # @param request_pb [::Google::Longrunning::CancelOperationRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_cancel_operation_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :post, - uri_template: "/v1/{name}:cancel", - body: "*", - matches: [ - ["name", %r{^operations(?:/(?<__wildcard__>.*))?$}, true] - ] - ) - transcoder.transcode request_pb - end - end - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/rest/service_stub.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/rest/service_stub.rb deleted file mode 100644 index d2603e85207f..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service/rest/service_stub.rb +++ /dev/null @@ -1,398 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "google/cloud/retail/v2/user_event_service_pb" - -module Google - module Cloud - module Retail - module V2 - module UserEventService - module Rest - ## - # REST service stub for the UserEventService service. - # Service stub contains baseline method implementations - # including transcoding, making the REST call, and deserialing the response. - # - class ServiceStub - # @private - def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger: - # These require statements are intentionally placed here to initialize - # the REST modules only when it's required. - require "gapic/rest" - - @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, - endpoint_template: endpoint_template, - universe_domain: universe_domain, - credentials: credentials, - numeric_enums: true, - service_name: self.class, - raise_faraday_errors: false, - logger: logger - end - - ## - # The effective universe domain - # - # @return [String] - # - def universe_domain - @client_stub.universe_domain - end - - ## - # The effective endpoint - # - # @return [String] - # - def endpoint - @client_stub.endpoint - end - - ## - # The logger used for request/response debug logging. - # - # @return [Logger] - # - def logger stub: false - stub ? @client_stub.stub_logger : @client_stub.logger - end - - ## - # Baseline implementation for the write_user_event REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::WriteUserEventRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Cloud::Retail::V2::UserEvent] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Cloud::Retail::V2::UserEvent] - # A result object deserialized from the server's reply - def write_user_event request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_write_user_event_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "write_user_event", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Cloud::Retail::V2::UserEvent.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the collect_user_event REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::CollectUserEventRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Api::HttpBody] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Api::HttpBody] - # A result object deserialized from the server's reply - def collect_user_event request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_collect_user_event_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "collect_user_event", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Api::HttpBody.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the purge_user_events REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::PurgeUserEventsRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Longrunning::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Longrunning::Operation] - # A result object deserialized from the server's reply - def purge_user_events request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_purge_user_events_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "purge_user_events", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the import_user_events REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::ImportUserEventsRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Longrunning::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Longrunning::Operation] - # A result object deserialized from the server's reply - def import_user_events request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_import_user_events_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "import_user_events", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # Baseline implementation for the rejoin_user_events REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::RejoinUserEventsRequest] - # A request object representing the call parameters. Required. - # @param options [::Gapic::CallOptions] - # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. - # - # @yield [result, operation] Access the result along with the TransportOperation object - # @yieldparam result [::Google::Longrunning::Operation] - # @yieldparam operation [::Gapic::Rest::TransportOperation] - # - # @return [::Google::Longrunning::Operation] - # A result object deserialized from the server's reply - def rejoin_user_events request_pb, options = nil - raise ::ArgumentError, "request must be provided" if request_pb.nil? - - verb, uri, query_string_params, body = ServiceStub.transcode_rejoin_user_events_request request_pb - query_string_params = if query_string_params.any? - query_string_params.to_h { |p| p.split "=", 2 } - else - {} - end - - response = @client_stub.make_http_request( - verb, - uri: uri, - body: body || "", - params: query_string_params, - method_name: "rejoin_user_events", - options: options - ) - operation = ::Gapic::Rest::TransportOperation.new response - result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true - catch :response do - yield result, operation if block_given? - result - end - end - - ## - # @private - # - # GRPC transcoding helper method for the write_user_event REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::WriteUserEventRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_write_user_event_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :post, - uri_template: "/v2/{parent}/userEvents:write", - body: "user_event", - matches: [ - ["parent", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the collect_user_event REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::CollectUserEventRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_collect_user_event_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :get, - uri_template: "/v2/{parent}/userEvents:collect", - matches: [ - ["parent", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] - ] - ) - .with_bindings( - uri_method: :post, - uri_template: "/v2/{parent}/userEvents:collect", - body: "*", - matches: [ - ["parent", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the purge_user_events REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::PurgeUserEventsRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_purge_user_events_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :post, - uri_template: "/v2/{parent}/userEvents:purge", - body: "*", - matches: [ - ["parent", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the import_user_events REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::ImportUserEventsRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_import_user_events_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :post, - uri_template: "/v2/{parent}/userEvents:import", - body: "*", - matches: [ - ["parent", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - - ## - # @private - # - # GRPC transcoding helper method for the rejoin_user_events REST call - # - # @param request_pb [::Google::Cloud::Retail::V2::RejoinUserEventsRequest] - # A request object representing the call parameters. Required. - # @return [Array(String, [String, nil], Hash{String => String})] - # Uri, Body, Query string parameters - def self.transcode_rejoin_user_events_request request_pb - transcoder = Gapic::Rest::GrpcTranscoder.new - .with_bindings( - uri_method: :post, - uri_template: "/v2/{parent}/userEvents:rejoin", - body: "*", - matches: [ - ["parent", %r{^projects/[^/]+/locations/[^/]+/catalogs/[^/]+/?$}, false] - ] - ) - transcoder.transcode request_pb - end - end - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service_pb.rb deleted file mode 100644 index 69dbde1899d7..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service_pb.rb +++ /dev/null @@ -1,36 +0,0 @@ -# frozen_string_literal: true -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/retail/v2/user_event_service.proto - -require 'google/protobuf' - -require 'google/api/annotations_pb' -require 'google/api/client_pb' -require 'google/api/field_behavior_pb' -require 'google/api/httpbody_pb' -require 'google/api/resource_pb' -require 'google/cloud/retail/v2/import_config_pb' -require 'google/cloud/retail/v2/purge_config_pb' -require 'google/cloud/retail/v2/user_event_pb' -require 'google/longrunning/operations_pb' - - -descriptor_data = "\n/google/cloud/retail/v2/user_event_service.proto\x12\x16google.cloud.retail.v2\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/httpbody.proto\x1a\x19google/api/resource.proto\x1a*google/cloud/retail/v2/import_config.proto\x1a)google/cloud/retail/v2/purge_config.proto\x1a\'google/cloud/retail/v2/user_event.proto\x1a#google/longrunning/operations.proto\"}\n\x15WriteUserEventRequest\x12\x13\n\x06parent\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12:\n\nuser_event\x18\x02 \x01(\x0b\x32!.google.cloud.retail.v2.UserEventB\x03\xe0\x41\x02\x12\x13\n\x0bwrite_async\x18\x03 \x01(\x08\"\x9f\x01\n\x17\x43ollectUserEventRequest\x12\x17\n\rprebuilt_rule\x18\x06 \x01(\tH\x00\x12\x13\n\x06parent\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x17\n\nuser_event\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\x0b\n\x03uri\x18\x03 \x01(\t\x12\x0b\n\x03\x65ts\x18\x04 \x01(\x03\x12\x10\n\x08raw_json\x18\x05 \x01(\tB\x11\n\x0f\x63onversion_rule\"\xfe\x01\n\x17RejoinUserEventsRequest\x12\x13\n\x06parent\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x65\n\x17user_event_rejoin_scope\x18\x02 \x01(\x0e\x32\x44.google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope\"g\n\x14UserEventRejoinScope\x12\'\n#USER_EVENT_REJOIN_SCOPE_UNSPECIFIED\x10\x00\x12\x11\n\rJOINED_EVENTS\x10\x01\x12\x13\n\x0fUNJOINED_EVENTS\x10\x02\">\n\x18RejoinUserEventsResponse\x12\"\n\x1arejoined_user_events_count\x18\x01 \x01(\x03\"\x1a\n\x18RejoinUserEventsMetadata2\x89\n\n\x10UserEventService\x12\xb7\x01\n\x0eWriteUserEvent\x12-.google.cloud.retail.v2.WriteUserEventRequest\x1a!.google.cloud.retail.v2.UserEvent\"S\x82\xd3\xe4\x93\x02M\"?/v2/{parent=projects/*/locations/*/catalogs/*}/userEvents:write:\nuser_event\x12\xee\x01\n\x10\x43ollectUserEvent\x12/.google.cloud.retail.v2.CollectUserEventRequest\x1a\x14.google.api.HttpBody\"\x92\x01\x82\xd3\xe4\x93\x02\x8b\x01\x12\x41/v2/{parent=projects/*/locations/*/catalogs/*}/userEvents:collectZF\"A/v2/{parent=projects/*/locations/*/catalogs/*}/userEvents:collect:\x01*\x12\x86\x02\n\x0fPurgeUserEvents\x12..google.cloud.retail.v2.PurgeUserEventsRequest\x1a\x1d.google.longrunning.Operation\"\xa3\x01\xca\x41V\n.google.cloud.retail.v2.PurgeUserEventsResponse\x12$google.cloud.retail.v2.PurgeMetadata\x82\xd3\xe4\x93\x02\x44\"?/v2/{parent=projects/*/locations/*/catalogs/*}/userEvents:purge:\x01*\x12\x8b\x02\n\x10ImportUserEvents\x12/.google.cloud.retail.v2.ImportUserEventsRequest\x1a\x1d.google.longrunning.Operation\"\xa6\x01\xca\x41X\n/google.cloud.retail.v2.ImportUserEventsResponse\x12%google.cloud.retail.v2.ImportMetadata\x82\xd3\xe4\x93\x02\x45\"@/v2/{parent=projects/*/locations/*/catalogs/*}/userEvents:import:\x01*\x12\xe7\x01\n\x10RejoinUserEvents\x12/.google.cloud.retail.v2.RejoinUserEventsRequest\x1a\x1d.google.longrunning.Operation\"\x82\x01\xca\x41\x34\n\x18RejoinUserEventsResponse\x12\x18RejoinUserEventsMetadata\x82\xd3\xe4\x93\x02\x45\"@/v2/{parent=projects/*/locations/*/catalogs/*}/userEvents:rejoin:\x01*\x1aI\xca\x41\x15retail.googleapis.com\xd2\x41.https://www.googleapis.com/auth/cloud-platformB\xc0\x01\n\x1a\x63om.google.cloud.retail.v2B\x15UserEventServiceProtoP\x01Z2cloud.google.com/go/retail/apiv2/retailpb;retailpb\xa2\x02\x06RETAIL\xaa\x02\x16Google.Cloud.Retail.V2\xca\x02\x16Google\\Cloud\\Retail\\V2\xea\x02\x19Google::Cloud::Retail::V2b\x06proto3" - -pool = ::Google::Protobuf::DescriptorPool.generated_pool -pool.add_serialized_file(descriptor_data) - -module Google - module Cloud - module Retail - module V2 - WriteUserEventRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.WriteUserEventRequest").msgclass - CollectUserEventRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.CollectUserEventRequest").msgclass - RejoinUserEventsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.RejoinUserEventsRequest").msgclass - RejoinUserEventsRequest::UserEventRejoinScope = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope").enummodule - RejoinUserEventsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.RejoinUserEventsResponse").msgclass - RejoinUserEventsMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.retail.v2.RejoinUserEventsMetadata").msgclass - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service_services_pb.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service_services_pb.rb deleted file mode 100644 index 65e9fe4b7c1f..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/user_event_service_services_pb.rb +++ /dev/null @@ -1,75 +0,0 @@ -# Generated by the protocol buffer compiler. DO NOT EDIT! -# Source: google/cloud/retail/v2/user_event_service.proto for package 'Google.Cloud.Retail.V2' -# Original file comments: -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -require 'grpc' -require 'google/cloud/retail/v2/user_event_service_pb' - -module Google - module Cloud - module Retail - module V2 - module UserEventService - # Service for ingesting end user actions on the customer website. - class Service - - include ::GRPC::GenericService - - self.marshal_class_method = :encode - self.unmarshal_class_method = :decode - self.service_name = 'google.cloud.retail.v2.UserEventService' - - # Writes a single user event. - rpc :WriteUserEvent, ::Google::Cloud::Retail::V2::WriteUserEventRequest, ::Google::Cloud::Retail::V2::UserEvent - # Writes a single user event from the browser. - # - # For larger user event payload over 16 KB, the POST method should be used - # instead, otherwise a 400 Bad Request error is returned. - # - # This method is used only by the Retail API JavaScript pixel and Google Tag - # Manager. Users should not call this method directly. - rpc :CollectUserEvent, ::Google::Cloud::Retail::V2::CollectUserEventRequest, ::Google::Api::HttpBody - # Deletes permanently all user events specified by the filter provided. - # Depending on the number of events specified by the filter, this operation - # could take hours or days to complete. To test a filter, use the list - # command first. - rpc :PurgeUserEvents, ::Google::Cloud::Retail::V2::PurgeUserEventsRequest, ::Google::Longrunning::Operation - # Bulk import of User events. Request processing might be - # synchronous. Events that already exist are skipped. - # Use this method for backfilling historical user events. - # - # `Operation.response` is of type `ImportResponse`. Note that it is - # possible for a subset of the items to be successfully inserted. - # `Operation.metadata` is of type `ImportMetadata`. - rpc :ImportUserEvents, ::Google::Cloud::Retail::V2::ImportUserEventsRequest, ::Google::Longrunning::Operation - # Starts a user-event rejoin operation with latest product catalog. Events - # are not annotated with detailed product information for products that are - # missing from the catalog when the user event is ingested. These - # events are stored as unjoined events with limited usage on training and - # serving. You can use this method to start a join operation on specified - # events with the latest version of product catalog. You can also use this - # method to correct events joined with the wrong product catalog. A rejoin - # operation can take hours or days to complete. - rpc :RejoinUserEvents, ::Google::Cloud::Retail::V2::RejoinUserEventsRequest, ::Google::Longrunning::Operation - end - - Stub = Service.rpc_stub_class - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/version.rb b/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/version.rb deleted file mode 100644 index ea00c998505d..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/lib/google/cloud/retail/v2/version.rb +++ /dev/null @@ -1,28 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Cloud - module Retail - module V2 - VERSION = "0.0.1" - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/README.md b/owl-bot-staging/google-cloud-retail-v2/proto_docs/README.md deleted file mode 100644 index 339fa1264598..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/proto_docs/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# Retail V2 Protocol Buffer Documentation - -These files are for the YARD documentation of the generated protobuf files. -They are not intended to be required or loaded at runtime. diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/api/client.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/api/client.rb deleted file mode 100644 index 3ab0b096d445..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/api/client.rb +++ /dev/null @@ -1,593 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Api - # Required information for every language. - # @!attribute [rw] reference_docs_uri - # @deprecated This field is deprecated and may be removed in the next major version update. - # @return [::String] - # Link to automatically generated reference documentation. Example: - # https://cloud.google.com/nodejs/docs/reference/asset/latest - # @!attribute [rw] destinations - # @return [::Array<::Google::Api::ClientLibraryDestination>] - # The destination where API teams want this client library to be published. - # @!attribute [rw] selective_gapic_generation - # @return [::Google::Api::SelectiveGapicGeneration] - # Configuration for which RPCs should be generated in the GAPIC client. - # - # Note: This field should not be used in most cases. - class CommonLanguageSettings - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Details about how and where to publish client libraries. - # @!attribute [rw] version - # @return [::String] - # Version of the API to apply these settings to. This is the full protobuf - # package for the API, ending in the version element. - # Examples: "google.cloud.speech.v1" and "google.spanner.admin.database.v1". - # @!attribute [rw] launch_stage - # @return [::Google::Api::LaunchStage] - # Launch stage of this version of the API. - # @!attribute [rw] rest_numeric_enums - # @return [::Boolean] - # When using transport=rest, the client request will encode enums as - # numbers rather than strings. - # @!attribute [rw] java_settings - # @return [::Google::Api::JavaSettings] - # Settings for legacy Java features, supported in the Service YAML. - # @!attribute [rw] cpp_settings - # @return [::Google::Api::CppSettings] - # Settings for C++ client libraries. - # @!attribute [rw] php_settings - # @return [::Google::Api::PhpSettings] - # Settings for PHP client libraries. - # @!attribute [rw] python_settings - # @return [::Google::Api::PythonSettings] - # Settings for Python client libraries. - # @!attribute [rw] node_settings - # @return [::Google::Api::NodeSettings] - # Settings for Node client libraries. - # @!attribute [rw] dotnet_settings - # @return [::Google::Api::DotnetSettings] - # Settings for .NET client libraries. - # @!attribute [rw] ruby_settings - # @return [::Google::Api::RubySettings] - # Settings for Ruby client libraries. - # @!attribute [rw] go_settings - # @return [::Google::Api::GoSettings] - # Settings for Go client libraries. - class ClientLibrarySettings - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # This message configures the settings for publishing [Google Cloud Client - # libraries](https://cloud.google.com/apis/docs/cloud-client-libraries) - # generated from the service config. - # @!attribute [rw] method_settings - # @return [::Array<::Google::Api::MethodSettings>] - # A list of API method settings, e.g. the behavior for methods that use the - # long-running operation pattern. - # @!attribute [rw] new_issue_uri - # @return [::String] - # Link to a *public* URI where users can report issues. Example: - # https://issuetracker.google.com/issues/new?component=190865&template=1161103 - # @!attribute [rw] documentation_uri - # @return [::String] - # Link to product home page. Example: - # https://cloud.google.com/asset-inventory/docs/overview - # @!attribute [rw] api_short_name - # @return [::String] - # Used as a tracking tag when collecting data about the APIs developer - # relations artifacts like docs, packages delivered to package managers, - # etc. Example: "speech". - # @!attribute [rw] github_label - # @return [::String] - # GitHub label to apply to issues and pull requests opened for this API. - # @!attribute [rw] codeowner_github_teams - # @return [::Array<::String>] - # GitHub teams to be added to CODEOWNERS in the directory in GitHub - # containing source code for the client libraries for this API. - # @!attribute [rw] doc_tag_prefix - # @return [::String] - # A prefix used in sample code when demarking regions to be included in - # documentation. - # @!attribute [rw] organization - # @return [::Google::Api::ClientLibraryOrganization] - # For whom the client library is being published. - # @!attribute [rw] library_settings - # @return [::Array<::Google::Api::ClientLibrarySettings>] - # Client library settings. If the same version string appears multiple - # times in this list, then the last one wins. Settings from earlier - # settings with the same version string are discarded. - # @!attribute [rw] proto_reference_documentation_uri - # @return [::String] - # Optional link to proto reference documentation. Example: - # https://cloud.google.com/pubsub/lite/docs/reference/rpc - # @!attribute [rw] rest_reference_documentation_uri - # @return [::String] - # Optional link to REST reference documentation. Example: - # https://cloud.google.com/pubsub/lite/docs/reference/rest - class Publishing - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Settings for Java client libraries. - # @!attribute [rw] library_package - # @return [::String] - # The package name to use in Java. Clobbers the java_package option - # set in the protobuf. This should be used **only** by APIs - # who have already set the language_settings.java.package_name" field - # in gapic.yaml. API teams should use the protobuf java_package option - # where possible. - # - # Example of a YAML configuration:: - # - # publishing: - # library_settings: - # java_settings: - # library_package: com.google.cloud.pubsub.v1 - # @!attribute [rw] service_class_names - # @return [::Google::Protobuf::Map{::String => ::String}] - # Configure the Java class name to use instead of the service's for its - # corresponding generated GAPIC client. Keys are fully-qualified - # service names as they appear in the protobuf (including the full - # the language_settings.java.interface_names" field in gapic.yaml. API - # teams should otherwise use the service name as it appears in the - # protobuf. - # - # Example of a YAML configuration:: - # - # publishing: - # java_settings: - # service_class_names: - # - google.pubsub.v1.Publisher: TopicAdmin - # - google.pubsub.v1.Subscriber: SubscriptionAdmin - # @!attribute [rw] common - # @return [::Google::Api::CommonLanguageSettings] - # Some settings. - class JavaSettings - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # @!attribute [rw] key - # @return [::String] - # @!attribute [rw] value - # @return [::String] - class ServiceClassNamesEntry - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - - # Settings for C++ client libraries. - # @!attribute [rw] common - # @return [::Google::Api::CommonLanguageSettings] - # Some settings. - class CppSettings - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Settings for Php client libraries. - # @!attribute [rw] common - # @return [::Google::Api::CommonLanguageSettings] - # Some settings. - # @!attribute [rw] library_package - # @return [::String] - # The package name to use in Php. Clobbers the php_namespace option - # set in the protobuf. This should be used **only** by APIs - # who have already set the language_settings.php.package_name" field - # in gapic.yaml. API teams should use the protobuf php_namespace option - # where possible. - # - # Example of a YAML configuration:: - # - # publishing: - # library_settings: - # php_settings: - # library_package: Google\Cloud\PubSub\V1 - class PhpSettings - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Settings for Python client libraries. - # @!attribute [rw] common - # @return [::Google::Api::CommonLanguageSettings] - # Some settings. - # @!attribute [rw] experimental_features - # @return [::Google::Api::PythonSettings::ExperimentalFeatures] - # Experimental features to be included during client library generation. - class PythonSettings - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # Experimental features to be included during client library generation. - # These fields will be deprecated once the feature graduates and is enabled - # by default. - # @!attribute [rw] rest_async_io_enabled - # @return [::Boolean] - # Enables generation of asynchronous REST clients if `rest` transport is - # enabled. By default, asynchronous REST clients will not be generated. - # This feature will be enabled by default 1 month after launching the - # feature in preview packages. - # @!attribute [rw] protobuf_pythonic_types_enabled - # @return [::Boolean] - # Enables generation of protobuf code using new types that are more - # Pythonic which are included in `protobuf>=5.29.x`. This feature will be - # enabled by default 1 month after launching the feature in preview - # packages. - # @!attribute [rw] unversioned_package_disabled - # @return [::Boolean] - # Disables generation of an unversioned Python package for this client - # library. This means that the module names will need to be versioned in - # import statements. For example `import google.cloud.library_v2` instead - # of `import google.cloud.library`. - class ExperimentalFeatures - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - - # Settings for Node client libraries. - # @!attribute [rw] common - # @return [::Google::Api::CommonLanguageSettings] - # Some settings. - class NodeSettings - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Settings for Dotnet client libraries. - # @!attribute [rw] common - # @return [::Google::Api::CommonLanguageSettings] - # Some settings. - # @!attribute [rw] renamed_services - # @return [::Google::Protobuf::Map{::String => ::String}] - # Map from original service names to renamed versions. - # This is used when the default generated types - # would cause a naming conflict. (Neither name is - # fully-qualified.) - # Example: Subscriber to SubscriberServiceApi. - # @!attribute [rw] renamed_resources - # @return [::Google::Protobuf::Map{::String => ::String}] - # Map from full resource types to the effective short name - # for the resource. This is used when otherwise resource - # named from different services would cause naming collisions. - # Example entry: - # "datalabeling.googleapis.com/Dataset": "DataLabelingDataset" - # @!attribute [rw] ignored_resources - # @return [::Array<::String>] - # List of full resource types to ignore during generation. - # This is typically used for API-specific Location resources, - # which should be handled by the generator as if they were actually - # the common Location resources. - # Example entry: "documentai.googleapis.com/Location" - # @!attribute [rw] forced_namespace_aliases - # @return [::Array<::String>] - # Namespaces which must be aliased in snippets due to - # a known (but non-generator-predictable) naming collision - # @!attribute [rw] handwritten_signatures - # @return [::Array<::String>] - # Method signatures (in the form "service.method(signature)") - # which are provided separately, so shouldn't be generated. - # Snippets *calling* these methods are still generated, however. - class DotnetSettings - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # @!attribute [rw] key - # @return [::String] - # @!attribute [rw] value - # @return [::String] - class RenamedServicesEntry - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # @!attribute [rw] key - # @return [::String] - # @!attribute [rw] value - # @return [::String] - class RenamedResourcesEntry - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - - # Settings for Ruby client libraries. - # @!attribute [rw] common - # @return [::Google::Api::CommonLanguageSettings] - # Some settings. - class RubySettings - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Settings for Go client libraries. - # @!attribute [rw] common - # @return [::Google::Api::CommonLanguageSettings] - # Some settings. - # @!attribute [rw] renamed_services - # @return [::Google::Protobuf::Map{::String => ::String}] - # Map of service names to renamed services. Keys are the package relative - # service names and values are the name to be used for the service client - # and call options. - # - # Example: - # - # publishing: - # go_settings: - # renamed_services: - # Publisher: TopicAdmin - class GoSettings - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # @!attribute [rw] key - # @return [::String] - # @!attribute [rw] value - # @return [::String] - class RenamedServicesEntry - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - - # Describes the generator configuration for a method. - # @!attribute [rw] selector - # @return [::String] - # The fully qualified name of the method, for which the options below apply. - # This is used to find the method to apply the options. - # - # Example: - # - # publishing: - # method_settings: - # - selector: google.storage.control.v2.StorageControl.CreateFolder - # # method settings for CreateFolder... - # @!attribute [rw] long_running - # @return [::Google::Api::MethodSettings::LongRunning] - # Describes settings to use for long-running operations when generating - # API methods for RPCs. Complements RPCs that use the annotations in - # google/longrunning/operations.proto. - # - # Example of a YAML configuration:: - # - # publishing: - # method_settings: - # - selector: google.cloud.speech.v2.Speech.BatchRecognize - # long_running: - # initial_poll_delay: 60s # 1 minute - # poll_delay_multiplier: 1.5 - # max_poll_delay: 360s # 6 minutes - # total_poll_timeout: 54000s # 90 minutes - # @!attribute [rw] auto_populated_fields - # @return [::Array<::String>] - # List of top-level fields of the request message, that should be - # automatically populated by the client libraries based on their - # (google.api.field_info).format. Currently supported format: UUID4. - # - # Example of a YAML configuration: - # - # publishing: - # method_settings: - # - selector: google.example.v1.ExampleService.CreateExample - # auto_populated_fields: - # - request_id - # @!attribute [rw] batching - # @return [::Google::Api::BatchingConfigProto] - # Batching configuration for an API method in client libraries. - # - # Example of a YAML configuration: - # - # publishing: - # method_settings: - # - selector: google.example.v1.ExampleService.BatchCreateExample - # batching: - # element_count_threshold: 1000 - # request_byte_threshold: 100000000 - # delay_threshold_millis: 10 - class MethodSettings - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # Describes settings to use when generating API methods that use the - # long-running operation pattern. - # All default values below are from those used in the client library - # generators (e.g. - # [Java](https://github.com/googleapis/gapic-generator-java/blob/04c2faa191a9b5a10b92392fe8482279c4404803/src/main/java/com/google/api/generator/gapic/composer/common/RetrySettingsComposer.java)). - # @!attribute [rw] initial_poll_delay - # @return [::Google::Protobuf::Duration] - # Initial delay after which the first poll request will be made. - # Default value: 5 seconds. - # @!attribute [rw] poll_delay_multiplier - # @return [::Float] - # Multiplier to gradually increase delay between subsequent polls until it - # reaches max_poll_delay. - # Default value: 1.5. - # @!attribute [rw] max_poll_delay - # @return [::Google::Protobuf::Duration] - # Maximum time between two subsequent poll requests. - # Default value: 45 seconds. - # @!attribute [rw] total_poll_timeout - # @return [::Google::Protobuf::Duration] - # Total polling timeout. - # Default value: 5 minutes. - class LongRunning - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - - # This message is used to configure the generation of a subset of the RPCs in - # a service for client libraries. - # - # Note: This feature should not be used in most cases. - # @!attribute [rw] methods - # @return [::Array<::String>] - # An allowlist of the fully qualified names of RPCs that should be included - # on public client surfaces. - # @!attribute [rw] generate_omitted_as_internal - # @return [::Boolean] - # Setting this to true indicates to the client generators that methods - # that would be excluded from the generation should instead be generated - # in a way that indicates these methods should not be consumed by - # end users. How this is expressed is up to individual language - # implementations to decide. Some examples may be: added annotations, - # obfuscated identifiers, or other language idiomatic patterns. - class SelectiveGapicGeneration - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # `BatchingConfigProto` defines the batching configuration for an API method. - # @!attribute [rw] thresholds - # @return [::Google::Api::BatchingSettingsProto] - # The thresholds which trigger a batched request to be sent. - # @!attribute [rw] batch_descriptor - # @return [::Google::Api::BatchingDescriptorProto] - # The request and response fields used in batching. - class BatchingConfigProto - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # `BatchingSettingsProto` specifies a set of batching thresholds, each of - # which acts as a trigger to send a batch of messages as a request. At least - # one threshold must be positive nonzero. - # @!attribute [rw] element_count_threshold - # @return [::Integer] - # The number of elements of a field collected into a batch which, if - # exceeded, causes the batch to be sent. - # @!attribute [rw] request_byte_threshold - # @return [::Integer] - # The aggregated size of the batched field which, if exceeded, causes the - # batch to be sent. This size is computed by aggregating the sizes of the - # request field to be batched, not of the entire request message. - # @!attribute [rw] delay_threshold - # @return [::Google::Protobuf::Duration] - # The duration after which a batch should be sent, starting from the addition - # of the first message to that batch. - # @!attribute [rw] element_count_limit - # @return [::Integer] - # The maximum number of elements collected in a batch that could be accepted - # by server. - # @!attribute [rw] request_byte_limit - # @return [::Integer] - # The maximum size of the request that could be accepted by server. - # @!attribute [rw] flow_control_element_limit - # @return [::Integer] - # The maximum number of elements allowed by flow control. - # @!attribute [rw] flow_control_byte_limit - # @return [::Integer] - # The maximum size of data allowed by flow control. - # @!attribute [rw] flow_control_limit_exceeded_behavior - # @return [::Google::Api::FlowControlLimitExceededBehaviorProto] - # The behavior to take when the flow control limit is exceeded. - class BatchingSettingsProto - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # `BatchingDescriptorProto` specifies the fields of the request message to be - # used for batching, and, optionally, the fields of the response message to be - # used for demultiplexing. - # @!attribute [rw] batched_field - # @return [::String] - # The repeated field in the request message to be aggregated by batching. - # @!attribute [rw] discriminator_fields - # @return [::Array<::String>] - # A list of the fields in the request message. Two requests will be batched - # together only if the values of every field specified in - # `request_discriminator_fields` is equal between the two requests. - # @!attribute [rw] subresponse_field - # @return [::String] - # Optional. When present, indicates the field in the response message to be - # used to demultiplex the response into multiple response messages, in - # correspondence with the multiple request messages originally batched - # together. - class BatchingDescriptorProto - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # The organization for which the client libraries are being published. - # Affects the url where generated docs are published, etc. - module ClientLibraryOrganization - # Not useful. - CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED = 0 - - # Google Cloud Platform Org. - CLOUD = 1 - - # Ads (Advertising) Org. - ADS = 2 - - # Photos Org. - PHOTOS = 3 - - # Street View Org. - STREET_VIEW = 4 - - # Shopping Org. - SHOPPING = 5 - - # Geo Org. - GEO = 6 - - # Generative AI - https://developers.generativeai.google - GENERATIVE_AI = 7 - end - - # To where should client libraries be published? - module ClientLibraryDestination - # Client libraries will neither be generated nor published to package - # managers. - CLIENT_LIBRARY_DESTINATION_UNSPECIFIED = 0 - - # Generate the client library in a repo under github.com/googleapis, - # but don't publish it to package managers. - GITHUB = 10 - - # Publish the library to package managers like nuget.org and npmjs.com. - PACKAGE_MANAGER = 20 - end - - # The behavior to take when the flow control limit is exceeded. - module FlowControlLimitExceededBehaviorProto - # Default behavior, system-defined. - UNSET_BEHAVIOR = 0 - - # Stop operation, raise error. - THROW_EXCEPTION = 1 - - # Pause operation until limit clears. - BLOCK = 2 - - # Continue operation, disregard limit. - IGNORE = 3 - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/api/field_behavior.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/api/field_behavior.rb deleted file mode 100644 index 582be187d115..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/api/field_behavior.rb +++ /dev/null @@ -1,85 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Api - # An indicator of the behavior of a given field (for example, that a field - # is required in requests, or given as output but ignored as input). - # This **does not** change the behavior in protocol buffers itself; it only - # denotes the behavior and may affect how API tooling handles the field. - # - # Note: This enum **may** receive new values in the future. - module FieldBehavior - # Conventional default for enums. Do not use this. - FIELD_BEHAVIOR_UNSPECIFIED = 0 - - # Specifically denotes a field as optional. - # While all fields in protocol buffers are optional, this may be specified - # for emphasis if appropriate. - OPTIONAL = 1 - - # Denotes a field as required. - # This indicates that the field **must** be provided as part of the request, - # and failure to do so will cause an error (usually `INVALID_ARGUMENT`). - REQUIRED = 2 - - # Denotes a field as output only. - # This indicates that the field is provided in responses, but including the - # field in a request does nothing (the server *must* ignore it and - # *must not* throw an error as a result of the field's presence). - OUTPUT_ONLY = 3 - - # Denotes a field as input only. - # This indicates that the field is provided in requests, and the - # corresponding field is not included in output. - INPUT_ONLY = 4 - - # Denotes a field as immutable. - # This indicates that the field may be set once in a request to create a - # resource, but may not be changed thereafter. - IMMUTABLE = 5 - - # Denotes that a (repeated) field is an unordered list. - # This indicates that the service may provide the elements of the list - # in any arbitrary order, rather than the order the user originally - # provided. Additionally, the list's order may or may not be stable. - UNORDERED_LIST = 6 - - # Denotes that this field returns a non-empty default value if not set. - # This indicates that if the user provides the empty value in a request, - # a non-empty value will be returned. The user will not be aware of what - # non-empty value to expect. - NON_EMPTY_DEFAULT = 7 - - # Denotes that the field in a resource (a message annotated with - # google.api.resource) is used in the resource name to uniquely identify the - # resource. For AIP-compliant APIs, this should only be applied to the - # `name` field on the resource. - # - # This behavior should not be applied to references to other resources within - # the message. - # - # The identifier field of resources often have different field behavior - # depending on the request it is embedded in (e.g. for Create methods name - # is optional and unused, while for Update methods it is required). Instead - # of method-specific annotations, only `IDENTIFIER` is required. - IDENTIFIER = 8 - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/api/httpbody.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/api/httpbody.rb deleted file mode 100644 index 938f7ac6b2fd..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/api/httpbody.rb +++ /dev/null @@ -1,80 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Api - # Message that represents an arbitrary HTTP body. It should only be used for - # payload formats that can't be represented as JSON, such as raw binary or - # an HTML page. - # - # - # This message can be used both in streaming and non-streaming API methods in - # the request as well as the response. - # - # It can be used as a top-level request field, which is convenient if one - # wants to extract parameters from either the URL or HTTP template into the - # request fields and also want access to the raw HTTP body. - # - # Example: - # - # message GetResourceRequest { - # // A unique request id. - # string request_id = 1; - # - # // The raw HTTP body is bound to this field. - # google.api.HttpBody http_body = 2; - # - # } - # - # service ResourceService { - # rpc GetResource(GetResourceRequest) - # returns (google.api.HttpBody); - # rpc UpdateResource(google.api.HttpBody) - # returns (google.protobuf.Empty); - # - # } - # - # Example with streaming methods: - # - # service CaldavService { - # rpc GetCalendar(stream google.api.HttpBody) - # returns (stream google.api.HttpBody); - # rpc UpdateCalendar(stream google.api.HttpBody) - # returns (stream google.api.HttpBody); - # - # } - # - # Use of this type only changes how the request and response bodies are - # handled, all other features will continue to work unchanged. - # @!attribute [rw] content_type - # @return [::String] - # The HTTP Content-Type header value specifying the content type of the body. - # @!attribute [rw] data - # @return [::String] - # The HTTP request/response body as raw binary. - # @!attribute [rw] extensions - # @return [::Array<::Google::Protobuf::Any>] - # Application specific response metadata. Must be set in the first response - # for streaming APIs. - class HttpBody - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/api/launch_stage.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/api/launch_stage.rb deleted file mode 100644 index 9392a413fb1b..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/api/launch_stage.rb +++ /dev/null @@ -1,71 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Api - # The launch stage as defined by [Google Cloud Platform - # Launch Stages](https://cloud.google.com/terms/launch-stages). - module LaunchStage - # Do not use this default value. - LAUNCH_STAGE_UNSPECIFIED = 0 - - # The feature is not yet implemented. Users can not use it. - UNIMPLEMENTED = 6 - - # Prelaunch features are hidden from users and are only visible internally. - PRELAUNCH = 7 - - # Early Access features are limited to a closed group of testers. To use - # these features, you must sign up in advance and sign a Trusted Tester - # agreement (which includes confidentiality provisions). These features may - # be unstable, changed in backward-incompatible ways, and are not - # guaranteed to be released. - EARLY_ACCESS = 1 - - # Alpha is a limited availability test for releases before they are cleared - # for widespread use. By Alpha, all significant design issues are resolved - # and we are in the process of verifying functionality. Alpha customers - # need to apply for access, agree to applicable terms, and have their - # projects allowlisted. Alpha releases don't have to be feature complete, - # no SLAs are provided, and there are no technical support obligations, but - # they will be far enough along that customers can actually use them in - # test environments or for limited-use tests -- just like they would in - # normal production cases. - ALPHA = 2 - - # Beta is the point at which we are ready to open a release for any - # customer to use. There are no SLA or technical support obligations in a - # Beta release. Products will be complete from a feature perspective, but - # may have some open outstanding issues. Beta releases are suitable for - # limited production use cases. - BETA = 3 - - # GA features are open to all developers and are considered stable and - # fully qualified for production use. - GA = 4 - - # Deprecated features are scheduled to be shut down and removed. For more - # information, see the "Deprecation Policy" section of our [Terms of - # Service](https://cloud.google.com/terms/) - # and the [Google Cloud Platform Subject to the Deprecation - # Policy](https://cloud.google.com/terms/deprecation) documentation. - DEPRECATED = 5 - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/api/resource.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/api/resource.rb deleted file mode 100644 index 25dec4847ac1..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/api/resource.rb +++ /dev/null @@ -1,227 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Api - # A simple descriptor of a resource type. - # - # ResourceDescriptor annotates a resource message (either by means of a - # protobuf annotation or use in the service config), and associates the - # resource's schema, the resource type, and the pattern of the resource name. - # - # Example: - # - # message Topic { - # // Indicates this message defines a resource schema. - # // Declares the resource type in the format of {service}/{kind}. - # // For Kubernetes resources, the format is {api group}/{kind}. - # option (google.api.resource) = { - # type: "pubsub.googleapis.com/Topic" - # pattern: "projects/{project}/topics/{topic}" - # }; - # } - # - # The ResourceDescriptor Yaml config will look like: - # - # resources: - # - type: "pubsub.googleapis.com/Topic" - # pattern: "projects/{project}/topics/{topic}" - # - # Sometimes, resources have multiple patterns, typically because they can - # live under multiple parents. - # - # Example: - # - # message LogEntry { - # option (google.api.resource) = { - # type: "logging.googleapis.com/LogEntry" - # pattern: "projects/{project}/logs/{log}" - # pattern: "folders/{folder}/logs/{log}" - # pattern: "organizations/{organization}/logs/{log}" - # pattern: "billingAccounts/{billing_account}/logs/{log}" - # }; - # } - # - # The ResourceDescriptor Yaml config will look like: - # - # resources: - # - type: 'logging.googleapis.com/LogEntry' - # pattern: "projects/{project}/logs/{log}" - # pattern: "folders/{folder}/logs/{log}" - # pattern: "organizations/{organization}/logs/{log}" - # pattern: "billingAccounts/{billing_account}/logs/{log}" - # @!attribute [rw] type - # @return [::String] - # The resource type. It must be in the format of - # \\{service_name}/\\{resource_type_kind}. The `resource_type_kind` must be - # singular and must not include version numbers. - # - # Example: `storage.googleapis.com/Bucket` - # - # The value of the resource_type_kind must follow the regular expression - # /[A-Za-z][a-zA-Z0-9]+/. It should start with an upper case character and - # should use PascalCase (UpperCamelCase). The maximum number of - # characters allowed for the `resource_type_kind` is 100. - # @!attribute [rw] pattern - # @return [::Array<::String>] - # Optional. The relative resource name pattern associated with this resource - # type. The DNS prefix of the full resource name shouldn't be specified here. - # - # The path pattern must follow the syntax, which aligns with HTTP binding - # syntax: - # - # Template = Segment { "/" Segment } ; - # Segment = LITERAL | Variable ; - # Variable = "{" LITERAL "}" ; - # - # Examples: - # - # - "projects/\\{project}/topics/\\{topic}" - # - "projects/\\{project}/knowledgeBases/\\{knowledge_base}" - # - # The components in braces correspond to the IDs for each resource in the - # hierarchy. It is expected that, if multiple patterns are provided, - # the same component name (e.g. "project") refers to IDs of the same - # type of resource. - # @!attribute [rw] name_field - # @return [::String] - # Optional. The field on the resource that designates the resource name - # field. If omitted, this is assumed to be "name". - # @!attribute [rw] history - # @return [::Google::Api::ResourceDescriptor::History] - # Optional. The historical or future-looking state of the resource pattern. - # - # Example: - # - # // The InspectTemplate message originally only supported resource - # // names with organization, and project was added later. - # message InspectTemplate { - # option (google.api.resource) = { - # type: "dlp.googleapis.com/InspectTemplate" - # pattern: - # "organizations/{organization}/inspectTemplates/{inspect_template}" - # pattern: "projects/{project}/inspectTemplates/{inspect_template}" - # history: ORIGINALLY_SINGLE_PATTERN - # }; - # } - # @!attribute [rw] plural - # @return [::String] - # The plural name used in the resource name and permission names, such as - # 'projects' for the resource name of 'projects/\\{project}' and the permission - # name of 'cloudresourcemanager.googleapis.com/projects.get'. One exception - # to this is for Nested Collections that have stuttering names, as defined - # in [AIP-122](https://google.aip.dev/122#nested-collections), where the - # collection ID in the resource name pattern does not necessarily directly - # match the `plural` value. - # - # It is the same concept of the `plural` field in k8s CRD spec - # https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/ - # - # Note: The plural form is required even for singleton resources. See - # https://aip.dev/156 - # @!attribute [rw] singular - # @return [::String] - # The same concept of the `singular` field in k8s CRD spec - # https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/ - # Such as "project" for the `resourcemanager.googleapis.com/Project` type. - # @!attribute [rw] style - # @return [::Array<::Google::Api::ResourceDescriptor::Style>] - # Style flag(s) for this resource. - # These indicate that a resource is expected to conform to a given - # style. See the specific style flags for additional information. - class ResourceDescriptor - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # A description of the historical or future-looking state of the - # resource pattern. - module History - # The "unset" value. - HISTORY_UNSPECIFIED = 0 - - # The resource originally had one pattern and launched as such, and - # additional patterns were added later. - ORIGINALLY_SINGLE_PATTERN = 1 - - # The resource has one pattern, but the API owner expects to add more - # later. (This is the inverse of ORIGINALLY_SINGLE_PATTERN, and prevents - # that from being necessary once there are multiple patterns.) - FUTURE_MULTI_PATTERN = 2 - end - - # A flag representing a specific style that a resource claims to conform to. - module Style - # The unspecified value. Do not use. - STYLE_UNSPECIFIED = 0 - - # This resource is intended to be "declarative-friendly". - # - # Declarative-friendly resources must be more strictly consistent, and - # setting this to true communicates to tools that this resource should - # adhere to declarative-friendly expectations. - # - # Note: This is used by the API linter (linter.aip.dev) to enable - # additional checks. - DECLARATIVE_FRIENDLY = 1 - end - end - - # Defines a proto annotation that describes a string field that refers to - # an API resource. - # @!attribute [rw] type - # @return [::String] - # The resource type that the annotated field references. - # - # Example: - # - # message Subscription { - # string topic = 2 [(google.api.resource_reference) = { - # type: "pubsub.googleapis.com/Topic" - # }]; - # } - # - # Occasionally, a field may reference an arbitrary resource. In this case, - # APIs use the special value * in their resource reference. - # - # Example: - # - # message GetIamPolicyRequest { - # string resource = 2 [(google.api.resource_reference) = { - # type: "*" - # }]; - # } - # @!attribute [rw] child_type - # @return [::String] - # The resource type of a child collection that the annotated field - # references. This is useful for annotating the `parent` field that - # doesn't have a fixed resource type. - # - # Example: - # - # message ListLogEntriesRequest { - # string parent = 1 [(google.api.resource_reference) = { - # child_type: "logging.googleapis.com/LogEntry" - # }; - # } - class ResourceReference - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/catalog.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/catalog.rb deleted file mode 100644 index 40edde6ddced..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/catalog.rb +++ /dev/null @@ -1,516 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Cloud - module Retail - module V2 - # Configures what level the product should be uploaded with regards to - # how users will be send events and how predictions will be made. - # @!attribute [rw] ingestion_product_type - # @return [::String] - # The type of {::Google::Cloud::Retail::V2::Product Product}s allowed to be - # ingested into the catalog. Acceptable values are: - # - # * `primary` (default): You can ingest - # {::Google::Cloud::Retail::V2::Product Product}s of all types. When - # ingesting a {::Google::Cloud::Retail::V2::Product Product}, its type will - # default to - # {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Product.Type.PRIMARY} if - # unset. - # * `variant` (incompatible with Retail Search): You can only - # ingest - # {::Google::Cloud::Retail::V2::Product::Type::VARIANT Product.Type.VARIANT} - # {::Google::Cloud::Retail::V2::Product Product}s. This means - # {::Google::Cloud::Retail::V2::Product#primary_product_id Product.primary_product_id} - # cannot be empty. - # - # If this field is set to an invalid value other than these, an - # INVALID_ARGUMENT error is returned. - # - # If this field is `variant` and - # {::Google::Cloud::Retail::V2::ProductLevelConfig#merchant_center_product_id_field merchant_center_product_id_field} - # is `itemGroupId`, an INVALID_ARGUMENT error is returned. - # - # See [Product - # levels](https://cloud.google.com/retail/docs/catalog#product-levels) - # for more details. - # @!attribute [rw] merchant_center_product_id_field - # @return [::String] - # Which field of [Merchant Center - # Product](/bigquery-transfer/docs/merchant-center-products-schema) should be - # imported as {::Google::Cloud::Retail::V2::Product#id Product.id}. Acceptable - # values are: - # - # * `offerId` (default): Import `offerId` as the product ID. - # * `itemGroupId`: Import `itemGroupId` as the product ID. Notice that Retail - # API will choose one item from the ones with the same `itemGroupId`, and - # use it to represent the item group. - # - # If this field is set to an invalid value other than these, an - # INVALID_ARGUMENT error is returned. - # - # If this field is `itemGroupId` and - # {::Google::Cloud::Retail::V2::ProductLevelConfig#ingestion_product_type ingestion_product_type} - # is `variant`, an INVALID_ARGUMENT error is returned. - # - # See [Product - # levels](https://cloud.google.com/retail/docs/catalog#product-levels) - # for more details. - class ProductLevelConfig - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Catalog level attribute config for an attribute. For example, if customers - # want to enable/disable facet for a specific attribute. - # @!attribute [rw] key - # @return [::String] - # Required. Attribute name. - # For example: `color`, `brands`, `attributes.custom_attribute`, such as - # `attributes.xyz`. - # To be indexable, the attribute name can contain only alpha-numeric - # characters and underscores. For example, an attribute named - # `attributes.abc_xyz` can be indexed, but an attribute named - # `attributes.abc-xyz` cannot be indexed. - # - # If the attribute key starts with `attributes.`, then the attribute is a - # custom attribute. Attributes such as `brands`, `patterns`, and `title` are - # built-in and called system attributes. - # @!attribute [r] in_use - # @return [::Boolean] - # Output only. Indicates whether this attribute has been used by any - # products. `True` if at least one {::Google::Cloud::Retail::V2::Product Product} - # is using this attribute in - # {::Google::Cloud::Retail::V2::Product#attributes Product.attributes}. Otherwise, - # this field is `False`. - # - # {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} can be - # pre-loaded by using - # {::Google::Cloud::Retail::V2::CatalogService::Client#add_catalog_attribute CatalogService.AddCatalogAttribute} - # or - # {::Google::Cloud::Retail::V2::CatalogService::Client#update_attributes_config CatalogService.UpdateAttributesConfig} - # APIs. This field is `False` for pre-loaded - # {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute}s. - # - # Only pre-loaded [catalog - # attributes][google.cloud.retail.v2.CatalogAttribute] that are neither in - # use by products nor predefined can be deleted. [Catalog - # attributes][google.cloud.retail.v2.CatalogAttribute] that are - # either in use by products or are predefined attributes cannot be deleted; - # however, their configuration properties will reset to default values upon - # removal request. - # - # After catalog changes, it takes about 10 minutes for this field to update. - # @!attribute [r] type - # @return [::Google::Cloud::Retail::V2::CatalogAttribute::AttributeType] - # Output only. The type of this attribute. This is derived from the attribute - # in {::Google::Cloud::Retail::V2::Product#attributes Product.attributes}. - # @!attribute [rw] indexable_option - # @return [::Google::Cloud::Retail::V2::CatalogAttribute::IndexableOption] - # When - # {::Google::Cloud::Retail::V2::AttributesConfig#attribute_config_level AttributesConfig.attribute_config_level} - # is CATALOG_LEVEL_ATTRIBUTE_CONFIG, if INDEXABLE_ENABLED attribute values - # are indexed so that it can be filtered, faceted, or boosted in - # {::Google::Cloud::Retail::V2::SearchService::Client#search SearchService.Search}. - # - # Must be specified when - # {::Google::Cloud::Retail::V2::AttributesConfig#attribute_config_level AttributesConfig.attribute_config_level} - # is CATALOG_LEVEL_ATTRIBUTE_CONFIG, otherwise throws INVALID_FORMAT error. - # @!attribute [rw] dynamic_facetable_option - # @return [::Google::Cloud::Retail::V2::CatalogAttribute::DynamicFacetableOption] - # If DYNAMIC_FACETABLE_ENABLED, attribute values are available for dynamic - # facet. Could only be DYNAMIC_FACETABLE_DISABLED if - # {::Google::Cloud::Retail::V2::CatalogAttribute#indexable_option CatalogAttribute.indexable_option} - # is INDEXABLE_DISABLED. Otherwise, an INVALID_ARGUMENT error is returned. - # - # Must be specified, otherwise throws INVALID_FORMAT error. - # @!attribute [rw] searchable_option - # @return [::Google::Cloud::Retail::V2::CatalogAttribute::SearchableOption] - # When - # {::Google::Cloud::Retail::V2::AttributesConfig#attribute_config_level AttributesConfig.attribute_config_level} - # is CATALOG_LEVEL_ATTRIBUTE_CONFIG, if SEARCHABLE_ENABLED, attribute values - # are searchable by text queries in - # {::Google::Cloud::Retail::V2::SearchService::Client#search SearchService.Search}. - # - # If SEARCHABLE_ENABLED but attribute type is numerical, attribute values - # will not be searchable by text queries in - # {::Google::Cloud::Retail::V2::SearchService::Client#search SearchService.Search}, as - # there are no text values associated to numerical attributes. - # - # Must be specified, when - # {::Google::Cloud::Retail::V2::AttributesConfig#attribute_config_level AttributesConfig.attribute_config_level} - # is CATALOG_LEVEL_ATTRIBUTE_CONFIG, otherwise throws INVALID_FORMAT error. - # @!attribute [rw] exact_searchable_option - # @return [::Google::Cloud::Retail::V2::CatalogAttribute::ExactSearchableOption] - # If EXACT_SEARCHABLE_ENABLED, attribute values will be exact searchable. - # This property only applies to textual custom attributes and requires - # indexable set to enabled to enable exact-searchable. If unset, the server - # behavior defaults to - # {::Google::Cloud::Retail::V2::CatalogAttribute::ExactSearchableOption::EXACT_SEARCHABLE_DISABLED EXACT_SEARCHABLE_DISABLED}. - # @!attribute [rw] retrievable_option - # @return [::Google::Cloud::Retail::V2::CatalogAttribute::RetrievableOption] - # If RETRIEVABLE_ENABLED, attribute values are retrievable in the search - # results. If unset, the server behavior defaults to - # {::Google::Cloud::Retail::V2::CatalogAttribute::RetrievableOption::RETRIEVABLE_DISABLED RETRIEVABLE_DISABLED}. - # @!attribute [rw] facet_config - # @return [::Google::Cloud::Retail::V2::CatalogAttribute::FacetConfig] - # Contains facet options. - class CatalogAttribute - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # Possible options for the facet that corresponds to the current attribute - # config. - # @!attribute [rw] facet_intervals - # @return [::Array<::Google::Cloud::Retail::V2::Interval>] - # If you don't set the facet - # {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#intervals SearchRequest.FacetSpec.FacetKey.intervals} - # in the request to a numerical attribute, then we use the computed - # intervals with rounded bounds obtained from all its product numerical - # attribute values. The computed intervals might not be ideal for some - # attributes. Therefore, we give you the option to overwrite them with the - # facet_intervals field. The maximum of facet intervals per - # {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} is 40. Each - # interval must have a lower bound or an upper bound. If both bounds are - # provided, then the lower bound must be smaller or equal than the upper - # bound. - # @!attribute [rw] ignored_facet_values - # @return [::Array<::Google::Cloud::Retail::V2::CatalogAttribute::FacetConfig::IgnoredFacetValues>] - # Each instance represents a list of attribute values to ignore as facet - # values for a specific time range. The maximum number of instances per - # {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} is 25. - # @!attribute [rw] merged_facet_values - # @return [::Array<::Google::Cloud::Retail::V2::CatalogAttribute::FacetConfig::MergedFacetValue>] - # Each instance replaces a list of facet values by a merged facet - # value. If a facet value is not in any list, then it will stay the same. - # To avoid conflicts, only paths of length 1 are accepted. In other words, - # if "dark_blue" merged into "BLUE", then the latter can't merge into - # "blues" because this would create a path of length 2. The maximum number - # of instances of MergedFacetValue per - # {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} is 100. This - # feature is available only for textual custom attributes. - # @!attribute [rw] merged_facet - # @return [::Google::Cloud::Retail::V2::CatalogAttribute::FacetConfig::MergedFacet] - # Use this field only if you want to merge a facet key into another facet - # key. - # @!attribute [rw] rerank_config - # @return [::Google::Cloud::Retail::V2::CatalogAttribute::FacetConfig::RerankConfig] - # Set this field only if you want to rerank based on facet values engaged - # by the user for the current key. This option is only possible for custom - # facetable textual keys. - class FacetConfig - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # {::Google::Cloud::Retail::V2::SearchResponse::Facet#values Facet values} to - # ignore on {::Google::Cloud::Retail::V2::SearchResponse::Facet facets} during - # the specified time range for the given - # {::Google::Cloud::Retail::V2::SearchResponse::Facet#key SearchResponse.Facet.key} - # attribute. - # @!attribute [rw] values - # @return [::Array<::String>] - # List of facet values to ignore for the following time range. The facet - # values are the same as the attribute values. There is a limit of 10 - # values per instance of IgnoredFacetValues. Each value can have at most - # 128 characters. - # @!attribute [rw] start_time - # @return [::Google::Protobuf::Timestamp] - # Time range for the current list of facet values to ignore. - # If multiple time ranges are specified for an facet value for the - # current attribute, consider all of them. If both are empty, ignore - # always. If start time and end time are set, then start time - # must be before end time. - # If start time is not empty and end time is empty, then will ignore - # these facet values after the start time. - # @!attribute [rw] end_time - # @return [::Google::Protobuf::Timestamp] - # If start time is empty and end time is not empty, then ignore these - # facet values before end time. - class IgnoredFacetValues - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Replaces a set of textual facet values by the same (possibly different) - # merged facet value. Each facet value should appear at most once as a - # value per {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute}. - # This feature is available only for textual custom attributes. - # @!attribute [rw] values - # @return [::Array<::String>] - # All the facet values that are replaces by the same - # {::Google::Cloud::Retail::V2::CatalogAttribute::FacetConfig::MergedFacetValue#merged_value merged_value} - # that follows. The maximum number of values per MergedFacetValue is 25. - # Each value can have up to 128 characters. - # @!attribute [rw] merged_value - # @return [::String] - # All the previous values are replaced by this merged facet value. - # This merged_value must be non-empty and can have up to 128 characters. - class MergedFacetValue - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # The current facet key (i.e. attribute config) maps into the - # {::Google::Cloud::Retail::V2::CatalogAttribute::FacetConfig::MergedFacet#merged_facet_key merged_facet_key}. - # A facet key can have at most one child. The current facet key and the - # merged facet key need both to be textual custom attributes or both - # numerical custom attributes (same type). - # @!attribute [rw] merged_facet_key - # @return [::String] - # The merged facet key should be a valid facet key that is different than - # the facet key of the current catalog attribute. We refer this is - # merged facet key as the child of the current catalog attribute. This - # merged facet key can't be a parent of another facet key (i.e. no - # directed path of length 2). This merged facet key needs to be either a - # textual custom attribute or a numerical custom attribute. - class MergedFacet - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Options to rerank based on facet values engaged by the user for the - # current key. That key needs to be a custom textual key and facetable. - # To use this control, you also need to pass all the facet keys engaged by - # the user in the request using the field [SearchRequest.FacetSpec]. In - # particular, if you don't pass the facet keys engaged that you want to - # rerank on, this control won't be effective. Moreover, to obtain better - # results, the facet values that you want to rerank on should be close to - # English (ideally made of words, underscores, and spaces). - # @!attribute [rw] rerank_facet - # @return [::Boolean] - # If set to true, then we also rerank the dynamic facets based on the - # facet values engaged by the user for the current attribute key during - # serving. - # @!attribute [rw] facet_values - # @return [::Array<::String>] - # If empty, rerank on all facet values for the current key. Otherwise, - # will rerank on the facet values from this list only. - class RerankConfig - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - - # The type of an attribute. - module AttributeType - # The type of the attribute is unknown. - # - # Used when type cannot be derived from attribute that is not - # {::Google::Cloud::Retail::V2::CatalogAttribute#in_use in_use}. - UNKNOWN = 0 - - # Textual attribute. - TEXTUAL = 1 - - # Numerical attribute. - NUMERICAL = 2 - end - - # The status of the indexable option of a catalog attribute. - module IndexableOption - # Value used when unset. - INDEXABLE_OPTION_UNSPECIFIED = 0 - - # Indexable option enabled for an attribute. - INDEXABLE_ENABLED = 1 - - # Indexable option disabled for an attribute. - INDEXABLE_DISABLED = 2 - end - - # The status of the dynamic facetable option of a catalog attribute. - module DynamicFacetableOption - # Value used when unset. - DYNAMIC_FACETABLE_OPTION_UNSPECIFIED = 0 - - # Dynamic facetable option enabled for an attribute. - DYNAMIC_FACETABLE_ENABLED = 1 - - # Dynamic facetable option disabled for an attribute. - DYNAMIC_FACETABLE_DISABLED = 2 - end - - # The status of the searchable option of a catalog attribute. - module SearchableOption - # Value used when unset. - SEARCHABLE_OPTION_UNSPECIFIED = 0 - - # Searchable option enabled for an attribute. - SEARCHABLE_ENABLED = 1 - - # Searchable option disabled for an attribute. - SEARCHABLE_DISABLED = 2 - end - - # The status of the exact-searchable option of a catalog attribute. - module ExactSearchableOption - # Value used when unset. - EXACT_SEARCHABLE_OPTION_UNSPECIFIED = 0 - - # Exact searchable option enabled for an attribute. - EXACT_SEARCHABLE_ENABLED = 1 - - # Exact searchable option disabled for an attribute. - EXACT_SEARCHABLE_DISABLED = 2 - end - - # The status of the retrievable option of a catalog attribute. - module RetrievableOption - # Value used when unset. - RETRIEVABLE_OPTION_UNSPECIFIED = 0 - - # Retrievable option enabled for an attribute. - RETRIEVABLE_ENABLED = 1 - - # Retrievable option disabled for an attribute. - RETRIEVABLE_DISABLED = 2 - end - end - - # Catalog level attribute config. - # @!attribute [rw] name - # @return [::String] - # Required. Immutable. The fully qualified resource name of the attribute - # config. Format: `projects/*/locations/*/catalogs/*/attributesConfig` - # @!attribute [rw] catalog_attributes - # @return [::Google::Protobuf::Map{::String => ::Google::Cloud::Retail::V2::CatalogAttribute}] - # Enable attribute(s) config at catalog level. - # For example, indexable, dynamic_facetable, or searchable for each - # attribute. - # - # The key is catalog attribute's name. - # For example: `color`, `brands`, `attributes.custom_attribute`, such as - # `attributes.xyz`. - # - # The maximum number of catalog attributes allowed in a request is 1000. - # @!attribute [r] attribute_config_level - # @return [::Google::Cloud::Retail::V2::AttributeConfigLevel] - # Output only. The - # {::Google::Cloud::Retail::V2::AttributeConfigLevel AttributeConfigLevel} used - # for this catalog. - class AttributesConfig - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # @!attribute [rw] key - # @return [::String] - # @!attribute [rw] value - # @return [::Google::Cloud::Retail::V2::CatalogAttribute] - class CatalogAttributesEntry - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - - # Catalog level autocomplete config for customers to customize autocomplete - # feature's settings. - # @!attribute [rw] name - # @return [::String] - # Required. Immutable. Fully qualified name - # `projects/*/locations/*/catalogs/*/completionConfig` - # @!attribute [rw] matching_order - # @return [::String] - # Specifies the matching order for autocomplete suggestions, e.g., a query - # consisting of 'sh' with 'out-of-order' specified would suggest "women's - # shoes", whereas a query of 'red s' with 'exact-prefix' specified would - # suggest "red shoes". Currently supported values: - # - # * 'out-of-order' - # * 'exact-prefix' - # - # Default value: 'exact-prefix'. - # @!attribute [rw] max_suggestions - # @return [::Integer] - # The maximum number of autocomplete suggestions returned per term. Default - # value is 20. If left unset or set to 0, then will fallback to default - # value. - # - # Value range is 1 to 20. - # @!attribute [rw] min_prefix_length - # @return [::Integer] - # The minimum number of characters needed to be typed in order to get - # suggestions. Default value is 2. If left unset or set to 0, then will - # fallback to default value. - # - # Value range is 1 to 20. - # @!attribute [rw] auto_learning - # @return [::Boolean] - # If set to true, the auto learning function is enabled. Auto learning uses - # user data to generate suggestions using ML techniques. Default value is - # false. Only after enabling auto learning can users use `cloud-retail` - # data in - # {::Google::Cloud::Retail::V2::CompleteQueryRequest CompleteQueryRequest}. - # @!attribute [r] suggestions_input_config - # @return [::Google::Cloud::Retail::V2::CompletionDataInputConfig] - # Output only. The source data for the latest import of the autocomplete - # suggestion phrases. - # @!attribute [r] last_suggestions_import_operation - # @return [::String] - # Output only. Name of the LRO corresponding to the latest suggestion terms - # list import. - # - # Can use GetOperation API - # method to retrieve the latest state of the Long Running Operation. - # @!attribute [r] denylist_input_config - # @return [::Google::Cloud::Retail::V2::CompletionDataInputConfig] - # Output only. The source data for the latest import of the autocomplete - # denylist phrases. - # @!attribute [r] last_denylist_import_operation - # @return [::String] - # Output only. Name of the LRO corresponding to the latest denylist import. - # - # Can use GetOperation API to - # retrieve the latest state of the Long Running Operation. - # @!attribute [r] allowlist_input_config - # @return [::Google::Cloud::Retail::V2::CompletionDataInputConfig] - # Output only. The source data for the latest import of the autocomplete - # allowlist phrases. - # @!attribute [r] last_allowlist_import_operation - # @return [::String] - # Output only. Name of the LRO corresponding to the latest allowlist import. - # - # Can use GetOperation API to - # retrieve the latest state of the Long Running Operation. - class CompletionConfig - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # The catalog configuration. - # @!attribute [rw] name - # @return [::String] - # Required. Immutable. The fully qualified resource name of the catalog. - # @!attribute [rw] display_name - # @return [::String] - # Required. Immutable. The catalog display name. - # - # This field must be a UTF-8 encoded string with a length limit of 128 - # characters. Otherwise, an INVALID_ARGUMENT error is returned. - # @!attribute [rw] product_level_config - # @return [::Google::Cloud::Retail::V2::ProductLevelConfig] - # Required. The product level configuration. - class Catalog - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/catalog_service.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/catalog_service.rb deleted file mode 100644 index 062dd48b9cbe..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/catalog_service.rb +++ /dev/null @@ -1,297 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Cloud - module Retail - module V2 - # Request for - # {::Google::Cloud::Retail::V2::CatalogService::Client#list_catalogs CatalogService.ListCatalogs} - # method. - # @!attribute [rw] parent - # @return [::String] - # Required. The account resource name with an associated location. - # - # If the caller does not have permission to list - # {::Google::Cloud::Retail::V2::Catalog Catalog}s under this location, regardless - # of whether or not this location exists, a PERMISSION_DENIED error is - # returned. - # @!attribute [rw] page_size - # @return [::Integer] - # Maximum number of {::Google::Cloud::Retail::V2::Catalog Catalog}s to return. If - # unspecified, defaults to 50. The maximum allowed value is 1000. Values - # above 1000 will be coerced to 1000. - # - # If this field is negative, an INVALID_ARGUMENT is returned. - # @!attribute [rw] page_token - # @return [::String] - # A page token - # {::Google::Cloud::Retail::V2::ListCatalogsResponse#next_page_token ListCatalogsResponse.next_page_token}, - # received from a previous - # {::Google::Cloud::Retail::V2::CatalogService::Client#list_catalogs CatalogService.ListCatalogs} - # call. Provide this to retrieve the subsequent page. - # - # When paginating, all other parameters provided to - # {::Google::Cloud::Retail::V2::CatalogService::Client#list_catalogs CatalogService.ListCatalogs} - # must match the call that provided the page token. Otherwise, an - # INVALID_ARGUMENT error is returned. - class ListCatalogsRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Response for - # {::Google::Cloud::Retail::V2::CatalogService::Client#list_catalogs CatalogService.ListCatalogs} - # method. - # @!attribute [rw] catalogs - # @return [::Array<::Google::Cloud::Retail::V2::Catalog>] - # All the customer's {::Google::Cloud::Retail::V2::Catalog Catalog}s. - # @!attribute [rw] next_page_token - # @return [::String] - # A token that can be sent as - # {::Google::Cloud::Retail::V2::ListCatalogsRequest#page_token ListCatalogsRequest.page_token} - # to retrieve the next page. If this field is omitted, there are no - # subsequent pages. - class ListCatalogsResponse - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request for - # {::Google::Cloud::Retail::V2::CatalogService::Client#update_catalog CatalogService.UpdateCatalog} - # method. - # @!attribute [rw] catalog - # @return [::Google::Cloud::Retail::V2::Catalog] - # Required. The {::Google::Cloud::Retail::V2::Catalog Catalog} to update. - # - # If the caller does not have permission to update the - # {::Google::Cloud::Retail::V2::Catalog Catalog}, regardless of whether or not it - # exists, a PERMISSION_DENIED error is returned. - # - # If the {::Google::Cloud::Retail::V2::Catalog Catalog} to update does not exist, - # a NOT_FOUND error is returned. - # @!attribute [rw] update_mask - # @return [::Google::Protobuf::FieldMask] - # Indicates which fields in the provided - # {::Google::Cloud::Retail::V2::Catalog Catalog} to update. - # - # If an unsupported or unknown field is provided, an INVALID_ARGUMENT error - # is returned. - class UpdateCatalogRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request message to set a specified branch as new default_branch. - # @!attribute [rw] catalog - # @return [::String] - # Full resource name of the catalog, such as - # `projects/*/locations/global/catalogs/default_catalog`. - # @!attribute [rw] branch_id - # @return [::String] - # The final component of the resource name of a branch. - # - # This field must be one of "0", "1" or "2". Otherwise, an INVALID_ARGUMENT - # error is returned. - # - # If there are no sufficient active products in the targeted branch and - # {::Google::Cloud::Retail::V2::SetDefaultBranchRequest#force force} is not set, a - # FAILED_PRECONDITION error is returned. - # @!attribute [rw] note - # @return [::String] - # Some note on this request, this can be retrieved by - # {::Google::Cloud::Retail::V2::CatalogService::Client#get_default_branch CatalogService.GetDefaultBranch} - # before next valid default branch set occurs. - # - # This field must be a UTF-8 encoded string with a length limit of 1,000 - # characters. Otherwise, an INVALID_ARGUMENT error is returned. - # @!attribute [rw] force - # @return [::Boolean] - # If set to true, it permits switching to a branch with - # {::Google::Cloud::Retail::V2::SetDefaultBranchRequest#branch_id branch_id} even - # if it has no sufficient active products. - class SetDefaultBranchRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request message to show which branch is currently the default branch. - # @!attribute [rw] catalog - # @return [::String] - # The parent catalog resource name, such as - # `projects/*/locations/global/catalogs/default_catalog`. - class GetDefaultBranchRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Response message of - # {::Google::Cloud::Retail::V2::CatalogService::Client#get_default_branch CatalogService.GetDefaultBranch}. - # @!attribute [rw] branch - # @return [::String] - # Full resource name of the branch id currently set as default branch. - # @!attribute [rw] set_time - # @return [::Google::Protobuf::Timestamp] - # The time when this branch is set to default. - # @!attribute [rw] note - # @return [::String] - # This corresponds to - # {::Google::Cloud::Retail::V2::SetDefaultBranchRequest#note SetDefaultBranchRequest.note} - # field, when this branch was set as default. - class GetDefaultBranchResponse - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request for - # {::Google::Cloud::Retail::V2::CatalogService::Client#get_completion_config CatalogService.GetCompletionConfig} - # method. - # @!attribute [rw] name - # @return [::String] - # Required. Full CompletionConfig resource name. Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig` - class GetCompletionConfigRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request for - # {::Google::Cloud::Retail::V2::CatalogService::Client#update_completion_config CatalogService.UpdateCompletionConfig} - # method. - # @!attribute [rw] completion_config - # @return [::Google::Cloud::Retail::V2::CompletionConfig] - # Required. The {::Google::Cloud::Retail::V2::CompletionConfig CompletionConfig} - # to update. - # - # If the caller does not have permission to update the - # {::Google::Cloud::Retail::V2::CompletionConfig CompletionConfig}, then a - # PERMISSION_DENIED error is returned. - # - # If the {::Google::Cloud::Retail::V2::CompletionConfig CompletionConfig} to - # update does not exist, a NOT_FOUND error is returned. - # @!attribute [rw] update_mask - # @return [::Google::Protobuf::FieldMask] - # Indicates which fields in the provided - # {::Google::Cloud::Retail::V2::CompletionConfig CompletionConfig} to update. The - # following are the only supported fields: - # - # * {::Google::Cloud::Retail::V2::CompletionConfig#matching_order CompletionConfig.matching_order} - # * {::Google::Cloud::Retail::V2::CompletionConfig#max_suggestions CompletionConfig.max_suggestions} - # * {::Google::Cloud::Retail::V2::CompletionConfig#min_prefix_length CompletionConfig.min_prefix_length} - # * {::Google::Cloud::Retail::V2::CompletionConfig#auto_learning CompletionConfig.auto_learning} - # - # If not set, all supported fields are updated. - class UpdateCompletionConfigRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request for - # {::Google::Cloud::Retail::V2::CatalogService::Client#get_attributes_config CatalogService.GetAttributesConfig} - # method. - # @!attribute [rw] name - # @return [::String] - # Required. Full AttributesConfig resource name. Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` - class GetAttributesConfigRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request for - # {::Google::Cloud::Retail::V2::CatalogService::Client#update_attributes_config CatalogService.UpdateAttributesConfig} - # method. - # @!attribute [rw] attributes_config - # @return [::Google::Cloud::Retail::V2::AttributesConfig] - # Required. The {::Google::Cloud::Retail::V2::AttributesConfig AttributesConfig} - # to update. - # @!attribute [rw] update_mask - # @return [::Google::Protobuf::FieldMask] - # Indicates which fields in the provided - # {::Google::Cloud::Retail::V2::AttributesConfig AttributesConfig} to update. The - # following is the only supported field: - # - # * {::Google::Cloud::Retail::V2::AttributesConfig#catalog_attributes AttributesConfig.catalog_attributes} - # - # If not set, all supported fields are updated. - class UpdateAttributesConfigRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request for - # {::Google::Cloud::Retail::V2::CatalogService::Client#add_catalog_attribute CatalogService.AddCatalogAttribute} - # method. - # @!attribute [rw] attributes_config - # @return [::String] - # Required. Full AttributesConfig resource name. Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` - # @!attribute [rw] catalog_attribute - # @return [::Google::Cloud::Retail::V2::CatalogAttribute] - # Required. The {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} - # to add. - class AddCatalogAttributeRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request for - # {::Google::Cloud::Retail::V2::CatalogService::Client#remove_catalog_attribute CatalogService.RemoveCatalogAttribute} - # method. - # @!attribute [rw] attributes_config - # @return [::String] - # Required. Full AttributesConfig resource name. Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` - # @!attribute [rw] key - # @return [::String] - # Required. The attribute name key of the - # {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} to remove. - class RemoveCatalogAttributeRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request for - # {::Google::Cloud::Retail::V2::CatalogService::Client#replace_catalog_attribute CatalogService.ReplaceCatalogAttribute} - # method. - # @!attribute [rw] attributes_config - # @return [::String] - # Required. Full AttributesConfig resource name. Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` - # @!attribute [rw] catalog_attribute - # @return [::Google::Cloud::Retail::V2::CatalogAttribute] - # Required. The updated - # {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute}. - # @!attribute [rw] update_mask - # @return [::Google::Protobuf::FieldMask] - # Indicates which fields in the provided - # {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} to update. The - # following are NOT supported: - # - # * {::Google::Cloud::Retail::V2::CatalogAttribute#key CatalogAttribute.key} - # - # If not set, all supported fields are updated. - class ReplaceCatalogAttributeRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/common.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/common.rb deleted file mode 100644 index d73fe6763594..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/common.rb +++ /dev/null @@ -1,1085 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Cloud - module Retail - module V2 - # Metadata that is used to define a condition that triggers an action. - # A valid condition must specify at least one of 'query_terms' or - # 'products_filter'. If multiple fields are specified, the condition is met if - # all the fields are satisfied e.g. if a set of query terms and product_filter - # are set, then only items matching the product_filter for requests with a - # query matching the query terms wil get boosted. - # @!attribute [rw] query_terms - # @return [::Array<::Google::Cloud::Retail::V2::Condition::QueryTerm>] - # A list (up to 10 entries) of terms to match the query on. If not - # specified, match all queries. - # If many query terms are specified, the condition - # is matched if any of the terms is a match (i.e. using the OR operator). - # @!attribute [rw] active_time_range - # @return [::Array<::Google::Cloud::Retail::V2::Condition::TimeRange>] - # Range of time(s) specifying when Condition is active. - # Condition true if any time range matches. - # @!attribute [rw] page_categories - # @return [::Array<::String>] - # Used to support browse uses cases. - # A list (up to 10 entries) of categories or departments. - # The format should be the same as - # {::Google::Cloud::Retail::V2::UserEvent#page_categories UserEvent.page_categories}; - class Condition - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # Query terms that we want to match on. - # @!attribute [rw] value - # @return [::String] - # The value of the term to match on. - # Value cannot be empty. - # Value can have at most 3 terms if specified as a partial match. Each - # space separated string is considered as one term. - # For example, "a b c" is 3 terms and allowed, but " a b c d" is 4 terms - # and not allowed for a partial match. - # @!attribute [rw] full_match - # @return [::Boolean] - # Whether this is supposed to be a full or partial match. - class QueryTerm - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Used for time-dependent conditions. - # Example: Want to have rule applied for week long sale. - # @!attribute [rw] start_time - # @return [::Google::Protobuf::Timestamp] - # Start of time range. Range is inclusive. - # @!attribute [rw] end_time - # @return [::Google::Protobuf::Timestamp] - # End of time range. Range is inclusive. - class TimeRange - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - - # A rule is a condition-action pair - # - # * A condition defines when a rule is to be triggered. - # * An action specifies what occurs on that trigger. - # Currently rules only work for {::Google::Cloud::Retail::V2::Control controls} with - # {::Google::Cloud::Retail::V2::SolutionType::SOLUTION_TYPE_SEARCH SOLUTION_TYPE_SEARCH}. - # @!attribute [rw] boost_action - # @return [::Google::Cloud::Retail::V2::Rule::BoostAction] - # A boost action. - # - # Note: The following fields are mutually exclusive: `boost_action`, `redirect_action`, `oneway_synonyms_action`, `do_not_associate_action`, `replacement_action`, `ignore_action`, `filter_action`, `twoway_synonyms_action`, `force_return_facet_action`, `remove_facet_action`, `pin_action`. If a field in that set is populated, all other fields in the set will automatically be cleared. - # @!attribute [rw] redirect_action - # @return [::Google::Cloud::Retail::V2::Rule::RedirectAction] - # Redirects a shopper to a specific page. - # - # Note: The following fields are mutually exclusive: `redirect_action`, `boost_action`, `oneway_synonyms_action`, `do_not_associate_action`, `replacement_action`, `ignore_action`, `filter_action`, `twoway_synonyms_action`, `force_return_facet_action`, `remove_facet_action`, `pin_action`. If a field in that set is populated, all other fields in the set will automatically be cleared. - # @!attribute [rw] oneway_synonyms_action - # @return [::Google::Cloud::Retail::V2::Rule::OnewaySynonymsAction] - # Treats specific term as a synonym with a group of terms. - # Group of terms will not be treated as synonyms with the specific term. - # - # Note: The following fields are mutually exclusive: `oneway_synonyms_action`, `boost_action`, `redirect_action`, `do_not_associate_action`, `replacement_action`, `ignore_action`, `filter_action`, `twoway_synonyms_action`, `force_return_facet_action`, `remove_facet_action`, `pin_action`. If a field in that set is populated, all other fields in the set will automatically be cleared. - # @!attribute [rw] do_not_associate_action - # @return [::Google::Cloud::Retail::V2::Rule::DoNotAssociateAction] - # Prevents term from being associated with other terms. - # - # Note: The following fields are mutually exclusive: `do_not_associate_action`, `boost_action`, `redirect_action`, `oneway_synonyms_action`, `replacement_action`, `ignore_action`, `filter_action`, `twoway_synonyms_action`, `force_return_facet_action`, `remove_facet_action`, `pin_action`. If a field in that set is populated, all other fields in the set will automatically be cleared. - # @!attribute [rw] replacement_action - # @return [::Google::Cloud::Retail::V2::Rule::ReplacementAction] - # Replaces specific terms in the query. - # - # Note: The following fields are mutually exclusive: `replacement_action`, `boost_action`, `redirect_action`, `oneway_synonyms_action`, `do_not_associate_action`, `ignore_action`, `filter_action`, `twoway_synonyms_action`, `force_return_facet_action`, `remove_facet_action`, `pin_action`. If a field in that set is populated, all other fields in the set will automatically be cleared. - # @!attribute [rw] ignore_action - # @return [::Google::Cloud::Retail::V2::Rule::IgnoreAction] - # Ignores specific terms from query during search. - # - # Note: The following fields are mutually exclusive: `ignore_action`, `boost_action`, `redirect_action`, `oneway_synonyms_action`, `do_not_associate_action`, `replacement_action`, `filter_action`, `twoway_synonyms_action`, `force_return_facet_action`, `remove_facet_action`, `pin_action`. If a field in that set is populated, all other fields in the set will automatically be cleared. - # @!attribute [rw] filter_action - # @return [::Google::Cloud::Retail::V2::Rule::FilterAction] - # Filters results. - # - # Note: The following fields are mutually exclusive: `filter_action`, `boost_action`, `redirect_action`, `oneway_synonyms_action`, `do_not_associate_action`, `replacement_action`, `ignore_action`, `twoway_synonyms_action`, `force_return_facet_action`, `remove_facet_action`, `pin_action`. If a field in that set is populated, all other fields in the set will automatically be cleared. - # @!attribute [rw] twoway_synonyms_action - # @return [::Google::Cloud::Retail::V2::Rule::TwowaySynonymsAction] - # Treats a set of terms as synonyms of one another. - # - # Note: The following fields are mutually exclusive: `twoway_synonyms_action`, `boost_action`, `redirect_action`, `oneway_synonyms_action`, `do_not_associate_action`, `replacement_action`, `ignore_action`, `filter_action`, `force_return_facet_action`, `remove_facet_action`, `pin_action`. If a field in that set is populated, all other fields in the set will automatically be cleared. - # @!attribute [rw] force_return_facet_action - # @return [::Google::Cloud::Retail::V2::Rule::ForceReturnFacetAction] - # Force returns an attribute as a facet in the request. - # - # Note: The following fields are mutually exclusive: `force_return_facet_action`, `boost_action`, `redirect_action`, `oneway_synonyms_action`, `do_not_associate_action`, `replacement_action`, `ignore_action`, `filter_action`, `twoway_synonyms_action`, `remove_facet_action`, `pin_action`. If a field in that set is populated, all other fields in the set will automatically be cleared. - # @!attribute [rw] remove_facet_action - # @return [::Google::Cloud::Retail::V2::Rule::RemoveFacetAction] - # Remove an attribute as a facet in the request (if present). - # - # Note: The following fields are mutually exclusive: `remove_facet_action`, `boost_action`, `redirect_action`, `oneway_synonyms_action`, `do_not_associate_action`, `replacement_action`, `ignore_action`, `filter_action`, `twoway_synonyms_action`, `force_return_facet_action`, `pin_action`. If a field in that set is populated, all other fields in the set will automatically be cleared. - # @!attribute [rw] pin_action - # @return [::Google::Cloud::Retail::V2::Rule::PinAction] - # Pins one or more specified products to a specific position in the - # results. - # - # Note: The following fields are mutually exclusive: `pin_action`, `boost_action`, `redirect_action`, `oneway_synonyms_action`, `do_not_associate_action`, `replacement_action`, `ignore_action`, `filter_action`, `twoway_synonyms_action`, `force_return_facet_action`, `remove_facet_action`. If a field in that set is populated, all other fields in the set will automatically be cleared. - # @!attribute [rw] condition - # @return [::Google::Cloud::Retail::V2::Condition] - # Required. The condition that triggers the rule. - # If the condition is empty, the rule will always apply. - class Rule - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # A boost action to apply to results matching condition specified above. - # @!attribute [rw] boost - # @return [::Float] - # Strength of the condition boost, which must be in [-1, 1]. Negative - # boost means demotion. Default is 0.0. - # - # Setting to 1.0 gives the item a big promotion. However, it does not - # necessarily mean that the boosted item will be the top result at all - # times, nor that other items will be excluded. Results could still be - # shown even when none of them matches the condition. And results that - # are significantly more relevant to the search query can still trump - # your heavily favored but irrelevant items. - # - # Setting to -1.0 gives the item a big demotion. However, results that - # are deeply relevant might still be shown. The item will have an - # upstream battle to get a fairly high ranking, but it is not blocked out - # completely. - # - # Setting to 0.0 means no boost applied. The boosting condition is - # ignored. - # @!attribute [rw] products_filter - # @return [::String] - # The filter can have a max size of 5000 characters. - # An expression which specifies which products to apply an action to. - # The syntax and supported fields are the same as a filter expression. See - # {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter} for - # detail syntax and limitations. - # - # Examples: - # - # * To boost products with product ID "product_1" or "product_2", and - # color - # "Red" or "Blue":
- # *(id: ANY("product_1", "product_2"))
* - # *AND
* - # *(colorFamilies: ANY("Red", "Blue"))
* - class BoostAction - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # * Rule Condition: - # - No - # {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms} - # provided is a global match. - # - 1 or more - # {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms} - # provided are combined with OR operator. - # - # * Action Input: The request query and filter that are applied to the - # retrieved products, in addition to any filters already provided with the - # SearchRequest. The AND operator is used to combine the query's existing - # filters with the filter rule(s). NOTE: May result in 0 results when - # filters conflict. - # - # * Action Result: Filters the returned objects to be ONLY those that passed - # the filter. - # @!attribute [rw] filter - # @return [::String] - # A filter to apply on the matching condition results. Supported features: - # - # * {::Google::Cloud::Retail::V2::Rule::FilterAction#filter filter} must be set. - # * Filter syntax is identical to - # {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}. For - # more - # information, see [Filter](/retail/docs/filter-and-order#filter). - # * To filter products with product ID "product_1" or "product_2", and - # color - # "Red" or "Blue":
- # *(id: ANY("product_1", "product_2"))
* - # *AND
* - # *(colorFamilies: ANY("Red", "Blue"))
* - class FilterAction - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Redirects a shopper to a specific page. - # - # * Rule Condition: - # Must specify - # {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms}. - # * Action Input: Request Query - # * Action Result: Redirects shopper to provided uri. - # @!attribute [rw] redirect_uri - # @return [::String] - # URL must have length equal or less than 2000 characters. - class RedirectAction - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Creates a set of terms that will be treated as synonyms of each other. - # Example: synonyms of "sneakers" and "shoes": - # - # * "sneakers" will use a synonym of "shoes". - # * "shoes" will use a synonym of "sneakers". - # @!attribute [rw] synonyms - # @return [::Array<::String>] - # Defines a set of synonyms. - # Can specify up to 100 synonyms. - # Must specify at least 2 synonyms. - class TwowaySynonymsAction - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Maps a set of terms to a set of synonyms. - # Set of synonyms will be treated as synonyms of each query term only. - # `query_terms` will not be treated as synonyms of each other. - # Example: "sneakers" will use a synonym of "shoes". - # "shoes" will not use a synonym of "sneakers". - # @!attribute [rw] query_terms - # @return [::Array<::String>] - # Terms from the search query. - # Will treat synonyms as their synonyms. - # Not themselves synonyms of the synonyms. - # Can specify up to 100 terms. - # @!attribute [rw] synonyms - # @return [::Array<::String>] - # Defines a set of synonyms. - # Cannot contain duplicates. - # Can specify up to 100 synonyms. - # @!attribute [rw] oneway_terms - # @return [::Array<::String>] - # Will be [deprecated = true] post migration; - class OnewaySynonymsAction - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Prevents `query_term` from being associated with specified terms during - # search. - # Example: Don't associate "gShoe" and "cheap". - # @!attribute [rw] query_terms - # @return [::Array<::String>] - # Terms from the search query. - # Will not consider do_not_associate_terms for search if in search query. - # Can specify up to 100 terms. - # @!attribute [rw] do_not_associate_terms - # @return [::Array<::String>] - # Cannot contain duplicates or the query term. - # Can specify up to 100 terms. - # @!attribute [rw] terms - # @return [::Array<::String>] - # Will be [deprecated = true] post migration; - class DoNotAssociateAction - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Replaces a term in the query. Multiple replacement candidates can be - # specified. All `query_terms` will be replaced with the replacement term. - # Example: Replace "gShoe" with "google shoe". - # @!attribute [rw] query_terms - # @return [::Array<::String>] - # Terms from the search query. - # Will be replaced by replacement term. - # Can specify up to 100 terms. - # @!attribute [rw] replacement_term - # @return [::String] - # Term that will be used for replacement. - # @!attribute [rw] term - # @return [::String] - # Will be [deprecated = true] post migration; - class ReplacementAction - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Prevents a term in the query from being used in search. - # Example: Don't search for "shoddy". - # @!attribute [rw] ignore_terms - # @return [::Array<::String>] - # Terms to ignore in the search query. - class IgnoreAction - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Force returns an attribute/facet in the request around a certain position - # or above. - # - # * Rule Condition: - # Must specify non-empty - # {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms} - # (for search only) or - # {::Google::Cloud::Retail::V2::Condition#page_categories Condition.page_categories} - # (for browse only), but can't specify both. - # - # * Action Inputs: attribute name, position - # - # * Action Result: Will force return a facet key around a certain position - # or above if the condition is satisfied. - # - # Example: Suppose the query is "shoes", the - # {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms} is - # "shoes", the - # {::Google::Cloud::Retail::V2::Rule::ForceReturnFacetAction::FacetPositionAdjustment#attribute_name ForceReturnFacetAction.FacetPositionAdjustment.attribute_name} - # is "size" and the - # {::Google::Cloud::Retail::V2::Rule::ForceReturnFacetAction::FacetPositionAdjustment#position ForceReturnFacetAction.FacetPositionAdjustment.position} - # is 8. - # - # Two cases: a) The facet key "size" is not already in the top 8 slots, then - # the facet "size" will appear at a position close to 8. b) The facet key - # "size" in among the top 8 positions in the request, then it will stay at - # its current rank. - # @!attribute [rw] facet_position_adjustments - # @return [::Array<::Google::Cloud::Retail::V2::Rule::ForceReturnFacetAction::FacetPositionAdjustment>] - # Each instance corresponds to a force return attribute for the given - # condition. There can't be more 15 instances here. - class ForceReturnFacetAction - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # Each facet position adjustment consists of a single attribute name (i.e. - # facet key) along with a specified position. - # @!attribute [rw] attribute_name - # @return [::String] - # The attribute name to force return as a facet. Each attribute name - # should be a valid attribute name, be non-empty and contain at most 80 - # characters long. - # @!attribute [rw] position - # @return [::Integer] - # This is the position in the request as explained above. It should be - # strictly positive be at most 100. - class FacetPositionAdjustment - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - - # Removes an attribute/facet in the request if is present. - # - # * Rule Condition: - # Must specify non-empty - # {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms} - # (for search only) or - # {::Google::Cloud::Retail::V2::Condition#page_categories Condition.page_categories} - # (for browse only), but can't specify both. - # - # * Action Input: attribute name - # - # * Action Result: Will remove the attribute (as a facet) from the request - # if it is present. - # - # Example: Suppose the query is "shoes", the - # {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms} is - # "shoes" and the attribute name "size", then facet key "size" will be - # removed from the request (if it is present). - # @!attribute [rw] attribute_names - # @return [::Array<::String>] - # The attribute names (i.e. facet keys) to remove from the dynamic facets - # (if present in the request). There can't be more 3 attribute names. - # Each attribute name should be a valid attribute name, be non-empty and - # contain at most 80 characters. - class RemoveFacetAction - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Pins one or more specified products to a specific position in the - # results. - # - # * Rule Condition: - # Must specify non-empty - # {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms} - # (for search only) or - # {::Google::Cloud::Retail::V2::Condition#page_categories Condition.page_categories} - # (for browse only), but can't specify both. - # - # * Action Input: mapping of `[pin_position, product_id]` pairs (pin position - # uses 1-based indexing). - # - # * Action Result: Will pin products with matching ids to the position - # specified in the final result order. - # - # Example: Suppose the query is `shoes`, the - # {::Google::Cloud::Retail::V2::Condition#query_terms Condition.query_terms} is - # `shoes` and the pin_map has `{1, "pid1"}`, then product with `pid1` will be - # pinned to the top position in the final results. - # - # If multiple PinActions are matched to a single request the actions will - # be processed from most to least recently updated. - # - # Pins to positions larger than the max allowed page size of 120 are not - # allowed. - # @!attribute [rw] pin_map - # @return [::Google::Protobuf::Map{::Integer => ::String}] - # Required. A map of positions to product_ids. - # - # Partial matches per action are allowed, if a certain position in the map - # is already filled that `[position, product_id]` pair will be ignored - # but the rest may still be applied. This case will only occur if multiple - # pin actions are matched to a single request, as the map guarantees that - # pin positions are unique within the same action. - # - # Duplicate product_ids are not permitted within a single pin map. - # - # The max size of this map is 120, equivalent to the max [request page - # size](https://cloud.google.com/retail/docs/reference/rest/v2/projects.locations.catalogs.placements/search#request-body). - class PinAction - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # @!attribute [rw] key - # @return [::Integer] - # @!attribute [rw] value - # @return [::String] - class PinMapEntry - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - end - - # An intended audience of the {::Google::Cloud::Retail::V2::Product Product} for - # whom it's sold. - # @!attribute [rw] genders - # @return [::Array<::String>] - # The genders of the audience. Strongly encouraged to use the standard - # values: "male", "female", "unisex". - # - # At most 5 values are allowed. Each value must be a UTF-8 encoded string - # with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error - # is returned. - # - # Google Merchant Center property - # [gender](https://support.google.com/merchants/answer/6324479). Schema.org - # property - # [Product.audience.suggestedGender](https://schema.org/suggestedGender). - # @!attribute [rw] age_groups - # @return [::Array<::String>] - # The age groups of the audience. Strongly encouraged to use the standard - # values: "newborn" (up to 3 months old), "infant" (3–12 months old), - # "toddler" (1–5 years old), "kids" (5–13 years old), "adult" (typically - # teens or older). - # - # At most 5 values are allowed. Each value must be a UTF-8 encoded string - # with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error - # is returned. - # - # Google Merchant Center property - # [age_group](https://support.google.com/merchants/answer/6324463). - # Schema.org property - # [Product.audience.suggestedMinAge](https://schema.org/suggestedMinAge) and - # [Product.audience.suggestedMaxAge](https://schema.org/suggestedMaxAge). - class Audience - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # The color information of a {::Google::Cloud::Retail::V2::Product Product}. - # @!attribute [rw] color_families - # @return [::Array<::String>] - # The standard color families. Strongly recommended to use the following - # standard color groups: "Red", "Pink", "Orange", "Yellow", "Purple", - # "Green", "Cyan", "Blue", "Brown", "White", "Gray", "Black" and "Mixed". - # Normally it is expected to have only 1 color family. May consider using - # single "Mixed" instead of multiple values. - # - # A maximum of 5 values are allowed. Each value must be a UTF-8 encoded - # string with a length limit of 128 characters. Otherwise, an - # INVALID_ARGUMENT error is returned. - # - # Google Merchant Center property - # [color](https://support.google.com/merchants/answer/6324487). Schema.org - # property [Product.color](https://schema.org/color). - # - # The colorFamilies field as a system attribute is not a required field but - # strongly recommended to be specified. Google Search models treat this field - # as more important than a custom product attribute when specified. - # @!attribute [rw] colors - # @return [::Array<::String>] - # The color display names, which may be different from standard color family - # names, such as the color aliases used in the website frontend. Normally - # it is expected to have only 1 color. May consider using single "Mixed" - # instead of multiple values. - # - # A maximum of 75 colors are allowed. Each value must be a UTF-8 encoded - # string with a length limit of 128 characters. Otherwise, an - # INVALID_ARGUMENT error is returned. - # - # Google Merchant Center property - # [color](https://support.google.com/merchants/answer/6324487). Schema.org - # property [Product.color](https://schema.org/color). - class ColorInfo - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # A custom attribute that is not explicitly modeled in - # {::Google::Cloud::Retail::V2::Product Product}. - # @!attribute [rw] text - # @return [::Array<::String>] - # The textual values of this custom attribute. For example, `["yellow", - # "green"]` when the key is "color". - # - # Empty string is not allowed. Otherwise, an INVALID_ARGUMENT error is - # returned. - # - # Exactly one of {::Google::Cloud::Retail::V2::CustomAttribute#text text} or - # {::Google::Cloud::Retail::V2::CustomAttribute#numbers numbers} should be set. - # Otherwise, an INVALID_ARGUMENT error is returned. - # @!attribute [rw] numbers - # @return [::Array<::Float>] - # The numerical values of this custom attribute. For example, `[2.3, 15.4]` - # when the key is "lengths_cm". - # - # Exactly one of {::Google::Cloud::Retail::V2::CustomAttribute#text text} or - # {::Google::Cloud::Retail::V2::CustomAttribute#numbers numbers} should be set. - # Otherwise, an INVALID_ARGUMENT error is returned. - # @!attribute [rw] searchable - # @deprecated This field is deprecated and may be removed in the next major version update. - # @return [::Boolean] - # This field is normally ignored unless - # {::Google::Cloud::Retail::V2::AttributesConfig#attribute_config_level AttributesConfig.attribute_config_level} - # of the {::Google::Cloud::Retail::V2::Catalog Catalog} is set to the deprecated - # 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG' mode. For information about product-level - # attribute configuration, see [Configuration - # modes](https://cloud.google.com/retail/docs/attribute-config#config-modes). - # If true, custom attribute values are searchable by text queries in - # {::Google::Cloud::Retail::V2::SearchService::Client#search SearchService.Search}. - # - # This field is ignored in a {::Google::Cloud::Retail::V2::UserEvent UserEvent}. - # - # Only set if type {::Google::Cloud::Retail::V2::CustomAttribute#text text} is - # set. Otherwise, a INVALID_ARGUMENT error is returned. - # @!attribute [rw] indexable - # @deprecated This field is deprecated and may be removed in the next major version update. - # @return [::Boolean] - # This field is normally ignored unless - # {::Google::Cloud::Retail::V2::AttributesConfig#attribute_config_level AttributesConfig.attribute_config_level} - # of the {::Google::Cloud::Retail::V2::Catalog Catalog} is set to the deprecated - # 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG' mode. For information about product-level - # attribute configuration, see [Configuration - # modes](https://cloud.google.com/retail/docs/attribute-config#config-modes). - # If true, custom attribute values are indexed, so that they can be filtered, - # faceted or boosted in - # {::Google::Cloud::Retail::V2::SearchService::Client#search SearchService.Search}. - # - # This field is ignored in a {::Google::Cloud::Retail::V2::UserEvent UserEvent}. - # - # See {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}, - # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs} - # and - # {::Google::Cloud::Retail::V2::SearchRequest#boost_spec SearchRequest.boost_spec} - # for more details. - class CustomAttribute - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Fulfillment information, such as the store IDs for in-store pickup or region - # IDs for different shipping methods. - # @!attribute [rw] type - # @return [::String] - # The fulfillment type, including commonly used types (such as pickup in - # store and same day delivery), and custom types. Customers have to map - # custom types to their display names before rendering UI. - # - # Supported values: - # - # * "pickup-in-store" - # * "ship-to-store" - # * "same-day-delivery" - # * "next-day-delivery" - # * "custom-type-1" - # * "custom-type-2" - # * "custom-type-3" - # * "custom-type-4" - # * "custom-type-5" - # - # If this field is set to an invalid value other than these, an - # INVALID_ARGUMENT error is returned. - # @!attribute [rw] place_ids - # @return [::Array<::String>] - # The IDs for this {::Google::Cloud::Retail::V2::FulfillmentInfo#type type}, such - # as the store IDs for - # {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type.pickup-in-store} - # or the region IDs for - # {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type.same-day-delivery}. - # - # A maximum of 3000 values are allowed. Each value must be a string with a - # length limit of 30 characters, matching the pattern `[a-zA-Z0-9_-]+`, such - # as "store1" or "REGION-2". Otherwise, an INVALID_ARGUMENT error is - # returned. - class FulfillmentInfo - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # {::Google::Cloud::Retail::V2::Product Product} image. Recommendations AI and - # Retail Search use product images to improve prediction and search results. - # Product images can be returned in results, and are shown in prediction or - # search previews in the console. Please try to provide correct product images - # and avoid using images with size too small. - # @!attribute [rw] uri - # @return [::String] - # Required. URI of the image. - # - # This field must be a valid UTF-8 encoded URI with a length limit of 5,000 - # characters. Otherwise, an INVALID_ARGUMENT error is returned. - # - # Google Merchant Center property - # [image_link](https://support.google.com/merchants/answer/6324350). - # Schema.org property [Product.image](https://schema.org/image). - # @!attribute [rw] height - # @return [::Integer] - # Height of the image in number of pixels. - # - # This field must be nonnegative. Otherwise, an INVALID_ARGUMENT error is - # returned. - # @!attribute [rw] width - # @return [::Integer] - # Width of the image in number of pixels. - # - # This field must be nonnegative. Otherwise, an INVALID_ARGUMENT error is - # returned. - class Image - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # A floating point interval. - # @!attribute [rw] minimum - # @return [::Float] - # Inclusive lower bound. - # - # Note: The following fields are mutually exclusive: `minimum`, `exclusive_minimum`. If a field in that set is populated, all other fields in the set will automatically be cleared. - # @!attribute [rw] exclusive_minimum - # @return [::Float] - # Exclusive lower bound. - # - # Note: The following fields are mutually exclusive: `exclusive_minimum`, `minimum`. If a field in that set is populated, all other fields in the set will automatically be cleared. - # @!attribute [rw] maximum - # @return [::Float] - # Inclusive upper bound. - # - # Note: The following fields are mutually exclusive: `maximum`, `exclusive_maximum`. If a field in that set is populated, all other fields in the set will automatically be cleared. - # @!attribute [rw] exclusive_maximum - # @return [::Float] - # Exclusive upper bound. - # - # Note: The following fields are mutually exclusive: `exclusive_maximum`, `maximum`. If a field in that set is populated, all other fields in the set will automatically be cleared. - class Interval - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # The price information of a {::Google::Cloud::Retail::V2::Product Product}. - # @!attribute [rw] currency_code - # @return [::String] - # The 3-letter currency code defined in [ISO - # 4217](https://www.iso.org/iso-4217-currency-codes.html). - # - # If this field is an unrecognizable currency code, an INVALID_ARGUMENT - # error is returned. - # - # The {::Google::Cloud::Retail::V2::Product::Type::VARIANT Product.Type.VARIANT} - # {::Google::Cloud::Retail::V2::Product Product}s with the same - # {::Google::Cloud::Retail::V2::Product#primary_product_id Product.primary_product_id} - # must share the same - # {::Google::Cloud::Retail::V2::PriceInfo#currency_code currency_code}. Otherwise, - # a FAILED_PRECONDITION error is returned. - # @!attribute [rw] price - # @return [::Float] - # Price of the product. - # - # Google Merchant Center property - # [price](https://support.google.com/merchants/answer/6324371). Schema.org - # property [Offer.price](https://schema.org/price). - # @!attribute [rw] original_price - # @return [::Float] - # Price of the product without any discount. If zero, by default set to be - # the {::Google::Cloud::Retail::V2::PriceInfo#price price}. If set, - # {::Google::Cloud::Retail::V2::PriceInfo#original_price original_price} should be - # greater than or equal to {::Google::Cloud::Retail::V2::PriceInfo#price price}, - # otherwise an INVALID_ARGUMENT error is thrown. - # @!attribute [rw] cost - # @return [::Float] - # The costs associated with the sale of a particular product. Used for gross - # profit reporting. - # - # * Profit = {::Google::Cloud::Retail::V2::PriceInfo#price price} - - # {::Google::Cloud::Retail::V2::PriceInfo#cost cost} - # - # Google Merchant Center property - # [cost_of_goods_sold](https://support.google.com/merchants/answer/9017895). - # @!attribute [rw] price_effective_time - # @return [::Google::Protobuf::Timestamp] - # The timestamp when the {::Google::Cloud::Retail::V2::PriceInfo#price price} - # starts to be effective. This can be set as a future timestamp, and the - # {::Google::Cloud::Retail::V2::PriceInfo#price price} is only used for search - # after - # {::Google::Cloud::Retail::V2::PriceInfo#price_effective_time price_effective_time}. - # If so, the - # {::Google::Cloud::Retail::V2::PriceInfo#original_price original_price} must be - # set and {::Google::Cloud::Retail::V2::PriceInfo#original_price original_price} - # is used before - # {::Google::Cloud::Retail::V2::PriceInfo#price_effective_time price_effective_time}. - # - # Do not set if {::Google::Cloud::Retail::V2::PriceInfo#price price} is always - # effective because it will cause additional latency during search. - # @!attribute [rw] price_expire_time - # @return [::Google::Protobuf::Timestamp] - # The timestamp when the {::Google::Cloud::Retail::V2::PriceInfo#price price} - # stops to be effective. The {::Google::Cloud::Retail::V2::PriceInfo#price price} - # is used for search before - # {::Google::Cloud::Retail::V2::PriceInfo#price_expire_time price_expire_time}. If - # this field is set, the - # {::Google::Cloud::Retail::V2::PriceInfo#original_price original_price} must be - # set and {::Google::Cloud::Retail::V2::PriceInfo#original_price original_price} - # is used after - # {::Google::Cloud::Retail::V2::PriceInfo#price_expire_time price_expire_time}. - # - # Do not set if {::Google::Cloud::Retail::V2::PriceInfo#price price} is always - # effective because it will cause additional latency during search. - # @!attribute [r] price_range - # @return [::Google::Cloud::Retail::V2::PriceInfo::PriceRange] - # Output only. The price range of all the child - # {::Google::Cloud::Retail::V2::Product::Type::VARIANT Product.Type.VARIANT} - # {::Google::Cloud::Retail::V2::Product Product}s grouped together on the - # {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Product.Type.PRIMARY} - # {::Google::Cloud::Retail::V2::Product Product}. Only populated for - # {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Product.Type.PRIMARY} - # {::Google::Cloud::Retail::V2::Product Product}s. - # - # Note: This field is OUTPUT_ONLY for - # {::Google::Cloud::Retail::V2::ProductService::Client#get_product ProductService.GetProduct}. - # Do not set this field in API requests. - class PriceInfo - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # The price range of all - # {::Google::Cloud::Retail::V2::Product::Type::VARIANT variant} - # {::Google::Cloud::Retail::V2::Product Product} having the same - # {::Google::Cloud::Retail::V2::Product#primary_product_id Product.primary_product_id}. - # @!attribute [rw] price - # @return [::Google::Cloud::Retail::V2::Interval] - # The inclusive - # {::Google::Cloud::Retail::V2::PriceInfo#price Product.pricing_info.price} - # interval of all {::Google::Cloud::Retail::V2::Product::Type::VARIANT variant} - # {::Google::Cloud::Retail::V2::Product Product} having the same - # {::Google::Cloud::Retail::V2::Product#primary_product_id Product.primary_product_id}. - # @!attribute [rw] original_price - # @return [::Google::Cloud::Retail::V2::Interval] - # The inclusive - # {::Google::Cloud::Retail::V2::PriceInfo#original_price Product.pricing_info.original_price} - # internal of all {::Google::Cloud::Retail::V2::Product::Type::VARIANT variant} - # {::Google::Cloud::Retail::V2::Product Product} having the same - # {::Google::Cloud::Retail::V2::Product#primary_product_id Product.primary_product_id}. - class PriceRange - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - - # The rating of a {::Google::Cloud::Retail::V2::Product Product}. - # @!attribute [rw] rating_count - # @return [::Integer] - # The total number of ratings. This value is independent of the value of - # {::Google::Cloud::Retail::V2::Rating#rating_histogram rating_histogram}. - # - # This value must be nonnegative. Otherwise, an INVALID_ARGUMENT error is - # returned. - # @!attribute [rw] average_rating - # @return [::Float] - # The average rating of the {::Google::Cloud::Retail::V2::Product Product}. - # - # The rating is scaled at 1-5. Otherwise, an INVALID_ARGUMENT error is - # returned. - # @!attribute [rw] rating_histogram - # @return [::Array<::Integer>] - # List of rating counts per rating value (index = rating - 1). The list is - # empty if there is no rating. If the list is non-empty, its size is - # always 5. Otherwise, an INVALID_ARGUMENT error is returned. - # - # For example, [41, 14, 13, 47, 303]. It means that the - # {::Google::Cloud::Retail::V2::Product Product} got 41 ratings with 1 star, 14 - # ratings with 2 star, and so on. - class Rating - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Information of an end user. - # @!attribute [rw] user_id - # @return [::String] - # Highly recommended for logged-in users. Unique identifier for logged-in - # user, such as a user name. Don't set for anonymous users. - # - # Always use a hashed value for this ID. - # - # Don't set the field to the same fixed ID for different users. This mixes - # the event history of those users together, which results in degraded - # model quality. - # - # The field must be a UTF-8 encoded string with a length limit of 128 - # characters. Otherwise, an INVALID_ARGUMENT error is returned. - # @!attribute [rw] ip_address - # @return [::String] - # The end user's IP address. This field is used to extract location - # information for personalization. - # - # This field must be either an IPv4 address (e.g. "104.133.9.80") or an IPv6 - # address (e.g. "2001:0db8:85a3:0000:0000:8a2e:0370:7334"). Otherwise, an - # INVALID_ARGUMENT error is returned. - # - # This should not be set when: - # - # * setting - # {::Google::Cloud::Retail::V2::SearchRequest#user_info SearchRequest.user_info}. - # * using the JavaScript tag in - # {::Google::Cloud::Retail::V2::UserEventService::Client#collect_user_event UserEventService.CollectUserEvent} - # or if - # {::Google::Cloud::Retail::V2::UserInfo#direct_user_request direct_user_request} - # is set. - # @!attribute [rw] user_agent - # @return [::String] - # User agent as included in the HTTP header. - # The field must be a UTF-8 encoded string with a length limit of 1,000 - # characters. Otherwise, an INVALID_ARGUMENT error is returned. - # - # This should not be set when using the client side event reporting with - # GTM or JavaScript tag in - # {::Google::Cloud::Retail::V2::UserEventService::Client#collect_user_event UserEventService.CollectUserEvent} - # or if - # {::Google::Cloud::Retail::V2::UserInfo#direct_user_request direct_user_request} - # is set. - # @!attribute [rw] direct_user_request - # @return [::Boolean] - # True if the request is made directly from the end user, in which case the - # {::Google::Cloud::Retail::V2::UserInfo#ip_address ip_address} and - # {::Google::Cloud::Retail::V2::UserInfo#user_agent user_agent} can be populated - # from the HTTP request. This flag should be set only if the API request is - # made directly from the end user such as a mobile app (and not if a gateway - # or a server is processing and pushing the user events). - # - # This should not be set when using the JavaScript tag in - # {::Google::Cloud::Retail::V2::UserEventService::Client#collect_user_event UserEventService.CollectUserEvent}. - class UserInfo - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # The inventory information at a place (e.g. a store) identified - # by a place ID. - # @!attribute [rw] place_id - # @return [::String] - # Optional. The place ID for the current set of inventory information. - # @!attribute [rw] price_info - # @return [::Google::Cloud::Retail::V2::PriceInfo] - # Optional. Product price and cost information. - # - # Google Merchant Center property - # [price](https://support.google.com/merchants/answer/6324371). - # @!attribute [rw] attributes - # @return [::Google::Protobuf::Map{::String => ::Google::Cloud::Retail::V2::CustomAttribute}] - # Optional. Additional local inventory attributes, for example, store name, - # promotion tags, etc. - # - # This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT - # error is returned: - # - # * At most 30 attributes are allowed. - # * The key must be a UTF-8 encoded string with a length limit of 32 - # characters. - # * The key must match the pattern: `[a-zA-Z0-9][a-zA-Z0-9_]*`. For example, - # key0LikeThis or KEY_1_LIKE_THIS. - # * The attribute values must be of the same type (text or number). - # * Only 1 value is allowed for each attribute. - # * For text values, the length limit is 256 UTF-8 characters. - # * The attribute does not support search. The `searchable` field should be - # unset or set to false. - # * The max summed total bytes of custom attribute keys and values per - # product is 5MiB. - # @!attribute [rw] fulfillment_types - # @return [::Array<::String>] - # Optional. Supported fulfillment types. Valid fulfillment type values - # include commonly used types (such as pickup in store and same day - # delivery), and custom types. Customers have to map custom types to their - # display names before rendering UI. - # - # Supported values: - # - # * "pickup-in-store" - # * "ship-to-store" - # * "same-day-delivery" - # * "next-day-delivery" - # * "custom-type-1" - # * "custom-type-2" - # * "custom-type-3" - # * "custom-type-4" - # * "custom-type-5" - # - # If this field is set to an invalid value other than these, an - # INVALID_ARGUMENT error is returned. - # - # All the elements must be distinct. Otherwise, an INVALID_ARGUMENT error is - # returned. - class LocalInventory - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # @!attribute [rw] key - # @return [::String] - # @!attribute [rw] value - # @return [::Google::Cloud::Retail::V2::CustomAttribute] - class AttributesEntry - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - - # Metadata for pinning to be returned in the response. - # This is used for distinguishing between applied vs dropped pins. - # @!attribute [rw] all_matched_pins - # @return [::Google::Protobuf::Map{::Integer => ::Google::Cloud::Retail::V2::PinControlMetadata::ProductPins}] - # Map of all matched pins, keyed by pin position. - # @!attribute [rw] dropped_pins - # @return [::Google::Protobuf::Map{::Integer => ::Google::Cloud::Retail::V2::PinControlMetadata::ProductPins}] - # Map of pins that were dropped due to overlap with other matching pins, - # keyed by pin position. - class PinControlMetadata - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # List of product ids which have associated pins. - # @!attribute [rw] product_id - # @return [::Array<::String>] - # List of product ids which have associated pins. - class ProductPins - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # @!attribute [rw] key - # @return [::Integer] - # @!attribute [rw] value - # @return [::Google::Cloud::Retail::V2::PinControlMetadata::ProductPins] - class AllMatchedPinsEntry - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # @!attribute [rw] key - # @return [::Integer] - # @!attribute [rw] value - # @return [::Google::Cloud::Retail::V2::PinControlMetadata::ProductPins] - class DroppedPinsEntry - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - - # A list of string values. - # @!attribute [rw] values - # @return [::Array<::String>] - # String values. - class StringList - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # A message with a list of double values. - # @!attribute [rw] values - # @return [::Array<::Float>] - # The list of double values. - class DoubleList - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # At which level we offer configuration for attributes. - module AttributeConfigLevel - # Value used when unset. In this case, server behavior defaults to - # {::Google::Cloud::Retail::V2::AttributeConfigLevel::CATALOG_LEVEL_ATTRIBUTE_CONFIG CATALOG_LEVEL_ATTRIBUTE_CONFIG}. - ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED = 0 - - # At this level, we honor the attribute configurations set in - # {::Google::Cloud::Retail::V2::Product#attributes Product.attributes}. - PRODUCT_LEVEL_ATTRIBUTE_CONFIG = 1 - - # At this level, we honor the attribute configurations set in - # `CatalogConfig.attribute_configs`. - CATALOG_LEVEL_ATTRIBUTE_CONFIG = 2 - end - - # The type of solution. - module SolutionType - # Default value. - SOLUTION_TYPE_UNSPECIFIED = 0 - - # Used for Recommendations AI. - SOLUTION_TYPE_RECOMMENDATION = 1 - - # Used for Retail Search. - SOLUTION_TYPE_SEARCH = 2 - end - - # If filtering for recommendations is enabled. - module RecommendationsFilteringOption - # Value used when unset. - # In this case, server behavior defaults to - # {::Google::Cloud::Retail::V2::RecommendationsFilteringOption::RECOMMENDATIONS_FILTERING_DISABLED RECOMMENDATIONS_FILTERING_DISABLED}. - RECOMMENDATIONS_FILTERING_OPTION_UNSPECIFIED = 0 - - # Recommendation filtering is disabled. - RECOMMENDATIONS_FILTERING_DISABLED = 1 - - # Recommendation filtering is enabled. - RECOMMENDATIONS_FILTERING_ENABLED = 3 - end - - # The use case of Cloud Retail Search. - module SearchSolutionUseCase - # The value when it's unspecified. In this case, server behavior defaults to - # {::Google::Cloud::Retail::V2::SearchSolutionUseCase::SEARCH_SOLUTION_USE_CASE_SEARCH SEARCH_SOLUTION_USE_CASE_SEARCH}. - SEARCH_SOLUTION_USE_CASE_UNSPECIFIED = 0 - - # Search use case. Expects the traffic has a non-empty - # {::Google::Cloud::Retail::V2::SearchRequest#query query}. - SEARCH_SOLUTION_USE_CASE_SEARCH = 1 - - # Browse use case. Expects the traffic has an empty - # {::Google::Cloud::Retail::V2::SearchRequest#query query}. - SEARCH_SOLUTION_USE_CASE_BROWSE = 2 - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/completion_service.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/completion_service.rb deleted file mode 100644 index b0608b79614d..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/completion_service.rb +++ /dev/null @@ -1,230 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Cloud - module Retail - module V2 - # Autocomplete parameters. - # @!attribute [rw] catalog - # @return [::String] - # Required. Catalog for which the completion is performed. - # - # Full resource name of catalog, such as - # `projects/*/locations/global/catalogs/default_catalog`. - # @!attribute [rw] query - # @return [::String] - # Required. The query used to generate suggestions. - # - # The maximum number of allowed characters is 255. - # @!attribute [rw] visitor_id - # @return [::String] - # Recommended field. A unique identifier for tracking visitors. For example, - # this could be implemented with an HTTP cookie, which should be able to - # uniquely identify a visitor on a single device. This unique identifier - # should not change if the visitor logs in or out of the website. - # - # The field must be a UTF-8 encoded string with a length limit of 128 - # characters. Otherwise, an INVALID_ARGUMENT error is returned. - # @!attribute [rw] language_codes - # @return [::Array<::String>] - # Note that this field applies for `user-data` dataset only. For requests - # with `cloud-retail` dataset, setting this field has no effect. - # - # The language filters applied to the output suggestions. If set, it should - # contain the language of the query. If not set, suggestions are returned - # without considering language restrictions. This is the BCP-47 language - # code, such as "en-US" or "sr-Latn". For more information, see [Tags for - # Identifying Languages](https://tools.ietf.org/html/bcp47). The maximum - # number of language codes is 3. - # @!attribute [rw] device_type - # @return [::String] - # The device type context for completion suggestions. We recommend that you - # leave this field empty. - # - # It can apply different suggestions on different device types, e.g. - # `DESKTOP`, `MOBILE`. If it is empty, the suggestions are across all device - # types. - # - # Supported formats: - # - # * `UNKNOWN_DEVICE_TYPE` - # - # * `DESKTOP` - # - # * `MOBILE` - # - # * A customized string starts with `OTHER_`, e.g. `OTHER_IPHONE`. - # @!attribute [rw] dataset - # @return [::String] - # Determines which dataset to use for fetching completion. "user-data" will - # use the dataset imported through - # {::Google::Cloud::Retail::V2::CompletionService::Client#import_completion_data CompletionService.ImportCompletionData}. - # `cloud-retail` will use the dataset generated by Cloud Retail based on user - # events. If left empty, completions will be fetched from the `user-data` - # dataset. - # - # Current supported values: - # - # * user-data - # - # * cloud-retail: - # This option requires enabling auto-learning function first. See - # [guidelines](https://cloud.google.com/retail/docs/completion-overview#generated-completion-dataset). - # @!attribute [rw] max_suggestions - # @return [::Integer] - # Completion max suggestions. If left unset or set to 0, then will fallback - # to the configured value - # {::Google::Cloud::Retail::V2::CompletionConfig#max_suggestions CompletionConfig.max_suggestions}. - # - # The maximum allowed max suggestions is 20. If it is set higher, it will be - # capped by 20. - # @!attribute [rw] enable_attribute_suggestions - # @return [::Boolean] - # If true, attribute suggestions are enabled and provided in the response. - # - # This field is only available for the `cloud-retail` dataset. - # @!attribute [rw] entity - # @return [::String] - # The entity for customers who run multiple entities, domains, sites, or - # regions, for example, `Google US`, `Google Ads`, `Waymo`, - # `google.com`, `youtube.com`, etc. - # If this is set, it must be an exact match with - # {::Google::Cloud::Retail::V2::UserEvent#entity UserEvent.entity} to get - # per-entity autocomplete results. This field will be applied to - # `completion_results` only. It has no effect on the `attribute_results`. - # Also, this entity should be limited to 256 characters, if too long, it will - # be truncated to 256 characters in both generation and serving time, and may - # lead to mis-match. To ensure it works, please set the entity with string - # within 256 characters. - class CompleteQueryRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Response of the autocomplete query. - # @!attribute [rw] completion_results - # @return [::Array<::Google::Cloud::Retail::V2::CompleteQueryResponse::CompletionResult>] - # Results of the matching suggestions. The result list is ordered and the - # first result is top suggestion. - # @!attribute [rw] attribution_token - # @return [::String] - # A unique complete token. This should be included in the - # {::Google::Cloud::Retail::V2::UserEvent#completion_detail UserEvent.completion_detail} - # for search events resulting from this completion, which enables accurate - # attribution of complete model performance. - # @!attribute [rw] recent_search_results - # @deprecated This field is deprecated and may be removed in the next major version update. - # @return [::Array<::Google::Cloud::Retail::V2::CompleteQueryResponse::RecentSearchResult>] - # Deprecated. Matched recent searches of this user. The maximum number of - # recent searches is 10. This field is a restricted feature. If you want to - # enable it, contact Retail Search support. - # - # This feature is only available when - # {::Google::Cloud::Retail::V2::CompleteQueryRequest#visitor_id CompleteQueryRequest.visitor_id} - # field is set and {::Google::Cloud::Retail::V2::UserEvent UserEvent} is imported. - # The recent searches satisfy the follow rules: - # - # * They are ordered from latest to oldest. - # - # * They are matched with - # {::Google::Cloud::Retail::V2::CompleteQueryRequest#query CompleteQueryRequest.query} - # case insensitively. - # - # * They are transformed to lower case. - # - # * They are UTF-8 safe. - # - # Recent searches are deduplicated. More recent searches will be reserved - # when duplication happens. - # @!attribute [rw] attribute_results - # @return [::Google::Protobuf::Map{::String => ::Google::Cloud::Retail::V2::CompleteQueryResponse::AttributeResult}] - # A map of matched attribute suggestions. This field is only available for - # `cloud-retail` dataset. - # - # Current supported keys: - # - # * `brands` - # - # * `categories` - class CompleteQueryResponse - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # Resource that represents completion results. - # @!attribute [rw] suggestion - # @return [::String] - # The suggestion for the query. - # @!attribute [rw] attributes - # @return [::Google::Protobuf::Map{::String => ::Google::Cloud::Retail::V2::CustomAttribute}] - # Custom attributes for the suggestion term. - # - # * For `user-data`, the attributes are additional custom attributes - # ingested through BigQuery. - # - # * For `cloud-retail`, the attributes are product attributes generated - # by Cloud Retail. It requires - # {::Google::Cloud::Retail::V2::UserEvent#product_details UserEvent.product_details} - # is imported properly. - class CompletionResult - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # @!attribute [rw] key - # @return [::String] - # @!attribute [rw] value - # @return [::Google::Cloud::Retail::V2::CustomAttribute] - class AttributesEntry - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - - # Deprecated: Recent search of this user. - # @deprecated This message is deprecated and may be removed in the next major version update. - # @!attribute [rw] recent_search - # @return [::String] - # The recent search query. - class RecentSearchResult - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Resource that represents attribute results. - # @!attribute [rw] suggestions - # @return [::Array<::String>] - # The list of suggestions for the attribute. - class AttributeResult - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # @!attribute [rw] key - # @return [::String] - # @!attribute [rw] value - # @return [::Google::Cloud::Retail::V2::CompleteQueryResponse::AttributeResult] - class AttributeResultsEntry - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/control.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/control.rb deleted file mode 100644 index 8a377de74e6d..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/control.rb +++ /dev/null @@ -1,75 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Cloud - module Retail - module V2 - # Configures dynamic metadata that can be linked to a - # {::Google::Cloud::Retail::V2::ServingConfig ServingConfig} and affect search or - # recommendation results at serving time. - # @!attribute [rw] rule - # @return [::Google::Cloud::Retail::V2::Rule] - # A rule control - a condition-action pair. - # Enacts a set action when the condition is triggered. - # For example: Boost "gShoe" when query full matches "Running Shoes". - # @!attribute [rw] name - # @return [::String] - # Immutable. Fully qualified name - # `projects/*/locations/global/catalogs/*/controls/*` - # @!attribute [rw] display_name - # @return [::String] - # Required. The human readable control display name. Used in Retail UI. - # - # This field must be a UTF-8 encoded string with a length limit of 128 - # characters. Otherwise, an INVALID_ARGUMENT error is thrown. - # @!attribute [r] associated_serving_config_ids - # @return [::Array<::String>] - # Output only. List of {::Google::Cloud::Retail::V2::ServingConfig serving config} - # ids that are associated with this control in the same - # {::Google::Cloud::Retail::V2::Catalog Catalog}. - # - # Note the association is managed via the - # {::Google::Cloud::Retail::V2::ServingConfig ServingConfig}, this is an output - # only denormalized view. - # @!attribute [rw] solution_types - # @return [::Array<::Google::Cloud::Retail::V2::SolutionType>] - # Required. Immutable. The solution types that the control is used for. - # Currently we support setting only one type of solution at creation time. - # - # Only `SOLUTION_TYPE_SEARCH` value is supported at the moment. - # If no solution type is provided at creation time, will default to - # {::Google::Cloud::Retail::V2::SolutionType::SOLUTION_TYPE_SEARCH SOLUTION_TYPE_SEARCH}. - # @!attribute [rw] search_solution_use_case - # @return [::Array<::Google::Cloud::Retail::V2::SearchSolutionUseCase>] - # Specifies the use case for the control. - # Affects what condition fields can be set. - # Only settable by search controls. - # Will default to - # {::Google::Cloud::Retail::V2::SearchSolutionUseCase::SEARCH_SOLUTION_USE_CASE_SEARCH SEARCH_SOLUTION_USE_CASE_SEARCH} - # if not specified. Currently only allow one search_solution_use_case per - # control. - class Control - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/control_service.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/control_service.rb deleted file mode 100644 index 317de6e4a175..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/control_service.rb +++ /dev/null @@ -1,122 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Cloud - module Retail - module V2 - # Request for CreateControl method. - # @!attribute [rw] parent - # @return [::String] - # Required. Full resource name of parent catalog. Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - # @!attribute [rw] control - # @return [::Google::Cloud::Retail::V2::Control] - # Required. The Control to create. - # @!attribute [rw] control_id - # @return [::String] - # Required. The ID to use for the Control, which will become the final - # component of the Control's resource name. - # - # This value should be 4-63 characters, and valid characters - # are /[a-z][0-9]-_/. - class CreateControlRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request for UpdateControl method. - # @!attribute [rw] control - # @return [::Google::Cloud::Retail::V2::Control] - # Required. The Control to update. - # @!attribute [rw] update_mask - # @return [::Google::Protobuf::FieldMask] - # Indicates which fields in the provided - # {::Google::Cloud::Retail::V2::Control Control} to update. The following are NOT - # supported: - # - # * {::Google::Cloud::Retail::V2::Control#name Control.name} - # - # If not set or empty, all supported fields are updated. - class UpdateControlRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request for DeleteControl method. - # @!attribute [rw] name - # @return [::String] - # Required. The resource name of the Control to delete. Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}` - class DeleteControlRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request for GetControl method. - # @!attribute [rw] name - # @return [::String] - # Required. The resource name of the Control to get. Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}` - class GetControlRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request for ListControls method. - # @!attribute [rw] parent - # @return [::String] - # Required. The catalog resource name. Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - # @!attribute [rw] page_size - # @return [::Integer] - # Optional. Maximum number of results to return. If unspecified, defaults - # to 50. Max allowed value is 1000. - # @!attribute [rw] page_token - # @return [::String] - # Optional. A page token, received from a previous `ListControls` call. - # Provide this to retrieve the subsequent page. - # @!attribute [rw] filter - # @return [::String] - # Optional. A filter to apply on the list results. Supported features: - # - # * List all the products under the parent branch if - # {::Google::Cloud::Retail::V2::ListControlsRequest#filter filter} is unset. - # * List controls that are used in a single ServingConfig: - # 'serving_config = "boosted_home_page_cvr"' - class ListControlsRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Response for ListControls method. - # @!attribute [rw] controls - # @return [::Array<::Google::Cloud::Retail::V2::Control>] - # All the Controls for a given catalog. - # @!attribute [rw] next_page_token - # @return [::String] - # Pagination token, if not returned indicates the last page. - class ListControlsResponse - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/conversational_search_service.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/conversational_search_service.rb deleted file mode 100644 index 5d3753d8f9ec..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/conversational_search_service.rb +++ /dev/null @@ -1,358 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Cloud - module Retail - module V2 - # Request message for - # {::Google::Cloud::Retail::V2::ConversationalSearchService::Client#conversational_search ConversationalSearchService.ConversationalSearch} - # method. - # @!attribute [rw] placement - # @return [::String] - # Required. The resource name of the search engine placement, such as - # `projects/*/locations/global/catalogs/default_catalog/placements/default_search` - # or - # `projects/*/locations/global/catalogs/default_catalog/servingConfigs/default_serving_config` - # This field is used to identify the serving config name and the set - # of models that will be used to make the search. - # @!attribute [rw] branch - # @return [::String] - # Required. The branch resource name, such as - # `projects/*/locations/global/catalogs/default_catalog/branches/0`. - # - # Use "default_branch" as the branch ID or leave this field empty, to search - # products under the default branch. - # @!attribute [rw] query - # @return [::String] - # Optional. Raw search query to be searched for. - # - # If this field is empty, the request is considered a category browsing - # request. - # @!attribute [rw] page_categories - # @return [::Array<::String>] - # Optional. The categories associated with a category page. Must be set for - # category navigation queries to achieve good search quality. The format - # should be the same as - # {::Google::Cloud::Retail::V2::UserEvent#page_categories UserEvent.page_categories}; - # - # To represent full path of category, use '>' sign to separate different - # hierarchies. If '>' is part of the category name, replace it with - # other character(s). - # - # Category pages include special pages such as sales or promotions. For - # instance, a special sale page may have the category hierarchy: - # "pageCategories" : ["Sales > 2017 Black Friday Deals"]. - # @!attribute [rw] conversation_id - # @return [::String] - # Optional. This field specifies the conversation id, which maintains the - # state of the conversation between client side and server side. Use the - # value from the previous - # {::Google::Cloud::Retail::V2::ConversationalSearchResponse#conversation_id ConversationalSearchResponse.conversation_id}. - # For the initial request, this should be empty. - # @!attribute [rw] search_params - # @return [::Google::Cloud::Retail::V2::ConversationalSearchRequest::SearchParams] - # Optional. Search parameters. - # @!attribute [rw] visitor_id - # @return [::String] - # Required. A unique identifier for tracking visitors. For example, this - # could be implemented with an HTTP cookie, which should be able to uniquely - # identify a visitor on a single device. This unique identifier should not - # change if the visitor logs in or out of the website. - # - # This should be the same identifier as - # {::Google::Cloud::Retail::V2::UserEvent#visitor_id UserEvent.visitor_id}. - # - # The field must be a UTF-8 encoded string with a length limit of 128 - # characters. Otherwise, an INVALID_ARGUMENT error is returned. - # @!attribute [rw] user_info - # @return [::Google::Cloud::Retail::V2::UserInfo] - # Optional. User information. - # @!attribute [rw] conversational_filtering_spec - # @return [::Google::Cloud::Retail::V2::ConversationalSearchRequest::ConversationalFilteringSpec] - # Optional. This field specifies all conversational filtering related - # parameters. - # @!attribute [rw] user_labels - # @return [::Google::Protobuf::Map{::String => ::String}] - # Optional. The user labels applied to a resource must meet the following - # requirements: - # - # * Each resource can have multiple labels, up to a maximum of 64. - # * Each label must be a key-value pair. - # * Keys have a minimum length of 1 character and a maximum length of 63 - # characters and cannot be empty. Values can be empty and have a maximum - # length of 63 characters. - # * Keys and values can contain only lowercase letters, numeric characters, - # underscores, and dashes. All characters must use UTF-8 encoding, and - # international characters are allowed. - # * The key portion of a label must be unique. However, you can use the same - # key with multiple resources. - # * Keys must start with a lowercase letter or international character. - # - # See [Google Cloud - # Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) - # for more details. - # @!attribute [rw] safety_settings - # @return [::Array<::Google::Cloud::Retail::V2::SafetySetting>] - # Optional. The safety settings to be applied to the generated content. - class ConversationalSearchRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # Search parameters. - # @!attribute [rw] filter - # @return [::String] - # Optional. The filter string to restrict search results. - # - # The syntax of the filter string is the same as - # {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}. - # @!attribute [rw] canonical_filter - # @return [::String] - # Optional. The canonical filter string to restrict search results. - # - # The syntax of the canonical filter string is the same as - # {::Google::Cloud::Retail::V2::SearchRequest#canonical_filter SearchRequest.canonical_filter}. - # @!attribute [rw] sort_by - # @return [::String] - # Optional. The sort string to specify the sorting of search results. - # - # The syntax of the sort string is the same as - # [SearchRequest.sort][]. - # @!attribute [rw] boost_spec - # @return [::Google::Cloud::Retail::V2::SearchRequest::BoostSpec] - # Optional. The boost spec to specify the boosting of search results. - # - # The syntax of the boost spec is the same as - # {::Google::Cloud::Retail::V2::SearchRequest#boost_spec SearchRequest.boost_spec}. - class SearchParams - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # This field specifies the current user answer during the conversational - # filtering search. This can be either user selected from suggested answers - # or user input plain text. - # @!attribute [rw] text_answer - # @return [::String] - # This field specifies the incremental input text from the user during - # the conversational search. - # - # Note: The following fields are mutually exclusive: `text_answer`, `selected_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared. - # @!attribute [rw] selected_answer - # @return [::Google::Cloud::Retail::V2::ConversationalSearchRequest::UserAnswer::SelectedAnswer] - # Optional. This field specifies the selected answer during the - # conversational search. This should be a subset of - # [ConversationalSearchResponse.followup_question.suggested_answers][]. - # - # Note: The following fields are mutually exclusive: `selected_answer`, `text_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared. - class UserAnswer - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # This field specifies the selected answers during the conversational - # search. - # @!attribute [rw] product_attribute_value - # @return [::Google::Cloud::Retail::V2::ProductAttributeValue] - # Optional. This field specifies the selected answer which is a attribute - # key-value. - class SelectedAnswer - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - - # This field specifies all conversational filtering related parameters - # addition to conversational retail search. - # @!attribute [rw] enable_conversational_filtering - # @deprecated This field is deprecated and may be removed in the next major version update. - # @return [::Boolean] - # Optional. This field is deprecated. Please use - # {::Google::Cloud::Retail::V2::ConversationalSearchRequest::ConversationalFilteringSpec#conversational_filtering_mode ConversationalFilteringSpec.conversational_filtering_mode} - # instead. - # @!attribute [rw] user_answer - # @return [::Google::Cloud::Retail::V2::ConversationalSearchRequest::UserAnswer] - # Optional. This field specifies the current user answer during the - # conversational filtering search. It can be either user selected from - # suggested answers or user input plain text. - # @!attribute [rw] conversational_filtering_mode - # @return [::Google::Cloud::Retail::V2::ConversationalSearchRequest::ConversationalFilteringSpec::Mode] - # Optional. Mode to control Conversational Filtering. - # Defaults to - # {::Google::Cloud::Retail::V2::ConversationalSearchRequest::ConversationalFilteringSpec::Mode::DISABLED Mode.DISABLED} - # if it's unset. - class ConversationalFilteringSpec - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # Enum to control Conversational Filtering mode. - # A single conversation session including multiple turns supports modes for - # Conversational Search OR Conversational Filtering without - # Conversational Search, but not both. - module Mode - # Default value. - MODE_UNSPECIFIED = 0 - - # Disables Conversational Filtering when using Conversational Search. - DISABLED = 1 - - # Enables Conversational Filtering when using Conversational Search. - ENABLED = 2 - - # Enables Conversational Filtering without Conversational Search. - CONVERSATIONAL_FILTER_ONLY = 3 - end - end - - # @!attribute [rw] key - # @return [::String] - # @!attribute [rw] value - # @return [::String] - class UserLabelsEntry - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - - # Response message for - # {::Google::Cloud::Retail::V2::ConversationalSearchService::Client#conversational_search ConversationalSearchService.ConversationalSearch} - # method. - # @!attribute [rw] user_query_types - # @return [::Array<::String>] - # The types Retail classifies the search query as. - # - # Supported values are: - # - # - "ORDER_SUPPORT" - # - "SIMPLE_PRODUCT_SEARCH" - # - "INTENT_REFINEMENT" - # - "PRODUCT_DETAILS" - # - "PRODUCT_COMPARISON" - # - "DEALS_AND_COUPONS" - # - "STORE_RELEVANT" - # - "BLOCKLISTED" - # - "BEST_PRODUCT" - # - "RETAIL_SUPPORT" - # - "DISABLED" - # @!attribute [rw] conversational_text_response - # @return [::String] - # The conversational answer-based text response generated by the Server. - # @!attribute [rw] followup_question - # @return [::Google::Cloud::Retail::V2::ConversationalSearchResponse::FollowupQuestion] - # The conversational followup question generated for Intent refinement. - # @!attribute [rw] conversation_id - # @return [::String] - # Conversation UUID. This field will be stored in client side storage to - # maintain the conversation session with server and will be used for next - # search request's - # {::Google::Cloud::Retail::V2::ConversationalSearchRequest#conversation_id ConversationalSearchRequest.conversation_id} - # to restore conversation state in server. - # @!attribute [rw] refined_search - # @return [::Array<::Google::Cloud::Retail::V2::ConversationalSearchResponse::RefinedSearch>] - # The proposed refined search queries. They can be used to fetch the relevant - # search results. When using CONVERSATIONAL_FILTER_ONLY mode, the - # refined_query from search response will be populated here. - # @!attribute [rw] conversational_filtering_result - # @return [::Google::Cloud::Retail::V2::ConversationalSearchResponse::ConversationalFilteringResult] - # This field specifies all related information that is needed on client - # side for UI rendering of conversational filtering search. - # @!attribute [r] state - # @return [::Google::Cloud::Retail::V2::ConversationalSearchResponse::State] - # Output only. The state of the response generation. - class ConversationalSearchResponse - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # The conversational followup question generated for Intent refinement. - # @!attribute [rw] followup_question - # @return [::String] - # The conversational followup question generated for Intent refinement. - # @!attribute [rw] suggested_answers - # @return [::Array<::Google::Cloud::Retail::V2::ConversationalSearchResponse::FollowupQuestion::SuggestedAnswer>] - # The answer options provided to client for the follow-up question. - class FollowupQuestion - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # Suggested answers to the follow-up question. - # If it's numerical attribute, only ProductAttributeInterval will be set. - # If it's textual attribute, only productAttributeValue will be set. - # @!attribute [rw] product_attribute_value - # @return [::Google::Cloud::Retail::V2::ProductAttributeValue] - # Product attribute value, including an attribute key and an - # attribute value. Other types can be added here in the future. - class SuggestedAnswer - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - - # The proposed refined search for intent-refinement/bundled shopping - # conversation. When using CONVERSATIONAL_FILTER_ONLY mode, the - # refined_query from search response will be populated here. - # @!attribute [rw] query - # @return [::String] - # The query to be used for search. - class RefinedSearch - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # This field specifies all related information that is needed on client - # side for UI rendering of conversational filtering search. - # @!attribute [rw] followup_question - # @return [::Google::Cloud::Retail::V2::ConversationalSearchResponse::FollowupQuestion] - # The conversational filtering question. - # @!attribute [rw] additional_filter - # @return [::Google::Cloud::Retail::V2::ConversationalSearchResponse::ConversationalFilteringResult::AdditionalFilter] - # This is the incremental additional filters implied from the current - # user answer. User should add the suggested addition filters to the - # previous [ConversationalSearchRequest.search_params.filter][] and - # {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}, and - # use the merged filter in the follow up requests. - class ConversationalFilteringResult - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # Additional filter that client side need to apply. - # @!attribute [rw] product_attribute_value - # @return [::Google::Cloud::Retail::V2::ProductAttributeValue] - # Product attribute value, including an attribute key and an - # attribute value. Other types can be added here in the future. - class AdditionalFilter - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - - # The state of the response generation. - module State - # Unknown. - STATE_UNSPECIFIED = 0 - - # Response generation is being streamed. - STREAMING = 1 - - # Response generation has succeeded. - SUCCEEDED = 2 - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/export_config.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/export_config.rb deleted file mode 100644 index 913e07ef4121..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/export_config.rb +++ /dev/null @@ -1,184 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Cloud - module Retail - module V2 - # The output configuration setting. - # @!attribute [rw] gcs_destination - # @return [::Google::Cloud::Retail::V2::OutputConfig::GcsDestination] - # The Google Cloud Storage location where the output is to be written to. - # - # Note: The following fields are mutually exclusive: `gcs_destination`, `bigquery_destination`. If a field in that set is populated, all other fields in the set will automatically be cleared. - # @!attribute [rw] bigquery_destination - # @return [::Google::Cloud::Retail::V2::OutputConfig::BigQueryDestination] - # The BigQuery location where the output is to be written to. - # - # Note: The following fields are mutually exclusive: `bigquery_destination`, `gcs_destination`. If a field in that set is populated, all other fields in the set will automatically be cleared. - class OutputConfig - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # The Google Cloud Storage output destination configuration. - # @!attribute [rw] output_uri_prefix - # @return [::String] - # Required. The output uri prefix for saving output data to json files. - # Some mapping examples are as follows: - # output_uri_prefix sample output(assuming the object is foo.json) - # ======================== ============================================= - # gs://bucket/ gs://bucket/foo.json - # gs://bucket/folder/ gs://bucket/folder/foo.json - # gs://bucket/folder/item_ gs://bucket/folder/item_foo.json - class GcsDestination - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # The BigQuery output destination configuration. - # @!attribute [rw] dataset_id - # @return [::String] - # Required. The ID of a BigQuery Dataset. - # @!attribute [rw] table_id_prefix - # @return [::String] - # Required. The prefix of exported BigQuery tables. - # @!attribute [rw] table_type - # @return [::String] - # Required. Describes the table type. The following values are supported: - # - # * `table`: A BigQuery native table. - # * `view`: A virtual table defined by a SQL query. - class BigQueryDestination - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - - # Configuration of destination for Export related errors. - # @!attribute [rw] gcs_prefix - # @return [::String] - # Google Cloud Storage path for import errors. This must be an empty, - # existing Cloud Storage bucket. Export errors will be written to a file in - # this bucket, one per line, as a JSON-encoded - # `google.rpc.Status` message. - class ExportErrorsConfig - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request message for the `ExportAnalyticsMetrics` method. - # @!attribute [rw] catalog - # @return [::String] - # Required. Full resource name of the parent catalog. - # Expected format: `projects/*/locations/*/catalogs/*` - # @!attribute [rw] output_config - # @return [::Google::Cloud::Retail::V2::OutputConfig] - # Required. The output location of the data. - # @!attribute [rw] filter - # @return [::String] - # A filtering expression to specify restrictions on returned metrics. - # The expression is a sequence of terms. Each term applies a restriction to - # the returned metrics. Use this expression to restrict results to a - # specific time range. - # - # Currently we expect only one types of fields: - # - # * `timestamp`: This can be specified twice, once with a - # less than operator and once with a greater than operator. The - # `timestamp` restriction should result in one, contiguous, valid, - # `timestamp` range. - # - # Some examples of valid filters expressions: - # - # * Example 1: `timestamp > "2012-04-23T18:25:43.511Z" - # timestamp < "2012-04-23T18:30:43.511Z"` - # * Example 2: `timestamp > "2012-04-23T18:25:43.511Z"` - class ExportAnalyticsMetricsRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Metadata related to the progress of the Export operation. This is - # returned by the google.longrunning.Operation.metadata field. - # @!attribute [rw] create_time - # @return [::Google::Protobuf::Timestamp] - # Operation create time. - # @!attribute [rw] update_time - # @return [::Google::Protobuf::Timestamp] - # Operation last update time. If the operation is done, this is also the - # finish time. - class ExportMetadata - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Response of the ExportAnalyticsMetricsRequest. If the long running - # operation was successful, then this message is returned by the - # google.longrunning.Operations.response field if the operation was successful. - # @!attribute [rw] error_samples - # @return [::Array<::Google::Rpc::Status>] - # A sample of errors encountered while processing the request. - # @!attribute [rw] errors_config - # @return [::Google::Cloud::Retail::V2::ExportErrorsConfig] - # This field is never set. - # @!attribute [rw] output_result - # @return [::Google::Cloud::Retail::V2::OutputResult] - # Output result indicating where the data were exported to. - class ExportAnalyticsMetricsResponse - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Output result that stores the information about where the exported data is - # stored. - # @!attribute [rw] bigquery_result - # @return [::Array<::Google::Cloud::Retail::V2::BigQueryOutputResult>] - # The BigQuery location where the result is stored. - # @!attribute [rw] gcs_result - # @return [::Array<::Google::Cloud::Retail::V2::GcsOutputResult>] - # The Google Cloud Storage location where the result is stored. - class OutputResult - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # A BigQuery output result. - # @!attribute [rw] dataset_id - # @return [::String] - # The ID of a BigQuery Dataset. - # @!attribute [rw] table_id - # @return [::String] - # The ID of a BigQuery Table. - class BigQueryOutputResult - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # A Gcs output result. - # @!attribute [rw] output_uri - # @return [::String] - # The uri of Gcs output - class GcsOutputResult - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/generative_question.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/generative_question.rb deleted file mode 100644 index 7a58a54f8f3c..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/generative_question.rb +++ /dev/null @@ -1,75 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Cloud - module Retail - module V2 - # Configuration for overall generative question feature state. - # @!attribute [rw] catalog - # @return [::String] - # Required. Resource name of the affected catalog. - # Format: projects/\\{project}/locations/\\{location}/catalogs/\\{catalog} - # @!attribute [rw] feature_enabled - # @return [::Boolean] - # Optional. Determines whether questions will be used at serving time. - # Note: This feature cannot be enabled until initial data requirements are - # satisfied. - # @!attribute [rw] minimum_products - # @return [::Integer] - # Optional. Minimum number of products in the response to trigger follow-up - # questions. Value must be 0 or positive. - class GenerativeQuestionsFeatureConfig - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Configuration for a single generated question. - # @!attribute [rw] catalog - # @return [::String] - # Required. Resource name of the catalog. - # Format: projects/\\{project}/locations/\\{location}/catalogs/\\{catalog} - # @!attribute [rw] facet - # @return [::String] - # Required. The facet to which the question is associated. - # @!attribute [r] generated_question - # @return [::String] - # Output only. The LLM generated question. - # @!attribute [rw] final_question - # @return [::String] - # Optional. The question that will be used at serving time. - # Question can have a max length of 300 bytes. - # When not populated, generated_question should be used. - # @!attribute [r] example_values - # @return [::Array<::String>] - # Output only. Values that can be used to answer the question. - # @!attribute [r] frequency - # @return [::Float] - # Output only. The ratio of how often a question was asked. - # @!attribute [rw] allowed_in_conversation - # @return [::Boolean] - # Optional. Whether the question is asked at serving time. - class GenerativeQuestionConfig - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/generative_question_service.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/generative_question_service.rb deleted file mode 100644 index dcd3144bc211..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/generative_question_service.rb +++ /dev/null @@ -1,109 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Cloud - module Retail - module V2 - # Request for UpdateGenerativeQuestionsFeatureConfig method. - # @!attribute [rw] generative_questions_feature_config - # @return [::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig] - # Required. The configuration managing the feature state. - # @!attribute [rw] update_mask - # @return [::Google::Protobuf::FieldMask] - # Optional. Indicates which fields in the provided - # {::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig GenerativeQuestionsFeatureConfig} - # to update. If not set or empty, all supported fields are updated. - class UpdateGenerativeQuestionsFeatureConfigRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request for GetGenerativeQuestionsFeatureConfig method. - # @!attribute [rw] catalog - # @return [::String] - # Required. Resource name of the parent catalog. - # Format: projects/\\{project}/locations/\\{location}/catalogs/\\{catalog} - class GetGenerativeQuestionsFeatureConfigRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request for ListQuestions method. - # @!attribute [rw] parent - # @return [::String] - # Required. Resource name of the parent catalog. - # Format: projects/\\{project}/locations/\\{location}/catalogs/\\{catalog} - class ListGenerativeQuestionConfigsRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Response for ListQuestions method. - # @!attribute [rw] generative_question_configs - # @return [::Array<::Google::Cloud::Retail::V2::GenerativeQuestionConfig>] - # All the questions for a given catalog. - class ListGenerativeQuestionConfigsResponse - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request for UpdateGenerativeQuestionConfig method. - # @!attribute [rw] generative_question_config - # @return [::Google::Cloud::Retail::V2::GenerativeQuestionConfig] - # Required. The question to update. - # @!attribute [rw] update_mask - # @return [::Google::Protobuf::FieldMask] - # Optional. Indicates which fields in the provided - # {::Google::Cloud::Retail::V2::GenerativeQuestionConfig GenerativeQuestionConfig} - # to update. The following are NOT supported: - # - # * {::Google::Cloud::Retail::V2::GenerativeQuestionConfig#frequency GenerativeQuestionConfig.frequency} - # - # If not set or empty, all supported fields are updated. - class UpdateGenerativeQuestionConfigRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request for BatchUpdateGenerativeQuestionConfig method. - # @!attribute [rw] parent - # @return [::String] - # Optional. Resource name of the parent catalog. - # Format: projects/\\{project}/locations/\\{location}/catalogs/\\{catalog} - # @!attribute [rw] requests - # @return [::Array<::Google::Cloud::Retail::V2::UpdateGenerativeQuestionConfigRequest>] - # Required. The updates question configs. - class BatchUpdateGenerativeQuestionConfigsRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Aggregated response for UpdateGenerativeQuestionConfig method. - # @!attribute [rw] generative_question_configs - # @return [::Array<::Google::Cloud::Retail::V2::GenerativeQuestionConfig>] - # Optional. The updates question configs. - class BatchUpdateGenerativeQuestionConfigsResponse - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/import_config.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/import_config.rb deleted file mode 100644 index e95a50d7e11c..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/import_config.rb +++ /dev/null @@ -1,404 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Cloud - module Retail - module V2 - # Google Cloud Storage location for input content. - # @!attribute [rw] input_uris - # @return [::Array<::String>] - # Required. Google Cloud Storage URIs to input files. URI can be up to - # 2000 characters long. URIs can match the full object path (for example, - # `gs://bucket/directory/object.json`) or a pattern matching one or more - # files, such as `gs://bucket/directory/*.json`. A request can - # contain at most 100 files, and each file can be up to 2 GB. See - # [Importing product - # information](https://cloud.google.com/retail/recommendations-ai/docs/upload-catalog) - # for the expected file format and setup instructions. - # @!attribute [rw] data_schema - # @return [::String] - # The schema to use when parsing the data from the source. - # - # Supported values for product imports: - # - # * `product` (default): One JSON {::Google::Cloud::Retail::V2::Product Product} - # per line. Each product must - # have a valid {::Google::Cloud::Retail::V2::Product#id Product.id}. - # * `product_merchant_center`: See [Importing catalog data from Merchant - # Center](https://cloud.google.com/retail/recommendations-ai/docs/upload-catalog#mc). - # - # Supported values for user events imports: - # - # * `user_event` (default): One JSON - # {::Google::Cloud::Retail::V2::UserEvent UserEvent} per line. - # * `user_event_ga360`: Using - # https://support.google.com/analytics/answer/3437719. - # - # Supported values for control imports: - # - # * `control` (default): One JSON {::Google::Cloud::Retail::V2::Control Control} - # per line. - # - # Supported values for catalog attribute imports: - # - # * `catalog_attribute` (default): One CSV - # {::Google::Cloud::Retail::V2::CatalogAttribute CatalogAttribute} per line. - class GcsSource - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # BigQuery source import data from. - # @!attribute [rw] partition_date - # @return [::Google::Type::Date] - # BigQuery time partitioned table's _PARTITIONDATE in YYYY-MM-DD format. - # @!attribute [rw] project_id - # @return [::String] - # The project ID (can be project # or ID) that the BigQuery source is in with - # a length limit of 128 characters. If not specified, inherits the project - # ID from the parent request. - # @!attribute [rw] dataset_id - # @return [::String] - # Required. The BigQuery data set to copy the data from with a length limit - # of 1,024 characters. - # @!attribute [rw] table_id - # @return [::String] - # Required. The BigQuery table to copy the data from with a length limit of - # 1,024 characters. - # @!attribute [rw] gcs_staging_dir - # @return [::String] - # Intermediate Cloud Storage directory used for the import with a length - # limit of 2,000 characters. Can be specified if one wants to have the - # BigQuery export to a specific Cloud Storage directory. - # @!attribute [rw] data_schema - # @return [::String] - # The schema to use when parsing the data from the source. - # - # Supported values for product imports: - # - # * `product` (default): One JSON {::Google::Cloud::Retail::V2::Product Product} - # per line. Each product must - # have a valid {::Google::Cloud::Retail::V2::Product#id Product.id}. - # * `product_merchant_center`: See [Importing catalog data from Merchant - # Center](https://cloud.google.com/retail/recommendations-ai/docs/upload-catalog#mc). - # - # Supported values for user events imports: - # - # * `user_event` (default): One JSON - # {::Google::Cloud::Retail::V2::UserEvent UserEvent} per line. - # * `user_event_ga360`: - # The schema is available here: - # https://support.google.com/analytics/answer/3437719. - # * `user_event_ga4`: - # The schema is available here: - # https://support.google.com/analytics/answer/7029846. - # - # Supported values for autocomplete imports: - # - # * `suggestions` (default): One JSON completion suggestion per line. - # * `denylist`: One JSON deny suggestion per line. - # * `allowlist`: One JSON allow suggestion per line. - class BigQuerySource - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # The inline source for the input config for ImportProducts method. - # @!attribute [rw] products - # @return [::Array<::Google::Cloud::Retail::V2::Product>] - # Required. A list of products to update/create. Each product must have a - # valid {::Google::Cloud::Retail::V2::Product#id Product.id}. Recommended max of - # 100 items. - class ProductInlineSource - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # The inline source for the input config for ImportUserEvents method. - # @!attribute [rw] user_events - # @return [::Array<::Google::Cloud::Retail::V2::UserEvent>] - # Required. A list of user events to import. Recommended max of 10k items. - class UserEventInlineSource - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Configuration of destination for Import related errors. - # @!attribute [rw] gcs_prefix - # @return [::String] - # Google Cloud Storage prefix for import errors. This must be an empty, - # existing Cloud Storage directory. Import errors are written to - # sharded files in this directory, one per line, as a JSON-encoded - # `google.rpc.Status` message. - class ImportErrorsConfig - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request message for Import methods. - # @!attribute [rw] parent - # @return [::String] - # Required. - # `projects/1234/locations/global/catalogs/default_catalog/branches/default_branch` - # - # If no updateMask is specified, requires products.create permission. - # If updateMask is specified, requires products.update permission. - # @!attribute [rw] request_id - # @deprecated This field is deprecated and may be removed in the next major version update. - # @return [::String] - # Deprecated. This field has no effect. - # @!attribute [rw] input_config - # @return [::Google::Cloud::Retail::V2::ProductInputConfig] - # Required. The desired input location of the data. - # @!attribute [rw] errors_config - # @return [::Google::Cloud::Retail::V2::ImportErrorsConfig] - # The desired location of errors incurred during the Import. - # @!attribute [rw] update_mask - # @return [::Google::Protobuf::FieldMask] - # Indicates which fields in the provided imported `products` to update. If - # not set, all fields are updated. If provided, only the existing product - # fields are updated. Missing products will not be created. - # @!attribute [rw] reconciliation_mode - # @return [::Google::Cloud::Retail::V2::ImportProductsRequest::ReconciliationMode] - # The mode of reconciliation between existing products and the products to be - # imported. Defaults to - # {::Google::Cloud::Retail::V2::ImportProductsRequest::ReconciliationMode::INCREMENTAL ReconciliationMode.INCREMENTAL}. - # @!attribute [rw] notification_pubsub_topic - # @return [::String] - # Full Pub/Sub topic name for receiving notification. If this field is set, - # when the import is finished, a notification is sent to - # specified Pub/Sub topic. The message data is JSON string of a - # {::Google::Longrunning::Operation Operation}. - # - # Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. It has - # to be within the same project as - # {::Google::Cloud::Retail::V2::ImportProductsRequest#parent ImportProductsRequest.parent}. - # Make sure that both - # `cloud-retail-customer-data-access@system.gserviceaccount.com` and - # `service-@gcp-sa-retail.iam.gserviceaccount.com` - # have the `pubsub.topics.publish` IAM permission on the topic. - # - # Only supported when - # {::Google::Cloud::Retail::V2::ImportProductsRequest#reconciliation_mode ImportProductsRequest.reconciliation_mode} - # is set to `FULL`. - class ImportProductsRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # Indicates how imported products are reconciled with the existing products - # created or imported before. - module ReconciliationMode - # Defaults to INCREMENTAL. - RECONCILIATION_MODE_UNSPECIFIED = 0 - - # Inserts new products or updates existing products. - INCREMENTAL = 1 - - # Calculates diff and replaces the entire product dataset. Existing - # products may be deleted if they are not present in the source location. - FULL = 2 - end - end - - # Request message for the ImportUserEvents request. - # @!attribute [rw] parent - # @return [::String] - # Required. `projects/1234/locations/global/catalogs/default_catalog` - # @!attribute [rw] input_config - # @return [::Google::Cloud::Retail::V2::UserEventInputConfig] - # Required. The desired input location of the data. - # @!attribute [rw] errors_config - # @return [::Google::Cloud::Retail::V2::ImportErrorsConfig] - # The desired location of errors incurred during the Import. Cannot be set - # for inline user event imports. - class ImportUserEventsRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request message for ImportCompletionData methods. - # @!attribute [rw] parent - # @return [::String] - # Required. The catalog which the suggestions dataset belongs to. - # - # Format: `projects/1234/locations/global/catalogs/default_catalog`. - # @!attribute [rw] input_config - # @return [::Google::Cloud::Retail::V2::CompletionDataInputConfig] - # Required. The desired input location of the data. - # @!attribute [rw] notification_pubsub_topic - # @return [::String] - # Pub/Sub topic for receiving notification. If this field is set, - # when the import is finished, a notification is sent to - # specified Pub/Sub topic. The message data is JSON string of a - # {::Google::Longrunning::Operation Operation}. - # Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. - class ImportCompletionDataRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # The input config source for products. - # @!attribute [rw] product_inline_source - # @return [::Google::Cloud::Retail::V2::ProductInlineSource] - # The Inline source for the input content for products. - # - # Note: The following fields are mutually exclusive: `product_inline_source`, `gcs_source`, `big_query_source`. If a field in that set is populated, all other fields in the set will automatically be cleared. - # @!attribute [rw] gcs_source - # @return [::Google::Cloud::Retail::V2::GcsSource] - # Google Cloud Storage location for the input content. - # - # Note: The following fields are mutually exclusive: `gcs_source`, `product_inline_source`, `big_query_source`. If a field in that set is populated, all other fields in the set will automatically be cleared. - # @!attribute [rw] big_query_source - # @return [::Google::Cloud::Retail::V2::BigQuerySource] - # BigQuery input source. - # - # Note: The following fields are mutually exclusive: `big_query_source`, `product_inline_source`, `gcs_source`. If a field in that set is populated, all other fields in the set will automatically be cleared. - class ProductInputConfig - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # The input config source for user events. - # @!attribute [rw] user_event_inline_source - # @return [::Google::Cloud::Retail::V2::UserEventInlineSource] - # Required. The Inline source for the input content for UserEvents. - # - # Note: The following fields are mutually exclusive: `user_event_inline_source`, `gcs_source`, `big_query_source`. If a field in that set is populated, all other fields in the set will automatically be cleared. - # @!attribute [rw] gcs_source - # @return [::Google::Cloud::Retail::V2::GcsSource] - # Required. Google Cloud Storage location for the input content. - # - # Note: The following fields are mutually exclusive: `gcs_source`, `user_event_inline_source`, `big_query_source`. If a field in that set is populated, all other fields in the set will automatically be cleared. - # @!attribute [rw] big_query_source - # @return [::Google::Cloud::Retail::V2::BigQuerySource] - # Required. BigQuery input source. - # - # Note: The following fields are mutually exclusive: `big_query_source`, `user_event_inline_source`, `gcs_source`. If a field in that set is populated, all other fields in the set will automatically be cleared. - class UserEventInputConfig - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # The input config source for completion data. - # @!attribute [rw] big_query_source - # @return [::Google::Cloud::Retail::V2::BigQuerySource] - # Required. BigQuery input source. - # - # Add the IAM permission "BigQuery Data Viewer" for - # cloud-retail-customer-data-access@system.gserviceaccount.com before - # using this feature otherwise an error is thrown. - class CompletionDataInputConfig - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Metadata related to the progress of the Import operation. This is - # returned by the google.longrunning.Operation.metadata field. - # @!attribute [rw] create_time - # @return [::Google::Protobuf::Timestamp] - # Operation create time. - # @!attribute [rw] update_time - # @return [::Google::Protobuf::Timestamp] - # Operation last update time. If the operation is done, this is also the - # finish time. - # @!attribute [rw] success_count - # @return [::Integer] - # Count of entries that were processed successfully. - # @!attribute [rw] failure_count - # @return [::Integer] - # Count of entries that encountered errors while processing. - # @!attribute [rw] request_id - # @deprecated This field is deprecated and may be removed in the next major version update. - # @return [::String] - # Deprecated. This field is never set. - # @!attribute [rw] notification_pubsub_topic - # @return [::String] - # Pub/Sub topic for receiving notification. If this field is set, - # when the import is finished, a notification is sent to - # specified Pub/Sub topic. The message data is JSON string of a - # {::Google::Longrunning::Operation Operation}. - # Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. - class ImportMetadata - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Response of the - # {::Google::Cloud::Retail::V2::ImportProductsRequest ImportProductsRequest}. If the - # long running operation is done, then this message is returned by the - # google.longrunning.Operations.response field if the operation was successful. - # @!attribute [rw] error_samples - # @return [::Array<::Google::Rpc::Status>] - # A sample of errors encountered while processing the request. - # @!attribute [rw] errors_config - # @return [::Google::Cloud::Retail::V2::ImportErrorsConfig] - # Echoes the destination for the complete errors in the request if set. - class ImportProductsResponse - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Response of the ImportUserEventsRequest. If the long running - # operation was successful, then this message is returned by the - # google.longrunning.Operations.response field if the operation was successful. - # @!attribute [rw] error_samples - # @return [::Array<::Google::Rpc::Status>] - # A sample of errors encountered while processing the request. - # @!attribute [rw] errors_config - # @return [::Google::Cloud::Retail::V2::ImportErrorsConfig] - # Echoes the destination for the complete errors if this field was set in - # the request. - # @!attribute [rw] import_summary - # @return [::Google::Cloud::Retail::V2::UserEventImportSummary] - # Aggregated statistics of user event import status. - class ImportUserEventsResponse - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # A summary of import result. The UserEventImportSummary summarizes - # the import status for user events. - # @!attribute [rw] joined_events_count - # @return [::Integer] - # Count of user events imported with complete existing catalog information. - # @!attribute [rw] unjoined_events_count - # @return [::Integer] - # Count of user events imported, but with catalog information not found - # in the imported catalog. - class UserEventImportSummary - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Response of the - # {::Google::Cloud::Retail::V2::ImportCompletionDataRequest ImportCompletionDataRequest}. - # If the long running operation is done, this message is returned by the - # google.longrunning.Operations.response field if the operation is successful. - # @!attribute [rw] error_samples - # @return [::Array<::Google::Rpc::Status>] - # A sample of errors encountered while processing the request. - class ImportCompletionDataResponse - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/model.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/model.rb deleted file mode 100644 index 76ac3160ed3b..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/model.rb +++ /dev/null @@ -1,267 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Cloud - module Retail - module V2 - # Metadata that describes the training and serving parameters of a - # {::Google::Cloud::Retail::V2::Model Model}. A - # {::Google::Cloud::Retail::V2::Model Model} can be associated with a - # {::Google::Cloud::Retail::V2::ServingConfig ServingConfig} and then queried - # through the Predict API. - # @!attribute [rw] name - # @return [::String] - # Required. The fully qualified resource name of the model. - # - # Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` - # catalog_id has char limit of 50. - # recommendation_model_id has char limit of 40. - # @!attribute [rw] display_name - # @return [::String] - # Required. The display name of the model. - # - # Should be human readable, used to display Recommendation Models in the - # Retail Cloud Console Dashboard. UTF-8 encoded string with limit of 1024 - # characters. - # @!attribute [rw] training_state - # @return [::Google::Cloud::Retail::V2::Model::TrainingState] - # Optional. The training state that the model is in (e.g. - # `TRAINING` or `PAUSED`). - # - # Since part of the cost of running the service - # is frequency of training - this can be used to determine when to train - # model in order to control cost. If not specified: the default value for - # `CreateModel` method is `TRAINING`. The default value for - # `UpdateModel` method is to keep the state the same as before. - # @!attribute [r] serving_state - # @return [::Google::Cloud::Retail::V2::Model::ServingState] - # Output only. The serving state of the model: `ACTIVE`, `NOT_ACTIVE`. - # @!attribute [r] create_time - # @return [::Google::Protobuf::Timestamp] - # Output only. Timestamp the Recommendation Model was created at. - # @!attribute [r] update_time - # @return [::Google::Protobuf::Timestamp] - # Output only. Timestamp the Recommendation Model was last updated. E.g. - # if a Recommendation Model was paused - this would be the time the pause was - # initiated. - # @!attribute [rw] type - # @return [::String] - # Required. The type of model e.g. `home-page`. - # - # Currently supported values: `recommended-for-you`, `others-you-may-like`, - # `frequently-bought-together`, `page-optimization`, `similar-items`, - # `buy-it-again`, `on-sale-items`, and `recently-viewed`(readonly value). - # - # This field together with - # {::Google::Cloud::Retail::V2::Model#optimization_objective optimization_objective} - # describe model metadata to use to control model training and serving. - # See https://cloud.google.com/retail/docs/models - # for more details on what the model metadata control and which combination - # of parameters are valid. For invalid combinations of parameters (e.g. type - # = `frequently-bought-together` and optimization_objective = `ctr`), you - # receive an error 400 if you try to create/update a recommendation with - # this set of knobs. - # @!attribute [rw] optimization_objective - # @return [::String] - # Optional. The optimization objective e.g. `cvr`. - # - # Currently supported - # values: `ctr`, `cvr`, `revenue-per-order`. - # - # If not specified, we choose default based on model type. - # Default depends on type of recommendation: - # - # `recommended-for-you` => `ctr` - # - # `others-you-may-like` => `ctr` - # - # `frequently-bought-together` => `revenue_per_order` - # - # This field together with - # {::Google::Cloud::Retail::V2::Model#type optimization_objective} - # describe model metadata to use to control model training and serving. - # See https://cloud.google.com/retail/docs/models - # for more details on what the model metadata control and which combination - # of parameters are valid. For invalid combinations of parameters (e.g. type - # = `frequently-bought-together` and optimization_objective = `ctr`), you - # receive an error 400 if you try to create/update a recommendation with - # this set of knobs. - # @!attribute [rw] periodic_tuning_state - # @return [::Google::Cloud::Retail::V2::Model::PeriodicTuningState] - # Optional. The state of periodic tuning. - # - # The period we use is 3 months - to do a - # one-off tune earlier use the `TuneModel` method. Default value - # is `PERIODIC_TUNING_ENABLED`. - # @!attribute [r] last_tune_time - # @return [::Google::Protobuf::Timestamp] - # Output only. The timestamp when the latest successful tune finished. - # @!attribute [r] tuning_operation - # @return [::String] - # Output only. The tune operation associated with the model. - # - # Can be used to determine if there is an ongoing tune for this - # recommendation. Empty field implies no tune is goig on. - # @!attribute [r] data_state - # @return [::Google::Cloud::Retail::V2::Model::DataState] - # Output only. The state of data requirements for this model: `DATA_OK` and - # `DATA_ERROR`. - # - # Recommendation model cannot be trained if the data is in - # `DATA_ERROR` state. Recommendation model can have `DATA_ERROR` state even - # if serving state is `ACTIVE`: models were trained successfully before, but - # cannot be refreshed because model no longer has sufficient - # data for training. - # @!attribute [rw] filtering_option - # @return [::Google::Cloud::Retail::V2::RecommendationsFilteringOption] - # Optional. If `RECOMMENDATIONS_FILTERING_ENABLED`, recommendation filtering - # by attributes is enabled for the model. - # @!attribute [r] serving_config_lists - # @return [::Array<::Google::Cloud::Retail::V2::Model::ServingConfigList>] - # Output only. The list of valid serving configs associated with the - # PageOptimizationConfig. - # @!attribute [rw] model_features_config - # @return [::Google::Cloud::Retail::V2::Model::ModelFeaturesConfig] - # Optional. Additional model features config. - class Model - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # Represents an ordered combination of valid serving configs, which - # can be used for `PAGE_OPTIMIZATION` recommendations. - # @!attribute [rw] serving_config_ids - # @return [::Array<::String>] - # Optional. A set of valid serving configs that may be used for - # `PAGE_OPTIMIZATION`. - class ServingConfigList - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Additional configs for the frequently-bought-together model type. - # @!attribute [rw] context_products_type - # @return [::Google::Cloud::Retail::V2::Model::ContextProductsType] - # Optional. Specifies the context of the model when it is used in predict - # requests. Can only be set for the `frequently-bought-together` type. If - # it isn't specified, it defaults to - # {::Google::Cloud::Retail::V2::Model::ContextProductsType::MULTIPLE_CONTEXT_PRODUCTS MULTIPLE_CONTEXT_PRODUCTS}. - class FrequentlyBoughtTogetherFeaturesConfig - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Additional model features config. - # @!attribute [rw] frequently_bought_together_config - # @return [::Google::Cloud::Retail::V2::Model::FrequentlyBoughtTogetherFeaturesConfig] - # Additional configs for frequently-bought-together models. - class ModelFeaturesConfig - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # The serving state of the model. - module ServingState - # Unspecified serving state. - SERVING_STATE_UNSPECIFIED = 0 - - # The model is not serving. - INACTIVE = 1 - - # The model is serving and can be queried. - ACTIVE = 2 - - # The model is trained on tuned hyperparameters and can be - # queried. - TUNED = 3 - end - - # The training state of the model. - module TrainingState - # Unspecified training state. - TRAINING_STATE_UNSPECIFIED = 0 - - # The model training is paused. - PAUSED = 1 - - # The model is training. - TRAINING = 2 - end - - # Describes whether periodic tuning is enabled for this model - # or not. Periodic tuning is scheduled at most every three months. You can - # start a tuning process manually by using the `TuneModel` - # method, which starts a tuning process immediately and resets the quarterly - # schedule. Enabling or disabling periodic tuning does not affect any - # current tuning processes. - module PeriodicTuningState - # Unspecified default value, should never be explicitly set. - PERIODIC_TUNING_STATE_UNSPECIFIED = 0 - - # The model has periodic tuning disabled. Tuning - # can be reenabled by calling the `EnableModelPeriodicTuning` - # method or by calling the `TuneModel` method. - PERIODIC_TUNING_DISABLED = 1 - - # The model cannot be tuned with periodic tuning OR the - # `TuneModel` method. Hide the options in customer UI and - # reject any requests through the backend self serve API. - ALL_TUNING_DISABLED = 3 - - # The model has periodic tuning enabled. Tuning - # can be disabled by calling the `DisableModelPeriodicTuning` - # method. - PERIODIC_TUNING_ENABLED = 2 - end - - # Describes whether this model have sufficient training data - # to be continuously trained. - module DataState - # Unspecified default value, should never be explicitly set. - DATA_STATE_UNSPECIFIED = 0 - - # The model has sufficient training data. - DATA_OK = 1 - - # The model does not have sufficient training data. Error - # messages can be queried via Stackdriver. - DATA_ERROR = 2 - end - - # Use single or multiple context products for recommendations. - module ContextProductsType - # Unspecified default value, should never be explicitly set. - # Defaults to - # {::Google::Cloud::Retail::V2::Model::ContextProductsType::MULTIPLE_CONTEXT_PRODUCTS MULTIPLE_CONTEXT_PRODUCTS}. - CONTEXT_PRODUCTS_TYPE_UNSPECIFIED = 0 - - # Use only a single product as context for the recommendation. Typically - # used on pages like add-to-cart or product details. - SINGLE_CONTEXT_PRODUCT = 1 - - # Use one or multiple products as context for the recommendation. Typically - # used on shopping cart pages. - MULTIPLE_CONTEXT_PRODUCTS = 2 - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/model_service.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/model_service.rb deleted file mode 100644 index 0fe12a4770c2..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/model_service.rb +++ /dev/null @@ -1,172 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Cloud - module Retail - module V2 - # Request for creating a model. - # @!attribute [rw] parent - # @return [::String] - # Required. The parent resource under which to create the model. Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - # @!attribute [rw] model - # @return [::Google::Cloud::Retail::V2::Model] - # Required. The payload of the {::Google::Cloud::Retail::V2::Model Model} to - # create. - # @!attribute [rw] dry_run - # @return [::Boolean] - # Optional. Whether to run a dry run to validate the request (without - # actually creating the model). - class CreateModelRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request for updating an existing model. - # @!attribute [rw] model - # @return [::Google::Cloud::Retail::V2::Model] - # Required. The body of the updated {::Google::Cloud::Retail::V2::Model Model}. - # @!attribute [rw] update_mask - # @return [::Google::Protobuf::FieldMask] - # Optional. Indicates which fields in the provided 'model' to - # update. If not set, by default updates all fields. - class UpdateModelRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request for getting a model. - # @!attribute [rw] name - # @return [::String] - # Required. The resource name of the {::Google::Cloud::Retail::V2::Model Model} to - # get. Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog}/models/{model_id}` - class GetModelRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request for pausing training of a model. - # @!attribute [rw] name - # @return [::String] - # Required. The name of the model to pause. - # Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` - class PauseModelRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request for resuming training of a model. - # @!attribute [rw] name - # @return [::String] - # Required. The name of the model to resume. - # Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` - class ResumeModelRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request for listing models associated with a resource. - # @!attribute [rw] parent - # @return [::String] - # Required. The parent for which to list models. - # Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - # @!attribute [rw] page_size - # @return [::Integer] - # Optional. Maximum number of results to return. If unspecified, defaults - # to 50. Max allowed value is 1000. - # @!attribute [rw] page_token - # @return [::String] - # Optional. A page token, received from a previous `ListModels` - # call. Provide this to retrieve the subsequent page. - class ListModelsRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request for deleting a model. - # @!attribute [rw] name - # @return [::String] - # Required. The resource name of the {::Google::Cloud::Retail::V2::Model Model} to - # delete. Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` - class DeleteModelRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Response to a ListModelRequest. - # @!attribute [rw] models - # @return [::Array<::Google::Cloud::Retail::V2::Model>] - # List of Models. - # @!attribute [rw] next_page_token - # @return [::String] - # Pagination token, if not returned indicates the last page. - class ListModelsResponse - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request to manually start a tuning process now (instead of waiting for - # the periodically scheduled tuning to happen). - # @!attribute [rw] name - # @return [::String] - # Required. The resource name of the model to tune. - # Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` - class TuneModelRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Metadata associated with a create operation. - # @!attribute [rw] model - # @return [::String] - # The resource name of the model that this create applies to. - # Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` - class CreateModelMetadata - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Metadata associated with a tune operation. - # @!attribute [rw] model - # @return [::String] - # The resource name of the model that this tune applies to. - # Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` - class TuneModelMetadata - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Response associated with a tune operation. - class TuneModelResponse - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/prediction_service.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/prediction_service.rb deleted file mode 100644 index 53e46e58df05..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/prediction_service.rb +++ /dev/null @@ -1,237 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Cloud - module Retail - module V2 - # Request message for Predict method. - # @!attribute [rw] placement - # @return [::String] - # Required. Full resource name of the format: - # `{placement=projects/*/locations/global/catalogs/default_catalog/servingConfigs/*}` - # or - # `{placement=projects/*/locations/global/catalogs/default_catalog/placements/*}`. - # We recommend using the `servingConfigs` resource. `placements` is a legacy - # resource. - # The ID of the Recommendations AI serving config or placement. - # Before you can request predictions from your model, you must create at - # least one serving config or placement for it. For more information, see - # [Manage serving configs] - # (https://cloud.google.com/retail/docs/manage-configs). - # - # The full list of available serving configs can be seen at - # https://console.cloud.google.com/ai/retail/catalogs/default_catalog/configs - # @!attribute [rw] user_event - # @return [::Google::Cloud::Retail::V2::UserEvent] - # Required. Context about the user, what they are looking at and what action - # they took to trigger the predict request. Note that this user event detail - # won't be ingested to userEvent logs. Thus, a separate userEvent write - # request is required for event logging. - # - # Don't set - # {::Google::Cloud::Retail::V2::UserEvent#visitor_id UserEvent.visitor_id} or - # {::Google::Cloud::Retail::V2::UserInfo#user_id UserInfo.user_id} to the same - # fixed ID for different users. If you are trying to receive non-personalized - # recommendations (not recommended; this can negatively impact model - # performance), instead set - # {::Google::Cloud::Retail::V2::UserEvent#visitor_id UserEvent.visitor_id} to a - # random unique ID and leave - # {::Google::Cloud::Retail::V2::UserInfo#user_id UserInfo.user_id} unset. - # @!attribute [rw] page_size - # @return [::Integer] - # Maximum number of results to return. Set this property to the number of - # prediction results needed. If zero, the service will choose a reasonable - # default. The maximum allowed value is 100. Values above 100 will be coerced - # to 100. - # @!attribute [rw] page_token - # @deprecated This field is deprecated and may be removed in the next major version update. - # @return [::String] - # This field is not used; leave it unset. - # @!attribute [rw] filter - # @return [::String] - # Filter for restricting prediction results with a length limit of 5,000 - # characters. Accepts values for tags and the `filterOutOfStockItems` flag. - # - # * Tag expressions. Restricts predictions to products that match all of the - # specified tags. Boolean operators `OR` and `NOT` are supported if the - # expression is enclosed in parentheses, and must be separated from the - # tag values by a space. `-"tagA"` is also supported and is equivalent to - # `NOT "tagA"`. Tag values must be double quoted UTF-8 encoded strings - # with a size limit of 1,000 characters. - # - # Note: "Recently viewed" models don't support tag filtering at the - # moment. - # - # * filterOutOfStockItems. Restricts predictions to products that do not - # have a - # stockState value of OUT_OF_STOCK. - # - # Examples: - # - # * tag=("Red" OR "Blue") tag="New-Arrival" tag=(NOT "promotional") - # * filterOutOfStockItems tag=(-"promotional") - # * filterOutOfStockItems - # - # If your filter blocks all prediction results, the API will return *no* - # results. If instead you want empty result sets to return generic - # (unfiltered) popular products, set `strictFiltering` to False in - # `PredictRequest.params`. Note that the API will never return items with - # storageStatus of "EXPIRED" or "DELETED" regardless of filter choices. - # - # If `filterSyntaxV2` is set to true under the `params` field, then - # attribute-based expressions are expected instead of the above described - # tag-based syntax. Examples: - # - # * (colors: ANY("Red", "Blue")) AND NOT (categories: ANY("Phones")) - # * (availability: ANY("IN_STOCK")) AND - # (colors: ANY("Red") OR categories: ANY("Phones")) - # - # For more information, see - # [Filter recommendations](https://cloud.google.com/retail/docs/filter-recs). - # @!attribute [rw] validate_only - # @return [::Boolean] - # Use validate only mode for this prediction query. If set to true, a - # dummy model will be used that returns arbitrary products. - # Note that the validate only mode should only be used for testing the API, - # or if the model is not ready. - # @!attribute [rw] params - # @return [::Google::Protobuf::Map{::String => ::Google::Protobuf::Value}] - # Additional domain specific parameters for the predictions. - # - # Allowed values: - # - # * `returnProduct`: Boolean. If set to true, the associated product - # object will be returned in the `results.metadata` field in the - # prediction response. - # * `returnScore`: Boolean. If set to true, the prediction 'score' - # corresponding to each returned product will be set in the - # `results.metadata` field in the prediction response. The given - # 'score' indicates the probability of a product being clicked/purchased - # given the user's context and history. - # * `strictFiltering`: Boolean. True by default. If set to false, the service - # will return generic (unfiltered) popular products instead of empty if - # your filter blocks all prediction results. - # * `priceRerankLevel`: String. Default empty. If set to be non-empty, then - # it needs to be one of {'no-price-reranking', 'low-price-reranking', - # 'medium-price-reranking', 'high-price-reranking'}. This gives - # request-level control and adjusts prediction results based on product - # price. - # * `diversityLevel`: String. Default empty. If set to be non-empty, then - # it needs to be one of {'no-diversity', 'low-diversity', - # 'medium-diversity', 'high-diversity', 'auto-diversity'}. This gives - # request-level control and adjusts prediction results based on product - # category. - # * `filterSyntaxV2`: Boolean. False by default. If set to true, the `filter` - # field is interpreteted according to the new, attribute-based syntax. - # @!attribute [rw] labels - # @return [::Google::Protobuf::Map{::String => ::String}] - # The labels applied to a resource must meet the following requirements: - # - # * Each resource can have multiple labels, up to a maximum of 64. - # * Each label must be a key-value pair. - # * Keys have a minimum length of 1 character and a maximum length of 63 - # characters and cannot be empty. Values can be empty and have a maximum - # length of 63 characters. - # * Keys and values can contain only lowercase letters, numeric characters, - # underscores, and dashes. All characters must use UTF-8 encoding, and - # international characters are allowed. - # * The key portion of a label must be unique. However, you can use the same - # key with multiple resources. - # * Keys must start with a lowercase letter or international character. - # - # See [Google Cloud - # Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) - # for more details. - class PredictRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # @!attribute [rw] key - # @return [::String] - # @!attribute [rw] value - # @return [::Google::Protobuf::Value] - class ParamsEntry - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # @!attribute [rw] key - # @return [::String] - # @!attribute [rw] value - # @return [::String] - class LabelsEntry - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - - # Response message for predict method. - # @!attribute [rw] results - # @return [::Array<::Google::Cloud::Retail::V2::PredictResponse::PredictionResult>] - # A list of recommended products. The order represents the ranking (from the - # most relevant product to the least). - # @!attribute [rw] attribution_token - # @return [::String] - # A unique attribution token. This should be included in the - # {::Google::Cloud::Retail::V2::UserEvent UserEvent} logs resulting from this - # recommendation, which enables accurate attribution of recommendation model - # performance. - # @!attribute [rw] missing_ids - # @return [::Array<::String>] - # IDs of products in the request that were missing from the inventory. - # @!attribute [rw] validate_only - # @return [::Boolean] - # True if the validateOnly property was set in the request. - class PredictResponse - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # PredictionResult represents the recommendation prediction results. - # @!attribute [rw] id - # @return [::String] - # ID of the recommended product - # @!attribute [rw] metadata - # @return [::Google::Protobuf::Map{::String => ::Google::Protobuf::Value}] - # Additional product metadata / annotations. - # - # Possible values: - # - # * `product`: JSON representation of the product. Is set if - # `returnProduct` is set to true in `PredictRequest.params`. - # * `score`: Prediction score in double value. Is set if - # `returnScore` is set to true in `PredictRequest.params`. - class PredictionResult - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # @!attribute [rw] key - # @return [::String] - # @!attribute [rw] value - # @return [::Google::Protobuf::Value] - class MetadataEntry - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/product.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/product.rb deleted file mode 100644 index a5c89f524c45..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/product.rb +++ /dev/null @@ -1,588 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Cloud - module Retail - module V2 - # Product captures all metadata information of items to be recommended or - # searched. - # @!attribute [rw] expire_time - # @return [::Google::Protobuf::Timestamp] - # Note that this field is applied in the following ways: - # - # * If the {::Google::Cloud::Retail::V2::Product Product} is already expired - # when it is uploaded, this product - # is not indexed for search. - # - # * If the {::Google::Cloud::Retail::V2::Product Product} is not expired when it - # is uploaded, only the - # {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Type.PRIMARY}'s and - # {::Google::Cloud::Retail::V2::Product::Type::COLLECTION Type.COLLECTION}'s - # expireTime is respected, and - # {::Google::Cloud::Retail::V2::Product::Type::VARIANT Type.VARIANT}'s - # expireTime is not used. - # - # In general, we suggest the users to delete the stale - # products explicitly, instead of using this field to determine staleness. - # - # {::Google::Cloud::Retail::V2::Product#expire_time expire_time} must be later - # than {::Google::Cloud::Retail::V2::Product#available_time available_time} and - # {::Google::Cloud::Retail::V2::Product#publish_time publish_time}, otherwise an - # INVALID_ARGUMENT error is thrown. - # - # Corresponding properties: Google Merchant Center property - # [expiration_date](https://support.google.com/merchants/answer/6324499). - # - # Note: The following fields are mutually exclusive: `expire_time`, `ttl`. If a field in that set is populated, all other fields in the set will automatically be cleared. - # @!attribute [rw] ttl - # @return [::Google::Protobuf::Duration] - # Input only. The TTL (time to live) of the product. Note that this is only - # applicable to {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Type.PRIMARY} - # and {::Google::Cloud::Retail::V2::Product::Type::COLLECTION Type.COLLECTION}, - # and ignored for - # {::Google::Cloud::Retail::V2::Product::Type::VARIANT Type.VARIANT}. In general, - # we suggest the users to delete the stale products explicitly, instead of - # using this field to determine staleness. - # - # If it is set, it must be a non-negative value, and - # {::Google::Cloud::Retail::V2::Product#expire_time expire_time} is set as - # current timestamp plus {::Google::Cloud::Retail::V2::Product#ttl ttl}. The - # derived {::Google::Cloud::Retail::V2::Product#expire_time expire_time} is - # returned in the output and {::Google::Cloud::Retail::V2::Product#ttl ttl} is - # left blank when retrieving the {::Google::Cloud::Retail::V2::Product Product}. - # - # If it is set, the product is not available for - # {::Google::Cloud::Retail::V2::SearchService::Client#search SearchService.Search} after - # current timestamp plus {::Google::Cloud::Retail::V2::Product#ttl ttl}. - # However, the product can still be retrieved by - # {::Google::Cloud::Retail::V2::ProductService::Client#get_product ProductService.GetProduct} - # and - # {::Google::Cloud::Retail::V2::ProductService::Client#list_products ProductService.ListProducts}. - # - # Note: The following fields are mutually exclusive: `ttl`, `expire_time`. If a field in that set is populated, all other fields in the set will automatically be cleared. - # @!attribute [rw] name - # @return [::String] - # Immutable. Full resource name of the product, such as - # `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/product_id`. - # @!attribute [rw] id - # @return [::String] - # Immutable. {::Google::Cloud::Retail::V2::Product Product} identifier, which is - # the final component of {::Google::Cloud::Retail::V2::Product#name name}. For - # example, this field is "id_1", if - # {::Google::Cloud::Retail::V2::Product#name name} is - # `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/id_1`. - # - # This field must be a UTF-8 encoded string with a length limit of 128 - # characters. Otherwise, an INVALID_ARGUMENT error is returned. - # - # Corresponding properties: Google Merchant Center property - # [id](https://support.google.com/merchants/answer/6324405). Schema.org - # property [Product.sku](https://schema.org/sku). - # @!attribute [rw] type - # @return [::Google::Cloud::Retail::V2::Product::Type] - # Immutable. The type of the product. Default to - # {::Google::Cloud::Retail::V2::ProductLevelConfig#ingestion_product_type Catalog.product_level_config.ingestion_product_type} - # if unset. - # @!attribute [rw] primary_product_id - # @return [::String] - # Variant group identifier. Must be an - # {::Google::Cloud::Retail::V2::Product#id id}, with the same parent branch with - # this product. Otherwise, an error is thrown. - # - # For {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Type.PRIMARY} - # {::Google::Cloud::Retail::V2::Product Product}s, this field can only be empty or - # set to the same value as {::Google::Cloud::Retail::V2::Product#id id}. - # - # For VARIANT {::Google::Cloud::Retail::V2::Product Product}s, this field cannot - # be empty. A maximum of 2,000 products are allowed to share the same - # {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Type.PRIMARY} - # {::Google::Cloud::Retail::V2::Product Product}. Otherwise, an INVALID_ARGUMENT - # error is returned. - # - # Corresponding properties: Google Merchant Center property - # [item_group_id](https://support.google.com/merchants/answer/6324507). - # Schema.org property - # [Product.inProductGroupWithID](https://schema.org/inProductGroupWithID). - # @!attribute [rw] collection_member_ids - # @return [::Array<::String>] - # The {::Google::Cloud::Retail::V2::Product#id id} of the collection members when - # {::Google::Cloud::Retail::V2::Product#type type} is - # {::Google::Cloud::Retail::V2::Product::Type::COLLECTION Type.COLLECTION}. - # - # Non-existent product ids are allowed. - # The {::Google::Cloud::Retail::V2::Product#type type} of the members must be - # either {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Type.PRIMARY} or - # {::Google::Cloud::Retail::V2::Product::Type::VARIANT Type.VARIANT} otherwise an - # INVALID_ARGUMENT error is thrown. Should not set it for other types. A - # maximum of 1000 values are allowed. Otherwise, an INVALID_ARGUMENT error is - # return. - # @!attribute [rw] gtin - # @return [::String] - # The Global Trade Item Number (GTIN) of the product. - # - # This field must be a UTF-8 encoded string with a length limit of 128 - # characters. Otherwise, an INVALID_ARGUMENT error is returned. - # - # This field must be a Unigram. Otherwise, an INVALID_ARGUMENT error is - # returned. - # - # Corresponding properties: Google Merchant Center property - # [gtin](https://support.google.com/merchants/answer/6324461). - # Schema.org property - # [Product.isbn](https://schema.org/isbn), - # [Product.gtin8](https://schema.org/gtin8), - # [Product.gtin12](https://schema.org/gtin12), - # [Product.gtin13](https://schema.org/gtin13), or - # [Product.gtin14](https://schema.org/gtin14). - # - # If the value is not a valid GTIN, an INVALID_ARGUMENT error is returned. - # @!attribute [rw] categories - # @return [::Array<::String>] - # Product categories. This field is repeated for supporting one product - # belonging to several parallel categories. Strongly recommended using the - # full path for better search / recommendation quality. - # - # - # To represent full path of category, use '>' sign to separate different - # hierarchies. If '>' is part of the category name, replace it with - # other character(s). - # - # For example, if a shoes product belongs to both - # ["Shoes & Accessories" -> "Shoes"] and - # ["Sports & Fitness" -> "Athletic Clothing" -> "Shoes"], it could be - # represented as: - # - # "categories": [ - # "Shoes & Accessories > Shoes", - # "Sports & Fitness > Athletic Clothing > Shoes" - # ] - # - # Must be set for {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Type.PRIMARY} - # {::Google::Cloud::Retail::V2::Product Product} otherwise an INVALID_ARGUMENT - # error is returned. - # - # At most 250 values are allowed per - # {::Google::Cloud::Retail::V2::Product Product} unless overridden through the - # Google Cloud console. Empty values are not allowed. Each value must be a - # UTF-8 encoded string with a length limit of 5,000 characters. Otherwise, an - # INVALID_ARGUMENT error is returned. - # - # Corresponding properties: Google Merchant Center property - # [google_product_category][mc_google_product_category]. Schema.org property - # [Product.category] (https://schema.org/category). - # - # [mc_google_product_category]: - # https://support.google.com/merchants/answer/6324436 - # @!attribute [rw] title - # @return [::String] - # Required. Product title. - # - # This field must be a UTF-8 encoded string with a length limit of 1,000 - # characters. Otherwise, an INVALID_ARGUMENT error is returned. - # - # Corresponding properties: Google Merchant Center property - # [title](https://support.google.com/merchants/answer/6324415). Schema.org - # property [Product.name](https://schema.org/name). - # @!attribute [rw] brands - # @return [::Array<::String>] - # The brands of the product. - # - # A maximum of 30 brands are allowed unless overridden through the Google - # Cloud console. Each - # brand must be a UTF-8 encoded string with a length limit of 1,000 - # characters. Otherwise, an INVALID_ARGUMENT error is returned. - # - # Corresponding properties: Google Merchant Center property - # [brand](https://support.google.com/merchants/answer/6324351). Schema.org - # property [Product.brand](https://schema.org/brand). - # @!attribute [rw] description - # @return [::String] - # Product description. - # - # This field must be a UTF-8 encoded string with a length limit of 5,000 - # characters. Otherwise, an INVALID_ARGUMENT error is returned. - # - # Corresponding properties: Google Merchant Center property - # [description](https://support.google.com/merchants/answer/6324468). - # Schema.org property [Product.description](https://schema.org/description). - # @!attribute [rw] language_code - # @return [::String] - # Language of the title/description and other string attributes. Use language - # tags defined by [BCP 47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt). - # - # For product prediction, this field is ignored and the model automatically - # detects the text language. The {::Google::Cloud::Retail::V2::Product Product} - # can include text in different languages, but duplicating - # {::Google::Cloud::Retail::V2::Product Product}s to provide text in multiple - # languages can result in degraded model performance. - # - # For product search this field is in use. It defaults to "en-US" if unset. - # @!attribute [rw] attributes - # @return [::Google::Protobuf::Map{::String => ::Google::Cloud::Retail::V2::CustomAttribute}] - # Highly encouraged. Extra product attributes to be included. For example, - # for products, this could include the store name, vendor, style, color, etc. - # These are very strong signals for recommendation model, thus we highly - # recommend providing the attributes here. - # - # Features that can take on one of a limited number of possible values. Two - # types of features can be set are: - # - # Textual features. some examples would be the brand/maker of a product, or - # country of a customer. Numerical features. Some examples would be the - # height/weight of a product, or age of a customer. - # - # For example: `{ "vendor": {"text": ["vendor123", "vendor456"]}, - # "lengths_cm": \\{"numbers":[2.3, 15.4]}, "heights_cm": \\{"numbers":[8.1, 6.4]} - # }`. - # - # This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT - # error is returned: - # - # * Max entries count: 200. - # * The key must be a UTF-8 encoded string with a length limit of 128 - # characters. - # * For indexable attribute, the key must match the pattern: - # `[a-zA-Z0-9][a-zA-Z0-9_]*`. For example, `key0LikeThis` or - # `KEY_1_LIKE_THIS`. - # * For text attributes, at most 400 values are allowed. Empty values are not - # allowed. Each value must be a non-empty UTF-8 encoded string with a - # length limit of 256 characters. - # * For number attributes, at most 400 values are allowed. - # @!attribute [rw] tags - # @return [::Array<::String>] - # Custom tags associated with the product. - # - # At most 250 values are allowed per - # {::Google::Cloud::Retail::V2::Product Product}. This value must be a UTF-8 - # encoded string with a length limit of 1,000 characters. Otherwise, an - # INVALID_ARGUMENT error is returned. - # - # This tag can be used for filtering recommendation results by passing the - # tag as part of the - # {::Google::Cloud::Retail::V2::PredictRequest#filter PredictRequest.filter}. - # - # Corresponding properties: Google Merchant Center property - # [custom_label_0–4](https://support.google.com/merchants/answer/6324473). - # @!attribute [rw] price_info - # @return [::Google::Cloud::Retail::V2::PriceInfo] - # Product price and cost information. - # - # Corresponding properties: Google Merchant Center property - # [price](https://support.google.com/merchants/answer/6324371). - # @!attribute [rw] rating - # @return [::Google::Cloud::Retail::V2::Rating] - # The rating of this product. - # @!attribute [rw] available_time - # @return [::Google::Protobuf::Timestamp] - # The timestamp when this {::Google::Cloud::Retail::V2::Product Product} becomes - # available for - # {::Google::Cloud::Retail::V2::SearchService::Client#search SearchService.Search}. Note - # that this is only applicable to - # {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Type.PRIMARY} and - # {::Google::Cloud::Retail::V2::Product::Type::COLLECTION Type.COLLECTION}, and - # ignored for {::Google::Cloud::Retail::V2::Product::Type::VARIANT Type.VARIANT}. - # @!attribute [rw] availability - # @return [::Google::Cloud::Retail::V2::Product::Availability] - # The online availability of the {::Google::Cloud::Retail::V2::Product Product}. - # Default to - # {::Google::Cloud::Retail::V2::Product::Availability::IN_STOCK Availability.IN_STOCK}. - # - # For primary products with variants set the availability of the primary as - # {::Google::Cloud::Retail::V2::Product::Availability::OUT_OF_STOCK Availability.OUT_OF_STOCK} - # and set the true availability at the variant level. This way the primary - # product will be considered "in stock" as long as it has at least one - # variant in stock. - # - # For primary products with no variants set the true availability at the - # primary level. - # - # Corresponding properties: Google Merchant Center property - # [availability](https://support.google.com/merchants/answer/6324448). - # Schema.org property [Offer.availability](https://schema.org/availability). - # @!attribute [rw] available_quantity - # @return [::Google::Protobuf::Int32Value] - # The available quantity of the item. - # @!attribute [rw] fulfillment_info - # @return [::Array<::Google::Cloud::Retail::V2::FulfillmentInfo>] - # Fulfillment information, such as the store IDs for in-store pickup or - # region IDs for different shipping methods. - # - # All the elements must have distinct - # {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type}. - # Otherwise, an INVALID_ARGUMENT error is returned. - # @!attribute [rw] uri - # @return [::String] - # Canonical URL directly linking to the product detail page. - # - # It is strongly recommended to provide a valid uri for the product, - # otherwise the service performance could be significantly degraded. - # - # This field must be a UTF-8 encoded string with a length limit of 5,000 - # characters. Otherwise, an INVALID_ARGUMENT error is returned. - # - # Corresponding properties: Google Merchant Center property - # [link](https://support.google.com/merchants/answer/6324416). Schema.org - # property [Offer.url](https://schema.org/url). - # @!attribute [rw] images - # @return [::Array<::Google::Cloud::Retail::V2::Image>] - # Product images for the product. We highly recommend putting the main - # image first. - # - # A maximum of 300 images are allowed. - # - # Corresponding properties: Google Merchant Center property - # [image_link](https://support.google.com/merchants/answer/6324350). - # Schema.org property [Product.image](https://schema.org/image). - # @!attribute [rw] audience - # @return [::Google::Cloud::Retail::V2::Audience] - # The target group associated with a given audience (e.g. male, veterans, - # car owners, musicians, etc.) of the product. - # @!attribute [rw] color_info - # @return [::Google::Cloud::Retail::V2::ColorInfo] - # The color of the product. - # - # Corresponding properties: Google Merchant Center property - # [color](https://support.google.com/merchants/answer/6324487). Schema.org - # property [Product.color](https://schema.org/color). - # @!attribute [rw] sizes - # @return [::Array<::String>] - # The size of the product. To represent different size systems or size types, - # consider using this format: [[[size_system:]size_type:]size_value]. - # - # For example, in "US:MENS:M", "US" represents size system; "MENS" represents - # size type; "M" represents size value. In "GIRLS:27", size system is empty; - # "GIRLS" represents size type; "27" represents size value. In "32 inches", - # both size system and size type are empty, while size value is "32 inches". - # - # A maximum of 20 values are allowed per - # {::Google::Cloud::Retail::V2::Product Product}. Each value must be a UTF-8 - # encoded string with a length limit of 128 characters. Otherwise, an - # INVALID_ARGUMENT error is returned. - # - # Corresponding properties: Google Merchant Center property - # [size](https://support.google.com/merchants/answer/6324492), - # [size_type](https://support.google.com/merchants/answer/6324497), and - # [size_system](https://support.google.com/merchants/answer/6324502). - # Schema.org property [Product.size](https://schema.org/size). - # @!attribute [rw] materials - # @return [::Array<::String>] - # The material of the product. For example, "leather", "wooden". - # - # A maximum of 20 values are allowed. Each value must be a UTF-8 encoded - # string with a length limit of 200 characters. Otherwise, an - # INVALID_ARGUMENT error is returned. - # - # Corresponding properties: Google Merchant Center property - # [material](https://support.google.com/merchants/answer/6324410). Schema.org - # property [Product.material](https://schema.org/material). - # @!attribute [rw] patterns - # @return [::Array<::String>] - # The pattern or graphic print of the product. For example, "striped", "polka - # dot", "paisley". - # - # A maximum of 20 values are allowed per - # {::Google::Cloud::Retail::V2::Product Product}. Each value must be a UTF-8 - # encoded string with a length limit of 128 characters. Otherwise, an - # INVALID_ARGUMENT error is returned. - # - # Corresponding properties: Google Merchant Center property - # [pattern](https://support.google.com/merchants/answer/6324483). Schema.org - # property [Product.pattern](https://schema.org/pattern). - # @!attribute [rw] conditions - # @return [::Array<::String>] - # The condition of the product. Strongly encouraged to use the standard - # values: "new", "refurbished", "used". - # - # A maximum of 1 value is allowed per - # {::Google::Cloud::Retail::V2::Product Product}. Each value must be a UTF-8 - # encoded string with a length limit of 128 characters. Otherwise, an - # INVALID_ARGUMENT error is returned. - # - # Corresponding properties: Google Merchant Center property - # [condition](https://support.google.com/merchants/answer/6324469). - # Schema.org property - # [Offer.itemCondition](https://schema.org/itemCondition). - # @!attribute [rw] promotions - # @return [::Array<::Google::Cloud::Retail::V2::Promotion>] - # The promotions applied to the product. A maximum of 10 values are allowed - # per {::Google::Cloud::Retail::V2::Product Product}. Only - # {::Google::Cloud::Retail::V2::Promotion#promotion_id Promotion.promotion_id} - # will be used, other fields will be ignored if set. - # @!attribute [rw] publish_time - # @return [::Google::Protobuf::Timestamp] - # The timestamp when the product is published by the retailer for the first - # time, which indicates the freshness of the products. Note that this field - # is different from - # {::Google::Cloud::Retail::V2::Product#available_time available_time}, given it - # purely describes product freshness regardless of when it is available on - # search and recommendation. - # @!attribute [rw] retrievable_fields - # @deprecated This field is deprecated and may be removed in the next major version update. - # @return [::Google::Protobuf::FieldMask] - # Indicates which fields in the {::Google::Cloud::Retail::V2::Product Product}s - # are returned in {::Google::Cloud::Retail::V2::SearchResponse SearchResponse}. - # - # Supported fields for all {::Google::Cloud::Retail::V2::Product#type type}s: - # - # * {::Google::Cloud::Retail::V2::Product#audience audience} - # * {::Google::Cloud::Retail::V2::Product#availability availability} - # * {::Google::Cloud::Retail::V2::Product#brands brands} - # * {::Google::Cloud::Retail::V2::Product#color_info color_info} - # * {::Google::Cloud::Retail::V2::Product#conditions conditions} - # * {::Google::Cloud::Retail::V2::Product#gtin gtin} - # * {::Google::Cloud::Retail::V2::Product#materials materials} - # * {::Google::Cloud::Retail::V2::Product#name name} - # * {::Google::Cloud::Retail::V2::Product#patterns patterns} - # * {::Google::Cloud::Retail::V2::Product#price_info price_info} - # * {::Google::Cloud::Retail::V2::Product#rating rating} - # * {::Google::Cloud::Retail::V2::Product#sizes sizes} - # * {::Google::Cloud::Retail::V2::Product#title title} - # * {::Google::Cloud::Retail::V2::Product#uri uri} - # - # Supported fields only for - # {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Type.PRIMARY} and - # {::Google::Cloud::Retail::V2::Product::Type::COLLECTION Type.COLLECTION}: - # - # * {::Google::Cloud::Retail::V2::Product#categories categories} - # * {::Google::Cloud::Retail::V2::Product#description description} - # * {::Google::Cloud::Retail::V2::Product#images images} - # - # Supported fields only for - # {::Google::Cloud::Retail::V2::Product::Type::VARIANT Type.VARIANT}: - # - # * Only the first image in {::Google::Cloud::Retail::V2::Product#images images} - # - # To mark {::Google::Cloud::Retail::V2::Product#attributes attributes} as - # retrievable, include paths of the form "attributes.key" where "key" is the - # key of a custom attribute, as specified in - # {::Google::Cloud::Retail::V2::Product#attributes attributes}. - # - # For {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Type.PRIMARY} and - # {::Google::Cloud::Retail::V2::Product::Type::COLLECTION Type.COLLECTION}, the - # following fields are always returned in - # {::Google::Cloud::Retail::V2::SearchResponse SearchResponse} by default: - # - # * {::Google::Cloud::Retail::V2::Product#name name} - # - # For {::Google::Cloud::Retail::V2::Product::Type::VARIANT Type.VARIANT}, the - # following fields are always returned in by default: - # - # * {::Google::Cloud::Retail::V2::Product#name name} - # * {::Google::Cloud::Retail::V2::Product#color_info color_info} - # - # Note: Returning more fields in - # {::Google::Cloud::Retail::V2::SearchResponse SearchResponse} can increase - # response payload size and serving latency. - # - # This field is deprecated. Use the retrievable site-wide control instead. - # @!attribute [r] variants - # @return [::Array<::Google::Cloud::Retail::V2::Product>] - # Output only. Product variants grouped together on primary product which - # share similar product attributes. It's automatically grouped by - # {::Google::Cloud::Retail::V2::Product#primary_product_id primary_product_id} for - # all the product variants. Only populated for - # {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Type.PRIMARY} - # {::Google::Cloud::Retail::V2::Product Product}s. - # - # Note: This field is OUTPUT_ONLY for - # {::Google::Cloud::Retail::V2::ProductService::Client#get_product ProductService.GetProduct}. - # Do not set this field in API requests. - # @!attribute [r] local_inventories - # @return [::Array<::Google::Cloud::Retail::V2::LocalInventory>] - # Output only. A list of local inventories specific to different places. - # - # This field can be managed by - # {::Google::Cloud::Retail::V2::ProductService::Client#add_local_inventories ProductService.AddLocalInventories} - # and - # {::Google::Cloud::Retail::V2::ProductService::Client#remove_local_inventories ProductService.RemoveLocalInventories} - # APIs if fine-grained, high-volume updates are necessary. - class Product - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # @!attribute [rw] key - # @return [::String] - # @!attribute [rw] value - # @return [::Google::Cloud::Retail::V2::CustomAttribute] - class AttributesEntry - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # The type of this product. - module Type - # Default value. Default to - # {::Google::Cloud::Retail::V2::ProductLevelConfig#ingestion_product_type Catalog.product_level_config.ingestion_product_type} - # if unset. - TYPE_UNSPECIFIED = 0 - - # The primary type. - # - # As the primary unit for predicting, indexing and search serving, a - # {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Type.PRIMARY} - # {::Google::Cloud::Retail::V2::Product Product} is grouped with multiple - # {::Google::Cloud::Retail::V2::Product::Type::VARIANT Type.VARIANT} - # {::Google::Cloud::Retail::V2::Product Product}s. - PRIMARY = 1 - - # The variant type. - # - # {::Google::Cloud::Retail::V2::Product::Type::VARIANT Type.VARIANT} - # {::Google::Cloud::Retail::V2::Product Product}s usually share some common - # attributes on the same - # {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Type.PRIMARY} - # {::Google::Cloud::Retail::V2::Product Product}s, but they have variant - # attributes like different colors, sizes and prices, etc. - VARIANT = 2 - - # The collection type. Collection products are bundled - # {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Type.PRIMARY} - # {::Google::Cloud::Retail::V2::Product Product}s or - # {::Google::Cloud::Retail::V2::Product::Type::VARIANT Type.VARIANT} - # {::Google::Cloud::Retail::V2::Product Product}s that are sold together, such - # as a jewelry set with necklaces, earrings and rings, etc. - COLLECTION = 3 - end - - # Product availability. If this field is unspecified, the product is - # assumed to be in stock. - module Availability - # Default product availability. Default to - # {::Google::Cloud::Retail::V2::Product::Availability::IN_STOCK Availability.IN_STOCK} - # if unset. - AVAILABILITY_UNSPECIFIED = 0 - - # Product in stock. - IN_STOCK = 1 - - # Product out of stock. - OUT_OF_STOCK = 2 - - # Product that is in pre-order state. - PREORDER = 3 - - # Product that is back-ordered (i.e. temporarily out of stock). - BACKORDER = 4 - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/product_service.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/product_service.rb deleted file mode 100644 index c6fb71059137..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/product_service.rb +++ /dev/null @@ -1,653 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Cloud - module Retail - module V2 - # Request message for - # {::Google::Cloud::Retail::V2::ProductService::Client#create_product ProductService.CreateProduct} - # method. - # @!attribute [rw] parent - # @return [::String] - # Required. The parent catalog resource name, such as - # `projects/*/locations/global/catalogs/default_catalog/branches/default_branch`. - # @!attribute [rw] product - # @return [::Google::Cloud::Retail::V2::Product] - # Required. The {::Google::Cloud::Retail::V2::Product Product} to create. - # @!attribute [rw] product_id - # @return [::String] - # Required. The ID to use for the {::Google::Cloud::Retail::V2::Product Product}, - # which will become the final component of the - # {::Google::Cloud::Retail::V2::Product#name Product.name}. - # - # If the caller does not have permission to create the - # {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it - # exists, a PERMISSION_DENIED error is returned. - # - # This field must be unique among all - # {::Google::Cloud::Retail::V2::Product Product}s with the same - # {::Google::Cloud::Retail::V2::CreateProductRequest#parent parent}. Otherwise, an - # ALREADY_EXISTS error is returned. - # - # This field must be a UTF-8 encoded string with a length limit of 128 - # characters. Otherwise, an INVALID_ARGUMENT error is returned. - class CreateProductRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request message for - # {::Google::Cloud::Retail::V2::ProductService::Client#get_product ProductService.GetProduct} - # method. - # @!attribute [rw] name - # @return [::String] - # Required. Full resource name of {::Google::Cloud::Retail::V2::Product Product}, - # such as - # `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. - # - # If the caller does not have permission to access the - # {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it - # exists, a PERMISSION_DENIED error is returned. - # - # If the requested {::Google::Cloud::Retail::V2::Product Product} does not exist, - # a NOT_FOUND error is returned. - class GetProductRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request message for - # {::Google::Cloud::Retail::V2::ProductService::Client#update_product ProductService.UpdateProduct} - # method. - # @!attribute [rw] product - # @return [::Google::Cloud::Retail::V2::Product] - # Required. The product to update/create. - # - # If the caller does not have permission to update the - # {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it - # exists, a PERMISSION_DENIED error is returned. - # - # If the {::Google::Cloud::Retail::V2::Product Product} to update does not exist - # and - # {::Google::Cloud::Retail::V2::UpdateProductRequest#allow_missing allow_missing} - # is not set, a NOT_FOUND error is returned. - # @!attribute [rw] update_mask - # @return [::Google::Protobuf::FieldMask] - # Indicates which fields in the provided - # {::Google::Cloud::Retail::V2::Product Product} to update. The immutable and - # output only fields are NOT supported. If not set, all supported fields (the - # fields that are neither immutable nor output only) are updated. - # - # If an unsupported or unknown field is provided, an INVALID_ARGUMENT error - # is returned. - # - # The attribute key can be updated by setting the mask path as - # "attributes.$\\{key_name}". If a key name is present in the mask but not in - # the patching product from the request, this key will be deleted after the - # update. - # @!attribute [rw] allow_missing - # @return [::Boolean] - # If set to true, and the {::Google::Cloud::Retail::V2::Product Product} is not - # found, a new {::Google::Cloud::Retail::V2::Product Product} will be created. In - # this situation, `update_mask` is ignored. - class UpdateProductRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request message for - # {::Google::Cloud::Retail::V2::ProductService::Client#delete_product ProductService.DeleteProduct} - # method. - # @!attribute [rw] name - # @return [::String] - # Required. Full resource name of {::Google::Cloud::Retail::V2::Product Product}, - # such as - # `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. - # - # If the caller does not have permission to delete the - # {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it - # exists, a PERMISSION_DENIED error is returned. - # - # If the {::Google::Cloud::Retail::V2::Product Product} to delete does not exist, - # a NOT_FOUND error is returned. - # - # The {::Google::Cloud::Retail::V2::Product Product} to delete can neither be a - # {::Google::Cloud::Retail::V2::Product::Type::COLLECTION Product.Type.COLLECTION} - # {::Google::Cloud::Retail::V2::Product Product} member nor a - # {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Product.Type.PRIMARY} - # {::Google::Cloud::Retail::V2::Product Product} with more than one - # {::Google::Cloud::Retail::V2::Product::Type::VARIANT variants}. Otherwise, an - # INVALID_ARGUMENT error is returned. - # - # All inventory information for the named - # {::Google::Cloud::Retail::V2::Product Product} will be deleted. - class DeleteProductRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request message for - # {::Google::Cloud::Retail::V2::ProductService::Client#list_products ProductService.ListProducts} - # method. - # @!attribute [rw] parent - # @return [::String] - # Required. The parent branch resource name, such as - # `projects/*/locations/global/catalogs/default_catalog/branches/0`. Use - # `default_branch` as the branch ID, to list products under the default - # branch. - # - # If the caller does not have permission to list - # {::Google::Cloud::Retail::V2::Product Product}s under this branch, regardless of - # whether or not this branch exists, a PERMISSION_DENIED error is returned. - # @!attribute [rw] page_size - # @return [::Integer] - # Maximum number of {::Google::Cloud::Retail::V2::Product Product}s to return. If - # unspecified, defaults to 100. The maximum allowed value is 1000. Values - # above 1000 will be coerced to 1000. - # - # If this field is negative, an INVALID_ARGUMENT error is returned. - # @!attribute [rw] page_token - # @return [::String] - # A page token - # {::Google::Cloud::Retail::V2::ListProductsResponse#next_page_token ListProductsResponse.next_page_token}, - # received from a previous - # {::Google::Cloud::Retail::V2::ProductService::Client#list_products ProductService.ListProducts} - # call. Provide this to retrieve the subsequent page. - # - # When paginating, all other parameters provided to - # {::Google::Cloud::Retail::V2::ProductService::Client#list_products ProductService.ListProducts} - # must match the call that provided the page token. Otherwise, an - # INVALID_ARGUMENT error is returned. - # @!attribute [rw] filter - # @return [::String] - # A filter to apply on the list results. Supported features: - # - # * List all the products under the parent branch if - # {::Google::Cloud::Retail::V2::ListProductsRequest#filter filter} is unset. - # * List {::Google::Cloud::Retail::V2::Product::Type::VARIANT Product.Type.VARIANT} - # {::Google::Cloud::Retail::V2::Product Product}s sharing the same - # {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Product.Type.PRIMARY} - # {::Google::Cloud::Retail::V2::Product Product}. For example: - # `primary_product_id = "some_product_id"` - # * List {::Google::Cloud::Retail::V2::Product Product}s bundled in a - # {::Google::Cloud::Retail::V2::Product::Type::COLLECTION Product.Type.COLLECTION} - # {::Google::Cloud::Retail::V2::Product Product}. - # For example: - # `collection_product_id = "some_product_id"` - # * List {::Google::Cloud::Retail::V2::Product Product}s with a partibular type. - # For example: - # `type = "PRIMARY"` - # `type = "VARIANT"` - # `type = "COLLECTION"` - # - # If the field is unrecognizable, an INVALID_ARGUMENT error is returned. - # - # If the specified - # {::Google::Cloud::Retail::V2::Product::Type::PRIMARY Product.Type.PRIMARY} - # {::Google::Cloud::Retail::V2::Product Product} or - # {::Google::Cloud::Retail::V2::Product::Type::COLLECTION Product.Type.COLLECTION} - # {::Google::Cloud::Retail::V2::Product Product} does not exist, a NOT_FOUND error - # is returned. - # @!attribute [rw] read_mask - # @return [::Google::Protobuf::FieldMask] - # The fields of {::Google::Cloud::Retail::V2::Product Product} to return in the - # responses. If not set or empty, the following fields are returned: - # - # * {::Google::Cloud::Retail::V2::Product#name Product.name} - # * {::Google::Cloud::Retail::V2::Product#id Product.id} - # * {::Google::Cloud::Retail::V2::Product#title Product.title} - # * {::Google::Cloud::Retail::V2::Product#uri Product.uri} - # * {::Google::Cloud::Retail::V2::Product#images Product.images} - # * {::Google::Cloud::Retail::V2::Product#price_info Product.price_info} - # * {::Google::Cloud::Retail::V2::Product#brands Product.brands} - # - # If "*" is provided, all fields are returned. - # {::Google::Cloud::Retail::V2::Product#name Product.name} is always returned no - # matter what mask is set. - # - # If an unsupported or unknown field is provided, an INVALID_ARGUMENT error - # is returned. - class ListProductsRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Response message for - # {::Google::Cloud::Retail::V2::ProductService::Client#list_products ProductService.ListProducts} - # method. - # @!attribute [rw] products - # @return [::Array<::Google::Cloud::Retail::V2::Product>] - # The {::Google::Cloud::Retail::V2::Product Product}s. - # @!attribute [rw] next_page_token - # @return [::String] - # A token that can be sent as - # {::Google::Cloud::Retail::V2::ListProductsRequest#page_token ListProductsRequest.page_token} - # to retrieve the next page. If this field is omitted, there are no - # subsequent pages. - class ListProductsResponse - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request message for - # {::Google::Cloud::Retail::V2::ProductService::Client#set_inventory ProductService.SetInventory} - # method. - # @!attribute [rw] inventory - # @return [::Google::Cloud::Retail::V2::Product] - # Required. The inventory information to update. The allowable fields to - # update are: - # - # * {::Google::Cloud::Retail::V2::Product#price_info Product.price_info} - # * {::Google::Cloud::Retail::V2::Product#availability Product.availability} - # * {::Google::Cloud::Retail::V2::Product#available_quantity Product.available_quantity} - # * {::Google::Cloud::Retail::V2::Product#fulfillment_info Product.fulfillment_info} - # The updated inventory fields must be specified in - # {::Google::Cloud::Retail::V2::SetInventoryRequest#set_mask SetInventoryRequest.set_mask}. - # - # If - # {::Google::Cloud::Retail::V2::Product#name SetInventoryRequest.inventory.name} - # is empty or invalid, an INVALID_ARGUMENT error is returned. - # - # If the caller does not have permission to update the - # {::Google::Cloud::Retail::V2::Product Product} named in - # {::Google::Cloud::Retail::V2::Product#name Product.name}, regardless of whether - # or not it exists, a PERMISSION_DENIED error is returned. - # - # If the {::Google::Cloud::Retail::V2::Product Product} to update does not have - # existing inventory information, the provided inventory information will be - # inserted. - # - # If the {::Google::Cloud::Retail::V2::Product Product} to update has existing - # inventory information, the provided inventory information will be merged - # while respecting the last update time for each inventory field, using the - # provided or default value for - # {::Google::Cloud::Retail::V2::SetInventoryRequest#set_time SetInventoryRequest.set_time}. - # - # The caller can replace place IDs for a subset of fulfillment types in the - # following ways: - # - # * Adds "fulfillment_info" in - # {::Google::Cloud::Retail::V2::SetInventoryRequest#set_mask SetInventoryRequest.set_mask} - # * Specifies only the desired fulfillment types and corresponding place IDs - # to update in - # {::Google::Cloud::Retail::V2::Product#fulfillment_info SetInventoryRequest.inventory.fulfillment_info} - # - # The caller can clear all place IDs from a subset of fulfillment types in - # the following ways: - # - # * Adds "fulfillment_info" in - # {::Google::Cloud::Retail::V2::SetInventoryRequest#set_mask SetInventoryRequest.set_mask} - # * Specifies only the desired fulfillment types to clear in - # {::Google::Cloud::Retail::V2::Product#fulfillment_info SetInventoryRequest.inventory.fulfillment_info} - # * Checks that only the desired fulfillment info types have empty - # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids SetInventoryRequest.inventory.fulfillment_info.place_ids} - # - # The last update time is recorded for the following inventory fields: - # * {::Google::Cloud::Retail::V2::Product#price_info Product.price_info} - # * {::Google::Cloud::Retail::V2::Product#availability Product.availability} - # * {::Google::Cloud::Retail::V2::Product#available_quantity Product.available_quantity} - # * {::Google::Cloud::Retail::V2::Product#fulfillment_info Product.fulfillment_info} - # - # If a full overwrite of inventory information while ignoring timestamps is - # needed, - # {::Google::Cloud::Retail::V2::ProductService::Client#update_product ProductService.UpdateProduct} - # should be invoked instead. - # @!attribute [rw] set_mask - # @return [::Google::Protobuf::FieldMask] - # Indicates which inventory fields in the provided - # {::Google::Cloud::Retail::V2::Product Product} to update. - # - # At least one field must be provided. - # - # If an unsupported or unknown field is provided, an INVALID_ARGUMENT error - # is returned and the entire update will be ignored. - # @!attribute [rw] set_time - # @return [::Google::Protobuf::Timestamp] - # The time when the request is issued, used to prevent - # out-of-order updates on inventory fields with the last update time - # recorded. If not provided, the internal system time will be used. - # @!attribute [rw] allow_missing - # @return [::Boolean] - # If set to true, and the {::Google::Cloud::Retail::V2::Product Product} with name - # {::Google::Cloud::Retail::V2::Product#name Product.name} is not found, the - # inventory update will still be processed and retained for at most 1 day - # until the {::Google::Cloud::Retail::V2::Product Product} is created. If set to - # false, a NOT_FOUND error is returned if the - # {::Google::Cloud::Retail::V2::Product Product} is not found. - class SetInventoryRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Metadata related to the progress of the SetInventory operation. - # Currently empty because there is no meaningful metadata populated from the - # {::Google::Cloud::Retail::V2::ProductService::Client#set_inventory ProductService.SetInventory} - # method. - class SetInventoryMetadata - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Response of the SetInventoryRequest. Currently empty because - # there is no meaningful response populated from the - # {::Google::Cloud::Retail::V2::ProductService::Client#set_inventory ProductService.SetInventory} - # method. - class SetInventoryResponse - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request message for - # {::Google::Cloud::Retail::V2::ProductService::Client#add_fulfillment_places ProductService.AddFulfillmentPlaces} - # method. - # @!attribute [rw] product - # @return [::String] - # Required. Full resource name of {::Google::Cloud::Retail::V2::Product Product}, - # such as - # `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. - # - # If the caller does not have permission to access the - # {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it - # exists, a PERMISSION_DENIED error is returned. - # @!attribute [rw] type - # @return [::String] - # Required. The fulfillment type, including commonly used types (such as - # pickup in store and same day delivery), and custom types. - # - # Supported values: - # - # * "pickup-in-store" - # * "ship-to-store" - # * "same-day-delivery" - # * "next-day-delivery" - # * "custom-type-1" - # * "custom-type-2" - # * "custom-type-3" - # * "custom-type-4" - # * "custom-type-5" - # - # If this field is set to an invalid value other than these, an - # INVALID_ARGUMENT error is returned. - # - # This field directly corresponds to - # {::Google::Cloud::Retail::V2::FulfillmentInfo#type Product.fulfillment_info.type}. - # @!attribute [rw] place_ids - # @return [::Array<::String>] - # Required. The IDs for this - # {::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest#type type}, such as - # the store IDs for "pickup-in-store" or the region IDs for - # "same-day-delivery" to be added for this - # {::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest#type type}. Duplicate - # IDs will be automatically ignored. - # - # At least 1 value is required, and a maximum of 2000 values are allowed. - # Each value must be a string with a length limit of 10 characters, matching - # the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an - # INVALID_ARGUMENT error is returned. - # - # If the total number of place IDs exceeds 2000 for this - # {::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest#type type} after - # adding, then the update will be rejected. - # @!attribute [rw] add_time - # @return [::Google::Protobuf::Timestamp] - # The time when the fulfillment updates are issued, used to prevent - # out-of-order updates on fulfillment information. If not provided, the - # internal system time will be used. - # @!attribute [rw] allow_missing - # @return [::Boolean] - # If set to true, and the {::Google::Cloud::Retail::V2::Product Product} is not - # found, the fulfillment information will still be processed and retained for - # at most 1 day and processed once the - # {::Google::Cloud::Retail::V2::Product Product} is created. If set to false, a - # NOT_FOUND error is returned if the - # {::Google::Cloud::Retail::V2::Product Product} is not found. - class AddFulfillmentPlacesRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Metadata related to the progress of the AddFulfillmentPlaces operation. - # Currently empty because there is no meaningful metadata populated from the - # {::Google::Cloud::Retail::V2::ProductService::Client#add_fulfillment_places ProductService.AddFulfillmentPlaces} - # method. - class AddFulfillmentPlacesMetadata - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Response of the AddFulfillmentPlacesRequest. Currently empty because - # there is no meaningful response populated from the - # {::Google::Cloud::Retail::V2::ProductService::Client#add_fulfillment_places ProductService.AddFulfillmentPlaces} - # method. - class AddFulfillmentPlacesResponse - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request message for - # {::Google::Cloud::Retail::V2::ProductService::Client#add_local_inventories ProductService.AddLocalInventories} - # method. - # @!attribute [rw] product - # @return [::String] - # Required. Full resource name of {::Google::Cloud::Retail::V2::Product Product}, - # such as - # `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. - # - # If the caller does not have permission to access the - # {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it - # exists, a PERMISSION_DENIED error is returned. - # @!attribute [rw] local_inventories - # @return [::Array<::Google::Cloud::Retail::V2::LocalInventory>] - # Required. A list of inventory information at difference places. Each place - # is identified by its place ID. At most 3000 inventories are allowed per - # request. - # @!attribute [rw] add_mask - # @return [::Google::Protobuf::FieldMask] - # Indicates which inventory fields in the provided list of - # {::Google::Cloud::Retail::V2::LocalInventory LocalInventory} to update. The - # field is updated to the provided value. - # - # If a field is set while the place does not have a previous local inventory, - # the local inventory at that store is created. - # - # If a field is set while the value of that field is not provided, the - # original field value, if it exists, is deleted. - # - # If the mask is not set or set with empty paths, all inventory fields will - # be updated. - # - # If an unsupported or unknown field is provided, an INVALID_ARGUMENT error - # is returned and the entire update will be ignored. - # @!attribute [rw] add_time - # @return [::Google::Protobuf::Timestamp] - # The time when the inventory updates are issued. Used to prevent - # out-of-order updates on local inventory fields. If not provided, the - # internal system time will be used. - # @!attribute [rw] allow_missing - # @return [::Boolean] - # If set to true, and the {::Google::Cloud::Retail::V2::Product Product} is not - # found, the local inventory will still be processed and retained for at most - # 1 day and processed once the {::Google::Cloud::Retail::V2::Product Product} is - # created. If set to false, a NOT_FOUND error is returned if the - # {::Google::Cloud::Retail::V2::Product Product} is not found. - class AddLocalInventoriesRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Metadata related to the progress of the AddLocalInventories operation. - # Currently empty because there is no meaningful metadata populated from the - # {::Google::Cloud::Retail::V2::ProductService::Client#add_local_inventories ProductService.AddLocalInventories} - # method. - class AddLocalInventoriesMetadata - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Response of the - # {::Google::Cloud::Retail::V2::ProductService::Client#add_local_inventories ProductService.AddLocalInventories} - # API. Currently empty because there is no meaningful response populated from - # the - # {::Google::Cloud::Retail::V2::ProductService::Client#add_local_inventories ProductService.AddLocalInventories} - # method. - class AddLocalInventoriesResponse - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request message for - # {::Google::Cloud::Retail::V2::ProductService::Client#remove_local_inventories ProductService.RemoveLocalInventories} - # method. - # @!attribute [rw] product - # @return [::String] - # Required. Full resource name of {::Google::Cloud::Retail::V2::Product Product}, - # such as - # `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. - # - # If the caller does not have permission to access the - # {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it - # exists, a PERMISSION_DENIED error is returned. - # @!attribute [rw] place_ids - # @return [::Array<::String>] - # Required. A list of place IDs to have their inventory deleted. - # At most 3000 place IDs are allowed per request. - # @!attribute [rw] remove_time - # @return [::Google::Protobuf::Timestamp] - # The time when the inventory deletions are issued. Used to prevent - # out-of-order updates and deletions on local inventory fields. If not - # provided, the internal system time will be used. - # @!attribute [rw] allow_missing - # @return [::Boolean] - # If set to true, and the {::Google::Cloud::Retail::V2::Product Product} is not - # found, the local inventory removal request will still be processed and - # retained for at most 1 day and processed once the - # {::Google::Cloud::Retail::V2::Product Product} is created. If set to false, a - # NOT_FOUND error is returned if the - # {::Google::Cloud::Retail::V2::Product Product} is not found. - class RemoveLocalInventoriesRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Metadata related to the progress of the RemoveLocalInventories operation. - # Currently empty because there is no meaningful metadata populated from the - # {::Google::Cloud::Retail::V2::ProductService::Client#remove_local_inventories ProductService.RemoveLocalInventories} - # method. - class RemoveLocalInventoriesMetadata - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Response of the - # {::Google::Cloud::Retail::V2::ProductService::Client#remove_local_inventories ProductService.RemoveLocalInventories} - # API. Currently empty because there is no meaningful response populated from - # the - # {::Google::Cloud::Retail::V2::ProductService::Client#remove_local_inventories ProductService.RemoveLocalInventories} - # method. - class RemoveLocalInventoriesResponse - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request message for - # {::Google::Cloud::Retail::V2::ProductService::Client#remove_fulfillment_places ProductService.RemoveFulfillmentPlaces} - # method. - # @!attribute [rw] product - # @return [::String] - # Required. Full resource name of {::Google::Cloud::Retail::V2::Product Product}, - # such as - # `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. - # - # If the caller does not have permission to access the - # {::Google::Cloud::Retail::V2::Product Product}, regardless of whether or not it - # exists, a PERMISSION_DENIED error is returned. - # @!attribute [rw] type - # @return [::String] - # Required. The fulfillment type, including commonly used types (such as - # pickup in store and same day delivery), and custom types. - # - # Supported values: - # - # * "pickup-in-store" - # * "ship-to-store" - # * "same-day-delivery" - # * "next-day-delivery" - # * "custom-type-1" - # * "custom-type-2" - # * "custom-type-3" - # * "custom-type-4" - # * "custom-type-5" - # - # If this field is set to an invalid value other than these, an - # INVALID_ARGUMENT error is returned. - # - # This field directly corresponds to - # {::Google::Cloud::Retail::V2::FulfillmentInfo#type Product.fulfillment_info.type}. - # @!attribute [rw] place_ids - # @return [::Array<::String>] - # Required. The IDs for this - # {::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest#type type}, such as - # the store IDs for "pickup-in-store" or the region IDs for - # "same-day-delivery", to be removed for this - # {::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest#type type}. - # - # At least 1 value is required, and a maximum of 2000 values are allowed. - # Each value must be a string with a length limit of 10 characters, matching - # the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an - # INVALID_ARGUMENT error is returned. - # @!attribute [rw] remove_time - # @return [::Google::Protobuf::Timestamp] - # The time when the fulfillment updates are issued, used to prevent - # out-of-order updates on fulfillment information. If not provided, the - # internal system time will be used. - # @!attribute [rw] allow_missing - # @return [::Boolean] - # If set to true, and the {::Google::Cloud::Retail::V2::Product Product} is not - # found, the fulfillment information will still be processed and retained for - # at most 1 day and processed once the - # {::Google::Cloud::Retail::V2::Product Product} is created. If set to false, a - # NOT_FOUND error is returned if the - # {::Google::Cloud::Retail::V2::Product Product} is not found. - class RemoveFulfillmentPlacesRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Metadata related to the progress of the RemoveFulfillmentPlaces operation. - # Currently empty because there is no meaningful metadata populated from the - # {::Google::Cloud::Retail::V2::ProductService::Client#remove_fulfillment_places ProductService.RemoveFulfillmentPlaces} - # method. - class RemoveFulfillmentPlacesMetadata - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Response of the RemoveFulfillmentPlacesRequest. Currently empty because there - # is no meaningful response populated from the - # {::Google::Cloud::Retail::V2::ProductService::Client#remove_fulfillment_places ProductService.RemoveFulfillmentPlaces} - # method. - class RemoveFulfillmentPlacesResponse - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/promotion.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/promotion.rb deleted file mode 100644 index 1b9a47b22ebd..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/promotion.rb +++ /dev/null @@ -1,43 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Cloud - module Retail - module V2 - # Promotion information. - # @!attribute [rw] promotion_id - # @return [::String] - # ID of the promotion. For example, "free gift". - # - # The value must be a UTF-8 encoded string with a length limit of 128 - # characters, and match the pattern: `[a-zA-Z][a-zA-Z0-9_]*`. For example, - # id0LikeThis or ID_1_LIKE_THIS. Otherwise, an INVALID_ARGUMENT error is - # returned. - # - # Corresponds to Google Merchant Center property - # [promotion_id](https://support.google.com/merchants/answer/7050148). - class Promotion - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/purge_config.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/purge_config.rb deleted file mode 100644 index cfeb05692659..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/purge_config.rb +++ /dev/null @@ -1,178 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Cloud - module Retail - module V2 - # Metadata related to the progress of the Purge operation. - # This will be returned by the google.longrunning.Operation.metadata field. - class PurgeMetadata - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Metadata related to the progress of the PurgeProducts operation. - # This will be returned by the google.longrunning.Operation.metadata field. - # @!attribute [rw] create_time - # @return [::Google::Protobuf::Timestamp] - # Operation create time. - # @!attribute [rw] update_time - # @return [::Google::Protobuf::Timestamp] - # Operation last update time. If the operation is done, this is also the - # finish time. - # @!attribute [rw] success_count - # @return [::Integer] - # Count of entries that were deleted successfully. - # @!attribute [rw] failure_count - # @return [::Integer] - # Count of entries that encountered errors while processing. - class PurgeProductsMetadata - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request message for PurgeProducts method. - # @!attribute [rw] parent - # @return [::String] - # Required. The resource name of the branch under which the products are - # created. The format is - # `projects/${projectId}/locations/global/catalogs/${catalogId}/branches/${branchId}` - # @!attribute [rw] filter - # @return [::String] - # Required. The filter string to specify the products to be deleted with a - # length limit of 5,000 characters. - # - # Empty string filter is not allowed. "*" implies delete all items in a - # branch. - # - # The eligible fields for filtering are: - # - # * `availability`: Double quoted - # {::Google::Cloud::Retail::V2::Product#availability Product.availability} string. - # * `create_time` : in ISO 8601 "zulu" format. - # - # Supported syntax: - # - # * Comparators (">", "<", ">=", "<=", "="). - # Examples: - # * create_time <= "2015-02-13T17:05:46Z" - # * availability = "IN_STOCK" - # - # * Conjunctions ("AND") - # Examples: - # * create_time <= "2015-02-13T17:05:46Z" AND availability = "PREORDER" - # - # * Disjunctions ("OR") - # Examples: - # * create_time <= "2015-02-13T17:05:46Z" OR availability = "IN_STOCK" - # - # * Can support nested queries. - # Examples: - # * (create_time <= "2015-02-13T17:05:46Z" AND availability = "PREORDER") - # OR (create_time >= "2015-02-14T13:03:32Z" AND availability = "IN_STOCK") - # - # * Filter Limits: - # * Filter should not contain more than 6 conditions. - # * Max nesting depth should not exceed 2 levels. - # - # Examples queries: - # * Delete back order products created before a timestamp. - # create_time <= "2015-02-13T17:05:46Z" OR availability = "BACKORDER" - # @!attribute [rw] force - # @return [::Boolean] - # Actually perform the purge. - # If `force` is set to false, the method will return the expected purge count - # without deleting any products. - class PurgeProductsRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Response of the PurgeProductsRequest. If the long running operation is - # successfully done, then this message is returned by the - # google.longrunning.Operations.response field. - # @!attribute [rw] purge_count - # @return [::Integer] - # The total count of products purged as a result of the operation. - # @!attribute [rw] purge_sample - # @return [::Array<::String>] - # A sample of the product names that will be deleted. - # Only populated if `force` is set to false. A max of 100 names will be - # returned and the names are chosen at random. - class PurgeProductsResponse - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request message for PurgeUserEvents method. - # @!attribute [rw] parent - # @return [::String] - # Required. The resource name of the catalog under which the events are - # created. The format is - # `projects/${projectId}/locations/global/catalogs/${catalogId}` - # @!attribute [rw] filter - # @return [::String] - # Required. The filter string to specify the events to be deleted with a - # length limit of 5,000 characters. Empty string filter is not allowed. The - # eligible fields for filtering are: - # - # * `eventType`: Double quoted - # {::Google::Cloud::Retail::V2::UserEvent#event_type UserEvent.event_type} string. - # * `eventTime`: in ISO 8601 "zulu" format. - # * `visitorId`: Double quoted string. Specifying this will delete all - # events associated with a visitor. - # * `userId`: Double quoted string. Specifying this will delete all events - # associated with a user. - # - # Examples: - # - # * Deleting all events in a time range: - # `eventTime > "2012-04-23T18:25:43.511Z" - # eventTime < "2012-04-23T18:30:43.511Z"` - # * Deleting specific eventType in time range: - # `eventTime > "2012-04-23T18:25:43.511Z" eventType = "detail-page-view"` - # * Deleting all events for a specific visitor: - # `visitorId = "visitor1024"` - # - # The filtering fields are assumed to have an implicit AND. - # @!attribute [rw] force - # @return [::Boolean] - # Actually perform the purge. - # If `force` is set to false, the method will return the expected purge count - # without deleting any user events. - class PurgeUserEventsRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Response of the PurgeUserEventsRequest. If the long running operation is - # successfully done, then this message is returned by the - # google.longrunning.Operations.response field. - # @!attribute [rw] purged_events_count - # @return [::Integer] - # The total count of events purged as a result of the operation. - class PurgeUserEventsResponse - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/safety.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/safety.rb deleted file mode 100644 index c4c11c6cbd93..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/safety.rb +++ /dev/null @@ -1,96 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Cloud - module Retail - module V2 - # Safety settings. - # @!attribute [rw] category - # @return [::Google::Cloud::Retail::V2::HarmCategory] - # Harm category. - # @!attribute [rw] threshold - # @return [::Google::Cloud::Retail::V2::SafetySetting::HarmBlockThreshold] - # The harm block threshold. - # @!attribute [rw] method - # @return [::Google::Cloud::Retail::V2::SafetySetting::HarmBlockMethod] - # Optional. Specify if the threshold is used for probability or severity - # score. If not specified, the threshold is used for probability score. - class SafetySetting - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # Probability based thresholds levels for blocking. - module HarmBlockThreshold - # Unspecified harm block threshold. - HARM_BLOCK_THRESHOLD_UNSPECIFIED = 0 - - # Block low threshold and above (i.e. block more). - BLOCK_LOW_AND_ABOVE = 1 - - # Block medium threshold and above. - BLOCK_MEDIUM_AND_ABOVE = 2 - - # Block only high threshold (i.e. block less). - BLOCK_ONLY_HIGH = 3 - - # Block none. - BLOCK_NONE = 4 - - # Turn off the safety filter. - OFF = 5 - end - - # Probability vs severity. - module HarmBlockMethod - # The harm block method is unspecified. - HARM_BLOCK_METHOD_UNSPECIFIED = 0 - - # The harm block method uses both probability and severity scores. - SEVERITY = 1 - - # The harm block method uses the probability score. - PROBABILITY = 2 - end - end - - # Harm categories that will block the content. - module HarmCategory - # The harm category is unspecified. - HARM_CATEGORY_UNSPECIFIED = 0 - - # The harm category is hate speech. - HARM_CATEGORY_HATE_SPEECH = 1 - - # The harm category is dangerous content. - HARM_CATEGORY_DANGEROUS_CONTENT = 2 - - # The harm category is harassment. - HARM_CATEGORY_HARASSMENT = 3 - - # The harm category is sexually explicit content. - HARM_CATEGORY_SEXUALLY_EXPLICIT = 4 - - # The harm category is civic integrity. - HARM_CATEGORY_CIVIC_INTEGRITY = 5 - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/search_service.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/search_service.rb deleted file mode 100644 index beb964cfdc66..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/search_service.rb +++ /dev/null @@ -1,1301 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Cloud - module Retail - module V2 - # Product attribute which structured by an attribute name and value. This - # structure is used in conversational search filters and answers. For example, - # if we have `name=color` and `value=red`, this means that the color is `red`. - # @!attribute [rw] name - # @return [::String] - # The attribute name. - # @!attribute [rw] value - # @return [::String] - # The attribute value. - class ProductAttributeValue - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Product attribute name and numeric interval. - # @!attribute [rw] name - # @return [::String] - # The attribute name (e.g. "length") - # @!attribute [rw] interval - # @return [::Google::Cloud::Retail::V2::Interval] - # The numeric interval (e.g. [10, 20)) - class ProductAttributeInterval - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # This field specifies the tile information including an attribute key, - # attribute value. More fields will be added in the future, eg: product id - # or product counts, etc. - # @!attribute [rw] product_attribute_value - # @return [::Google::Cloud::Retail::V2::ProductAttributeValue] - # The product attribute key-value. - # - # Note: The following fields are mutually exclusive: `product_attribute_value`, `product_attribute_interval`. If a field in that set is populated, all other fields in the set will automatically be cleared. - # @!attribute [rw] product_attribute_interval - # @return [::Google::Cloud::Retail::V2::ProductAttributeInterval] - # The product attribute key-numeric interval. - # - # Note: The following fields are mutually exclusive: `product_attribute_interval`, `product_attribute_value`. If a field in that set is populated, all other fields in the set will automatically be cleared. - # @!attribute [rw] representative_product_id - # @return [::String] - # The representative product id for this tile. - class Tile - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request message for - # {::Google::Cloud::Retail::V2::SearchService::Client#search SearchService.Search} method. - # @!attribute [rw] placement - # @return [::String] - # Required. The resource name of the Retail Search serving config, such as - # `projects/*/locations/global/catalogs/default_catalog/servingConfigs/default_serving_config` - # or the name of the legacy placement resource, such as - # `projects/*/locations/global/catalogs/default_catalog/placements/default_search`. - # This field is used to identify the serving config name and the set - # of models that are used to make the search. - # @!attribute [rw] branch - # @return [::String] - # The branch resource name, such as - # `projects/*/locations/global/catalogs/default_catalog/branches/0`. - # - # Use "default_branch" as the branch ID or leave this field empty, to search - # products under the default branch. - # @!attribute [rw] query - # @return [::String] - # Raw search query. - # - # If this field is empty, the request is considered a category browsing - # request and returned results are based on - # {::Google::Cloud::Retail::V2::SearchRequest#filter filter} and - # {::Google::Cloud::Retail::V2::SearchRequest#page_categories page_categories}. - # @!attribute [rw] visitor_id - # @return [::String] - # Required. A unique identifier for tracking visitors. For example, this - # could be implemented with an HTTP cookie, which should be able to uniquely - # identify a visitor on a single device. This unique identifier should not - # change if the visitor logs in or out of the website. - # - # This should be the same identifier as - # {::Google::Cloud::Retail::V2::UserEvent#visitor_id UserEvent.visitor_id}. - # - # The field must be a UTF-8 encoded string with a length limit of 128 - # characters. Otherwise, an INVALID_ARGUMENT error is returned. - # @!attribute [rw] user_info - # @return [::Google::Cloud::Retail::V2::UserInfo] - # User information. - # @!attribute [rw] page_size - # @return [::Integer] - # Maximum number of {::Google::Cloud::Retail::V2::Product Product}s to return. If - # unspecified, defaults to a reasonable value. The maximum allowed value is - # 120. Values above 120 will be coerced to 120. - # - # If this field is negative, an INVALID_ARGUMENT is returned. - # @!attribute [rw] page_token - # @return [::String] - # A page token - # {::Google::Cloud::Retail::V2::SearchResponse#next_page_token SearchResponse.next_page_token}, - # received from a previous - # {::Google::Cloud::Retail::V2::SearchService::Client#search SearchService.Search} call. - # Provide this to retrieve the subsequent page. - # - # When paginating, all other parameters provided to - # {::Google::Cloud::Retail::V2::SearchService::Client#search SearchService.Search} must - # match the call that provided the page token. Otherwise, an INVALID_ARGUMENT - # error is returned. - # @!attribute [rw] offset - # @return [::Integer] - # A 0-indexed integer that specifies the current offset (that is, starting - # result location, amongst the {::Google::Cloud::Retail::V2::Product Product}s - # deemed by the API as relevant) in search results. This field is only - # considered if {::Google::Cloud::Retail::V2::SearchRequest#page_token page_token} - # is unset. - # - # If this field is negative, an INVALID_ARGUMENT is returned. - # @!attribute [rw] filter - # @return [::String] - # The filter syntax consists of an expression language for constructing a - # predicate from one or more fields of the products being filtered. Filter - # expression is case-sensitive. For more information, see - # [Filter](https://cloud.google.com/retail/docs/filter-and-order#filter). - # - # If this field is unrecognizable, an INVALID_ARGUMENT is returned. - # @!attribute [rw] canonical_filter - # @return [::String] - # The default filter that is applied when a user performs a search without - # checking any filters on the search page. - # - # The filter applied to every search request when quality improvement such as - # query expansion is needed. In the case a query does not have a sufficient - # amount of results this filter will be used to determine whether or not to - # enable the query expansion flow. The original filter will still be used for - # the query expanded search. - # This field is strongly recommended to achieve high search quality. - # - # For more information about filter syntax, see - # {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}. - # @!attribute [rw] order_by - # @return [::String] - # The order in which products are returned. Products can be ordered by - # a field in an {::Google::Cloud::Retail::V2::Product Product} object. Leave it - # unset if ordered by relevance. OrderBy expression is case-sensitive. For - # more information, see - # [Order](https://cloud.google.com/retail/docs/filter-and-order#order). - # - # If this field is unrecognizable, an INVALID_ARGUMENT is returned. - # @!attribute [rw] facet_specs - # @return [::Array<::Google::Cloud::Retail::V2::SearchRequest::FacetSpec>] - # Facet specifications for faceted search. If empty, no facets are returned. - # - # A maximum of 200 values are allowed. Otherwise, an INVALID_ARGUMENT error - # is returned. - # @!attribute [rw] dynamic_facet_spec - # @deprecated This field is deprecated and may be removed in the next major version update. - # @return [::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec] - # Deprecated. Refer to https://cloud.google.com/retail/docs/configs#dynamic - # to enable dynamic facets. Do not set this field. - # - # The specification for dynamically generated facets. Notice that only - # textual facets can be dynamically generated. - # @!attribute [rw] boost_spec - # @return [::Google::Cloud::Retail::V2::SearchRequest::BoostSpec] - # Boost specification to boost certain products. For more information, see - # [Boost results](https://cloud.google.com/retail/docs/boosting). - # - # Notice that if both - # {::Google::Cloud::Retail::V2::ServingConfig#boost_control_ids ServingConfig.boost_control_ids} - # and - # {::Google::Cloud::Retail::V2::SearchRequest#boost_spec SearchRequest.boost_spec} - # are set, the boost conditions from both places are evaluated. If a search - # request matches multiple boost conditions, the final boost score is equal - # to the sum of the boost scores from all matched boost conditions. - # @!attribute [rw] query_expansion_spec - # @return [::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec] - # The query expansion specification that specifies the conditions under which - # query expansion occurs. For more information, see [Query - # expansion](https://cloud.google.com/retail/docs/result-size#query_expansion). - # @!attribute [rw] variant_rollup_keys - # @return [::Array<::String>] - # The keys to fetch and rollup the matching - # {::Google::Cloud::Retail::V2::Product::Type::VARIANT variant} - # {::Google::Cloud::Retail::V2::Product Product}s attributes, - # {::Google::Cloud::Retail::V2::FulfillmentInfo FulfillmentInfo} or - # {::Google::Cloud::Retail::V2::LocalInventory LocalInventory}s attributes. The - # attributes from all the matching - # {::Google::Cloud::Retail::V2::Product::Type::VARIANT variant} - # {::Google::Cloud::Retail::V2::Product Product}s or - # {::Google::Cloud::Retail::V2::LocalInventory LocalInventory}s are merged and - # de-duplicated. Notice that rollup attributes will lead to extra query - # latency. Maximum number of keys is 30. - # - # For {::Google::Cloud::Retail::V2::FulfillmentInfo FulfillmentInfo}, a - # fulfillment type and a fulfillment ID must be provided in the format of - # "fulfillmentType.fulfillmentId". E.g., in "pickupInStore.store123", - # "pickupInStore" is fulfillment type and "store123" is the store ID. - # - # Supported keys are: - # - # * colorFamilies - # * price - # * originalPrice - # * discount - # * variantId - # * inventory(place_id,price) - # * inventory(place_id,original_price) - # * inventory(place_id,attributes.key), where key is any key in the - # {::Google::Cloud::Retail::V2::LocalInventory#attributes Product.local_inventories.attributes} - # map. - # * attributes.key, where key is any key in the - # {::Google::Cloud::Retail::V2::Product#attributes Product.attributes} map. - # * pickupInStore.id, where id is any - # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} - # for {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type} - # "pickup-in-store". - # * shipToStore.id, where id is any - # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} - # for {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type} - # "ship-to-store". - # * sameDayDelivery.id, where id is any - # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} - # for {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type} - # "same-day-delivery". - # * nextDayDelivery.id, where id is any - # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} - # for {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type} - # "next-day-delivery". - # * customFulfillment1.id, where id is any - # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} - # for {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type} - # "custom-type-1". - # * customFulfillment2.id, where id is any - # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} - # for {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type} - # "custom-type-2". - # * customFulfillment3.id, where id is any - # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} - # for {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type} - # "custom-type-3". - # * customFulfillment4.id, where id is any - # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} - # for {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type} - # "custom-type-4". - # * customFulfillment5.id, where id is any - # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} - # for {::Google::Cloud::Retail::V2::FulfillmentInfo#type FulfillmentInfo.type} - # "custom-type-5". - # - # If this field is set to an invalid value other than these, an - # INVALID_ARGUMENT error is returned. - # @!attribute [rw] page_categories - # @return [::Array<::String>] - # The categories associated with a category page. Must be set for category - # navigation queries to achieve good search quality. The format should be - # the same as - # {::Google::Cloud::Retail::V2::UserEvent#page_categories UserEvent.page_categories}; - # - # To represent full path of category, use '>' sign to separate different - # hierarchies. If '>' is part of the category name, replace it with - # other character(s). - # - # Category pages include special pages such as sales or promotions. For - # instance, a special sale page may have the category hierarchy: - # "pageCategories" : ["Sales > 2017 Black Friday Deals"]. - # @!attribute [rw] search_mode - # @return [::Google::Cloud::Retail::V2::SearchRequest::SearchMode] - # The search mode of the search request. If not specified, a single search - # request triggers both product search and faceted search. - # @!attribute [rw] personalization_spec - # @return [::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec] - # The specification for personalization. - # - # Notice that if both - # {::Google::Cloud::Retail::V2::ServingConfig#personalization_spec ServingConfig.personalization_spec} - # and - # {::Google::Cloud::Retail::V2::SearchRequest#personalization_spec SearchRequest.personalization_spec} - # are set. - # {::Google::Cloud::Retail::V2::SearchRequest#personalization_spec SearchRequest.personalization_spec} - # will override - # {::Google::Cloud::Retail::V2::ServingConfig#personalization_spec ServingConfig.personalization_spec}. - # @!attribute [rw] labels - # @return [::Google::Protobuf::Map{::String => ::String}] - # The labels applied to a resource must meet the following requirements: - # - # * Each resource can have multiple labels, up to a maximum of 64. - # * Each label must be a key-value pair. - # * Keys have a minimum length of 1 character and a maximum length of 63 - # characters and cannot be empty. Values can be empty and have a maximum - # length of 63 characters. - # * Keys and values can contain only lowercase letters, numeric characters, - # underscores, and dashes. All characters must use UTF-8 encoding, and - # international characters are allowed. - # * The key portion of a label must be unique. However, you can use the same - # key with multiple resources. - # * Keys must start with a lowercase letter or international character. - # - # For more information, see [Requirements for - # labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) - # in the Resource Manager documentation. - # @!attribute [rw] spell_correction_spec - # @return [::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec] - # The spell correction specification that specifies the mode under - # which spell correction will take effect. - # @!attribute [rw] entity - # @return [::String] - # The entity for customers that may run multiple different entities, domains, - # sites or regions, for example, `Google US`, `Google Ads`, `Waymo`, - # `google.com`, `youtube.com`, etc. - # If this is set, it should be exactly matched with - # {::Google::Cloud::Retail::V2::UserEvent#entity UserEvent.entity} to get search - # results boosted by entity. - # @!attribute [rw] conversational_search_spec - # @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec] - # Optional. This field specifies all conversational related parameters - # addition to traditional retail search. - # @!attribute [rw] tile_navigation_spec - # @return [::Google::Cloud::Retail::V2::SearchRequest::TileNavigationSpec] - # Optional. This field specifies tile navigation related parameters. - # @!attribute [rw] language_code - # @return [::String] - # Optional. The BCP-47 language code, such as "en-US" or "sr-Latn" - # [list](https://www.unicode.org/cldr/charts/46/summary/root.html). For more - # information, see [Standardized codes](https://google.aip.dev/143). This - # field helps to better interpret the query. If a value isn't specified, the - # query language code is automatically detected, which may not be accurate. - # @!attribute [rw] region_code - # @return [::String] - # Optional. The Unicode country/region code (CLDR) of a location, such as - # "US" and "419" - # [list](https://www.unicode.org/cldr/charts/46/supplemental/territory_information.html). - # For more information, see [Standardized codes](https://google.aip.dev/143). - # If set, then results will be boosted based on the region_code provided. - # @!attribute [rw] place_id - # @return [::String] - # Optional. An id corresponding to a place, such as a store id or region id. - # When specified, we use the price from the local inventory with the matching - # product's - # {::Google::Cloud::Retail::V2::LocalInventory#place_id LocalInventory.place_id} - # for revenue optimization. - # @!attribute [rw] user_attributes - # @return [::Google::Protobuf::Map{::String => ::Google::Cloud::Retail::V2::StringList}] - # Optional. The user attributes that could be used for personalization of - # search results. - # * Populate at most 100 key-value pairs per query. - # * Only supports string keys and repeated string values. - # * Duplcate keys are not allowed within a single query. - # - # Example: - # user_attributes: [ - # { key: "pets" - # value { - # values: "dog" - # values: "cat" - # } - # }, - # { key: "state" - # value { - # values: "CA" - # } - # } - # ] - class SearchRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # A facet specification to perform faceted search. - # @!attribute [rw] facet_key - # @return [::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey] - # Required. The facet key specification. - # @!attribute [rw] limit - # @return [::Integer] - # Maximum of facet values that should be returned for this facet. If - # unspecified, defaults to 50. The maximum allowed value is 300. Values - # above 300 will be coerced to 300. - # - # If this field is negative, an INVALID_ARGUMENT is returned. - # @!attribute [rw] excluded_filter_keys - # @return [::Array<::String>] - # List of keys to exclude when faceting. - # - # By default, - # {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key FacetKey.key} - # is not excluded from the filter unless it is listed in this field. - # - # Listing a facet key in this field allows its values to appear as facet - # results, even when they are filtered out of search results. Using this - # field does not affect what search results are returned. - # - # For example, suppose there are 100 products with the color facet "Red" - # and 200 products with the color facet "Blue". A query containing the - # filter "colorFamilies:ANY("Red")" and having "colorFamilies" as - # {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key FacetKey.key} - # would by default return only "Red" products in the search results, and - # also return "Red" with count 100 as the only color facet. Although there - # are also blue products available, "Blue" would not be shown as an - # available facet value. - # - # If "colorFamilies" is listed in "excludedFilterKeys", then the query - # returns the facet values "Red" with count 100 and "Blue" with count - # 200, because the "colorFamilies" key is now excluded from the filter. - # Because this field doesn't affect search results, the search results - # are still correctly filtered to return only "Red" products. - # - # A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error - # is returned. - # @!attribute [rw] enable_dynamic_position - # @return [::Boolean] - # Enables dynamic position for this facet. If set to true, the position of - # this facet among all facets in the response is determined by Google - # Retail Search. It is ordered together with dynamic facets if dynamic - # facets is enabled. If set to false, the position of this facet in the - # response is the same as in the request, and it is ranked before - # the facets with dynamic position enable and all dynamic facets. - # - # For example, you may always want to have rating facet returned in - # the response, but it's not necessarily to always display the rating facet - # at the top. In that case, you can set enable_dynamic_position to true so - # that the position of rating facet in response is determined by - # Google Retail Search. - # - # Another example, assuming you have the following facets in the request: - # - # * "rating", enable_dynamic_position = true - # - # * "price", enable_dynamic_position = false - # - # * "brands", enable_dynamic_position = false - # - # And also you have a dynamic facets enable, which generates a facet - # "gender". Then, the final order of the facets in the response can be - # ("price", "brands", "rating", "gender") or ("price", "brands", "gender", - # "rating") depends on how Google Retail Search orders "gender" and - # "rating" facets. However, notice that "price" and "brands" are always - # ranked at first and second position because their enable_dynamic_position - # values are false. - class FacetSpec - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # Specifies how a facet is computed. - # @!attribute [rw] key - # @return [::String] - # Required. Supported textual and numerical facet keys in - # {::Google::Cloud::Retail::V2::Product Product} object, over which the facet - # values are computed. Facet key is case-sensitive. - # - # Allowed facet keys when - # {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#query FacetKey.query} - # is not specified: - # - # * textual_field = - # * "brands" - # * "categories" - # * "genders" - # * "ageGroups" - # * "availability" - # * "colorFamilies" - # * "colors" - # * "sizes" - # * "materials" - # * "patterns" - # * "conditions" - # * "attributes.key" - # * "pickupInStore" - # * "shipToStore" - # * "sameDayDelivery" - # * "nextDayDelivery" - # * "customFulfillment1" - # * "customFulfillment2" - # * "customFulfillment3" - # * "customFulfillment4" - # * "customFulfillment5" - # * "inventory(place_id,attributes.key)" - # - # * numerical_field = - # * "price" - # * "discount" - # * "rating" - # * "ratingCount" - # * "attributes.key" - # * "inventory(place_id,price)" - # * "inventory(place_id,original_price)" - # * "inventory(place_id,attributes.key)" - # @!attribute [rw] intervals - # @return [::Array<::Google::Cloud::Retail::V2::Interval>] - # Set only if values should be bucketized into intervals. Must be set - # for facets with numerical values. Must not be set for facet with text - # values. Maximum number of intervals is 40. - # - # For all numerical facet keys that appear in the list of products from - # the catalog, the percentiles 0, 10, 30, 50, 70, 90, and 100 are - # computed from their distribution weekly. If the model assigns a high - # score to a numerical facet key and its intervals are not specified in - # the search request, these percentiles become the bounds - # for its intervals and are returned in the response. If the - # facet key intervals are specified in the request, then the specified - # intervals are returned instead. - # @!attribute [rw] restricted_values - # @return [::Array<::String>] - # Only get facet for the given restricted values. For example, when using - # "pickupInStore" as key and set restricted values to - # ["store123", "store456"], only facets for "store123" and "store456" are - # returned. Only supported on predefined textual fields, custom textual - # attributes and fulfillments. Maximum is 20. - # - # Must be set for the fulfillment facet keys: - # - # * pickupInStore - # - # * shipToStore - # - # * sameDayDelivery - # - # * nextDayDelivery - # - # * customFulfillment1 - # - # * customFulfillment2 - # - # * customFulfillment3 - # - # * customFulfillment4 - # - # * customFulfillment5 - # @!attribute [rw] prefixes - # @return [::Array<::String>] - # Only get facet values that start with the given string prefix. For - # example, suppose "categories" has three values "Women > Shoe", - # "Women > Dress" and "Men > Shoe". If set "prefixes" to "Women", the - # "categories" facet gives only "Women > Shoe" and "Women > Dress". - # Only supported on textual fields. Maximum is 10. - # @!attribute [rw] contains - # @return [::Array<::String>] - # Only get facet values that contains the given strings. For example, - # suppose "categories" has three values "Women > Shoe", - # "Women > Dress" and "Men > Shoe". If set "contains" to "Shoe", the - # "categories" facet gives only "Women > Shoe" and "Men > Shoe". - # Only supported on textual fields. Maximum is 10. - # @!attribute [rw] case_insensitive - # @return [::Boolean] - # True to make facet keys case insensitive when getting faceting - # values with prefixes or contains; false otherwise. - # @!attribute [rw] order_by - # @return [::String] - # The order in which - # {::Google::Cloud::Retail::V2::SearchResponse::Facet#values SearchResponse.Facet.values} - # are returned. - # - # Allowed values are: - # - # * "count desc", which means order by - # {::Google::Cloud::Retail::V2::SearchResponse::Facet::FacetValue#count SearchResponse.Facet.values.count} - # descending. - # - # * "value desc", which means order by - # {::Google::Cloud::Retail::V2::SearchResponse::Facet::FacetValue#value SearchResponse.Facet.values.value} - # descending. - # Only applies to textual facets. - # - # If not set, textual values are sorted in [natural - # order](https://en.wikipedia.org/wiki/Natural_sort_order); numerical - # intervals are sorted in the order given by - # {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#intervals FacetSpec.FacetKey.intervals}; - # {::Google::Cloud::Retail::V2::FulfillmentInfo#place_ids FulfillmentInfo.place_ids} - # are sorted in the order given by - # {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#restricted_values FacetSpec.FacetKey.restricted_values}. - # @!attribute [rw] query - # @return [::String] - # The query that is used to compute facet for the given facet key. - # When provided, it overrides the default behavior of facet - # computation. The query syntax is the same as a filter expression. See - # {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter} for - # detail syntax and limitations. Notice that there is no limitation on - # {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key FacetKey.key} - # when query is specified. - # - # In the response, - # {::Google::Cloud::Retail::V2::SearchResponse::Facet::FacetValue#value SearchResponse.Facet.values.value} - # is always "1" and - # {::Google::Cloud::Retail::V2::SearchResponse::Facet::FacetValue#count SearchResponse.Facet.values.count} - # is the number of results that match the query. - # - # For example, you can set a customized facet for "shipToStore", - # where - # {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key FacetKey.key} - # is "customizedShipToStore", and - # {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#query FacetKey.query} - # is "availability: ANY(\"IN_STOCK\") AND shipToStore: ANY(\"123\")". - # Then the facet counts the products that are both in stock and ship - # to store "123". - # @!attribute [rw] return_min_max - # @return [::Boolean] - # Returns the min and max value for each numerical facet intervals. - # Ignored for textual facets. - class FacetKey - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - - # The specifications of dynamically generated facets. - # @!attribute [rw] mode - # @return [::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode] - # Mode of the DynamicFacet feature. - # Defaults to - # {::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec::Mode::DISABLED Mode.DISABLED} - # if it's unset. - class DynamicFacetSpec - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # Enum to control DynamicFacet mode - module Mode - # Default value. - MODE_UNSPECIFIED = 0 - - # Disable Dynamic Facet. - DISABLED = 1 - - # Automatic mode built by Google Retail Search. - ENABLED = 2 - end - end - - # Boost specification to boost certain items. - # @!attribute [rw] condition_boost_specs - # @return [::Array<::Google::Cloud::Retail::V2::SearchRequest::BoostSpec::ConditionBoostSpec>] - # Condition boost specifications. If a product matches multiple conditions - # in the specifications, boost scores from these specifications are all - # applied and combined in a non-linear way. Maximum number of - # specifications is 20. - # @!attribute [rw] skip_boost_spec_validation - # @return [::Boolean] - # Whether to skip boostspec validation. If this field is set to true, - # invalid - # {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs} - # will be ignored and valid - # {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs BoostSpec.condition_boost_specs} - # will still be applied. - class BoostSpec - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # Boost applies to products which match a condition. - # @!attribute [rw] condition - # @return [::String] - # An expression which specifies a boost condition. The syntax and - # supported fields are the same as a filter expression. See - # {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter} for - # detail syntax and limitations. - # - # Examples: - # - # * To boost products with product ID "product_1" or "product_2", and - # color - # "Red" or "Blue": - # * (id: ANY("product_1", "product_2")) AND (colorFamilies: - # ANY("Red","Blue")) - # @!attribute [rw] boost - # @return [::Float] - # Strength of the condition boost, which should be in [-1, 1]. Negative - # boost means demotion. Default is 0.0. - # - # Setting to 1.0 gives the item a big promotion. However, it does not - # necessarily mean that the boosted item will be the top result at all - # times, nor that other items will be excluded. Results could still be - # shown even when none of them matches the condition. And results that - # are significantly more relevant to the search query can still trump - # your heavily favored but irrelevant items. - # - # Setting to -1.0 gives the item a big demotion. However, results that - # are deeply relevant might still be shown. The item will have an - # upstream battle to get a fairly high ranking, but it is not blocked out - # completely. - # - # Setting to 0.0 means no boost applied. The boosting condition is - # ignored. - class ConditionBoostSpec - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - - # Specification to determine under which conditions query expansion should - # occur. - # @!attribute [rw] condition - # @return [::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition] - # The condition under which query expansion should occur. Default to - # {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}. - # @!attribute [rw] pin_unexpanded_results - # @return [::Boolean] - # Whether to pin unexpanded results. The default value is false. If this - # field is set to true, - # unexpanded products are always at the top of the search results, followed - # by the expanded results. - class QueryExpansionSpec - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # Enum describing under which condition query expansion should occur. - module Condition - # Unspecified query expansion condition. In this case, server behavior - # defaults to - # {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec::Condition::DISABLED Condition.DISABLED}. - CONDITION_UNSPECIFIED = 0 - - # Disabled query expansion. Only the exact search query is used, even if - # {::Google::Cloud::Retail::V2::SearchResponse#total_size SearchResponse.total_size} - # is zero. - DISABLED = 1 - - # Automatic query expansion built by Google Retail Search. - AUTO = 3 - end - end - - # The specification for personalization. - # @!attribute [rw] mode - # @return [::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode] - # Defaults to - # {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}. - class PersonalizationSpec - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # The personalization mode of each search request. - module Mode - # Default value. In this case, server behavior defaults to - # {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO Mode.AUTO}. - MODE_UNSPECIFIED = 0 - - # Let CRS decide whether to use personalization based on quality of user - # event data. - AUTO = 1 - - # Disable personalization. - DISABLED = 2 - end - end - - # The specification for query spell correction. - # @!attribute [rw] mode - # @return [::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode] - # The mode under which spell correction should take effect to - # replace the original search query. Default to - # {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}. - class SpellCorrectionSpec - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # Enum describing under which mode spell correction should occur. - module Mode - # Unspecified spell correction mode. In this case, server behavior - # defaults to - # {::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec::Mode::AUTO Mode.AUTO}. - MODE_UNSPECIFIED = 0 - - # Google Retail Search will try to find a spell suggestion if there - # is any and put in the - # {::Google::Cloud::Retail::V2::SearchResponse#corrected_query SearchResponse.corrected_query}. - # The spell suggestion will not be used as the search query. - SUGGESTION_ONLY = 1 - - # Automatic spell correction built by Google Retail Search. Search will - # be based on the corrected query if found. - AUTO = 2 - end - end - - # This field specifies all conversational related parameters addition to - # traditional retail search. - # @!attribute [rw] followup_conversation_requested - # @return [::Boolean] - # This field specifies whether the customer would like to do conversational - # search. If this field is set to true, conversational related extra - # information will be returned from server side, including follow-up - # question, answer options, etc. - # @!attribute [rw] conversation_id - # @return [::String] - # This field specifies the conversation id, which maintains the state of - # the conversation between client side and server side. Use the value from - # the previous [ConversationalSearchResult.conversation_id][]. For the - # initial request, this should be empty. - # @!attribute [rw] user_answer - # @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer] - # This field specifies the current user answer during the conversational - # search. This can be either user selected from suggested answers or user - # input plain text. - class ConversationalSearchSpec - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # This field specifies the current user answer during the conversational - # search. This can be either user selected from suggested answers or user - # input plain text. - # @!attribute [rw] text_answer - # @return [::String] - # This field specifies the incremental input text from the user during - # the conversational search. - # - # Note: The following fields are mutually exclusive: `text_answer`, `selected_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared. - # @!attribute [rw] selected_answer - # @return [::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer::SelectedAnswer] - # This field specifies the selected attributes during the - # conversational search. This should be a subset of - # [ConversationalSearchResult.suggested_answers][]. - # - # Note: The following fields are mutually exclusive: `selected_answer`, `text_answer`. If a field in that set is populated, all other fields in the set will automatically be cleared. - class UserAnswer - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # This field specifies the selected answers during the conversational - # search. - # @!attribute [rw] product_attribute_values - # @deprecated This field is deprecated and may be removed in the next major version update. - # @return [::Array<::Google::Cloud::Retail::V2::ProductAttributeValue>] - # This field is deprecated and should not be set. - # @!attribute [rw] product_attribute_value - # @return [::Google::Cloud::Retail::V2::ProductAttributeValue] - # This field specifies the selected answer which is a attribute - # key-value. - class SelectedAnswer - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - end - - # This field specifies tile navigation related parameters. - # @!attribute [rw] tile_navigation_requested - # @return [::Boolean] - # This field specifies whether the customer would like to request tile - # navigation. - # @!attribute [rw] applied_tiles - # @return [::Array<::Google::Cloud::Retail::V2::Tile>] - # This optional field specifies the tiles which are already clicked in - # client side. While the feature works without this field set, particularly - # for an initial query, it is highly recommended to set this field because - # it can improve the quality of the search response and removes possible - # duplicate tiles. - # - # NOTE: This field is not being used for filtering search - # products. Client side should also put all the applied tiles in - # {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}. - class TileNavigationSpec - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # @!attribute [rw] key - # @return [::String] - # @!attribute [rw] value - # @return [::String] - class LabelsEntry - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # @!attribute [rw] key - # @return [::String] - # @!attribute [rw] value - # @return [::Google::Cloud::Retail::V2::StringList] - class UserAttributesEntry - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # The search mode of each search request. - module SearchMode - # Default value. In this case both product search and faceted search will - # be performed. Both - # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult} - # and {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} - # will be returned. - SEARCH_MODE_UNSPECIFIED = 0 - - # Only product search will be performed. The faceted search will be - # disabled. - # - # Only - # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult} - # will be returned. - # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will - # not be returned, even if - # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs} - # or - # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec} - # is set. - PRODUCT_SEARCH_ONLY = 1 - - # Only faceted search will be performed. The product search will be - # disabled. - # - # When in this mode, one or both of - # {::Google::Cloud::Retail::V2::SearchRequest#facet_specs SearchRequest.facet_specs} - # and - # {::Google::Cloud::Retail::V2::SearchRequest#dynamic_facet_spec SearchRequest.dynamic_facet_spec} - # should be set. Otherwise, an INVALID_ARGUMENT error is returned. Only - # {::Google::Cloud::Retail::V2::SearchResponse::Facet SearchResponse.Facet} will - # be returned. - # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult SearchResponse.SearchResult} - # will not be returned. - FACETED_SEARCH_ONLY = 2 - end - end - - # Response message for - # {::Google::Cloud::Retail::V2::SearchService::Client#search SearchService.Search} method. - # @!attribute [rw] results - # @return [::Array<::Google::Cloud::Retail::V2::SearchResponse::SearchResult>] - # A list of matched items. The order represents the ranking. - # @!attribute [rw] facets - # @return [::Array<::Google::Cloud::Retail::V2::SearchResponse::Facet>] - # Results of facets requested by user. - # @!attribute [rw] total_size - # @return [::Integer] - # The estimated total count of matched items irrespective of pagination. The - # count of {::Google::Cloud::Retail::V2::SearchResponse#results results} returned - # by pagination may be less than the - # {::Google::Cloud::Retail::V2::SearchResponse#total_size total_size} that - # matches. - # @!attribute [rw] corrected_query - # @return [::String] - # Contains the spell corrected query, if found. If the spell correction type - # is AUTOMATIC, then the search results are based on corrected_query. - # Otherwise the original query is used for search. - # @!attribute [rw] attribution_token - # @return [::String] - # A unique search token. This should be included in the - # {::Google::Cloud::Retail::V2::UserEvent UserEvent} logs resulting from this - # search, which enables accurate attribution of search model performance. - # @!attribute [rw] next_page_token - # @return [::String] - # A token that can be sent as - # {::Google::Cloud::Retail::V2::SearchRequest#page_token SearchRequest.page_token} - # to retrieve the next page. If this field is omitted, there are no - # subsequent pages. - # @!attribute [rw] query_expansion_info - # @return [::Google::Cloud::Retail::V2::SearchResponse::QueryExpansionInfo] - # Query expansion information for the returned results. - # @!attribute [rw] redirect_uri - # @return [::String] - # The URI of a customer-defined redirect page. If redirect action is - # triggered, no search is performed, and only - # {::Google::Cloud::Retail::V2::SearchResponse#redirect_uri redirect_uri} and - # {::Google::Cloud::Retail::V2::SearchResponse#attribution_token attribution_token} - # are set in the response. - # @!attribute [rw] applied_controls - # @return [::Array<::String>] - # The fully qualified resource name of applied - # [controls](https://cloud.google.com/retail/docs/serving-control-rules). - # @!attribute [rw] pin_control_metadata - # @return [::Google::Cloud::Retail::V2::PinControlMetadata] - # Metadata for pin controls which were applicable to the request. - # This contains two map fields, one for all matched pins and one for pins - # which were matched but not applied. - # - # The two maps are keyed by pin position, and the values are the product ids - # which were matched to that pin. - # @!attribute [rw] invalid_condition_boost_specs - # @return [::Array<::Google::Cloud::Retail::V2::SearchRequest::BoostSpec::ConditionBoostSpec>] - # The invalid - # {::Google::Cloud::Retail::V2::SearchRequest::BoostSpec#condition_boost_specs SearchRequest.BoostSpec.condition_boost_specs} - # that are not applied during serving. - # @!attribute [rw] experiment_info - # @return [::Array<::Google::Cloud::Retail::V2::ExperimentInfo>] - # Metadata related to A/B testing experiment associated with this - # response. Only exists when an experiment is triggered. - # @!attribute [rw] conversational_search_result - # @return [::Google::Cloud::Retail::V2::SearchResponse::ConversationalSearchResult] - # This field specifies all related information that is needed on client - # side for UI rendering of conversational retail search. - # @!attribute [rw] tile_navigation_result - # @return [::Google::Cloud::Retail::V2::SearchResponse::TileNavigationResult] - # This field specifies all related information for tile navigation that will - # be used in client side. - class SearchResponse - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # Represents the search results. - # @!attribute [rw] id - # @return [::String] - # {::Google::Cloud::Retail::V2::Product#id Product.id} of the searched - # {::Google::Cloud::Retail::V2::Product Product}. - # @!attribute [rw] product - # @return [::Google::Cloud::Retail::V2::Product] - # The product data snippet in the search response. Only - # {::Google::Cloud::Retail::V2::Product#name Product.name} is guaranteed to be - # populated. - # - # {::Google::Cloud::Retail::V2::Product#variants Product.variants} contains the - # product variants that match the search query. If there are multiple - # product variants matching the query, top 5 most relevant product variants - # are returned and ordered by relevancy. - # - # If relevancy can be deternmined, use - # {::Google::Cloud::Retail::V2::SearchResponse::SearchResult#matching_variant_fields matching_variant_fields} - # to look up matched product variants fields. If relevancy cannot be - # determined, e.g. when searching "shoe" all products in a shoe product can - # be a match, 5 product variants are returned but order is meaningless. - # @!attribute [rw] matching_variant_count - # @return [::Integer] - # The count of matched - # {::Google::Cloud::Retail::V2::Product::Type::VARIANT variant} - # {::Google::Cloud::Retail::V2::Product Product}s. - # @!attribute [rw] matching_variant_fields - # @return [::Google::Protobuf::Map{::String => ::Google::Protobuf::FieldMask}] - # If a {::Google::Cloud::Retail::V2::Product::Type::VARIANT variant} - # {::Google::Cloud::Retail::V2::Product Product} matches the search query, this - # map indicates which {::Google::Cloud::Retail::V2::Product Product} fields are - # matched. The key is the - # {::Google::Cloud::Retail::V2::Product#name Product.name}, the value is a field - # mask of the matched {::Google::Cloud::Retail::V2::Product Product} fields. If - # matched attributes cannot be determined, this map will be empty. - # - # For example, a key "sku1" with field mask - # "products.color_info" indicates there is a match between - # "sku1" {::Google::Cloud::Retail::V2::ColorInfo ColorInfo} and the query. - # @!attribute [rw] variant_rollup_values - # @return [::Google::Protobuf::Map{::String => ::Google::Protobuf::Value}] - # The rollup matching - # {::Google::Cloud::Retail::V2::Product::Type::VARIANT variant} - # {::Google::Cloud::Retail::V2::Product Product} attributes. The key is one of - # the - # {::Google::Cloud::Retail::V2::SearchRequest#variant_rollup_keys SearchRequest.variant_rollup_keys}. - # The values are the merged and de-duplicated - # {::Google::Cloud::Retail::V2::Product Product} attributes. Notice that the - # rollup values are respect filter. For example, when filtering by - # "colorFamilies:ANY(\"red\")" and rollup "colorFamilies", only "red" is - # returned. - # - # For textual and numerical attributes, the rollup values is a list of - # string or double values with type - # {::Google::Protobuf::ListValue google.protobuf.ListValue}. For example, if - # there are two variants with colors "red" and "blue", the rollup values - # are - # - # { key: "colorFamilies" - # value { - # list_value { - # values { string_value: "red" } - # values { string_value: "blue" } - # } - # } - # } - # - # For {::Google::Cloud::Retail::V2::FulfillmentInfo FulfillmentInfo}, the rollup - # values is a double value with type - # {::Google::Protobuf::Value google.protobuf.Value}. For example, - # `{key: "pickupInStore.store1" value { number_value: 10 }}` means a there - # are 10 variants in this product are available in the store "store1". - # @!attribute [rw] personal_labels - # @return [::Array<::String>] - # Specifies previous events related to this product for this user based on - # {::Google::Cloud::Retail::V2::UserEvent UserEvent} with same - # {::Google::Cloud::Retail::V2::SearchRequest#visitor_id SearchRequest.visitor_id} - # or {::Google::Cloud::Retail::V2::UserInfo#user_id UserInfo.user_id}. - # - # This is set only when - # {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec#mode SearchRequest.PersonalizationSpec.mode} - # is - # {::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec::Mode::AUTO SearchRequest.PersonalizationSpec.Mode.AUTO}. - # - # Possible values: - # - # * `purchased`: Indicates that this product has been purchased before. - # @!attribute [rw] model_scores - # @return [::Google::Protobuf::Map{::String => ::Google::Cloud::Retail::V2::DoubleList}] - # Google provided available scores. - class SearchResult - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # @!attribute [rw] key - # @return [::String] - # @!attribute [rw] value - # @return [::Google::Protobuf::FieldMask] - class MatchingVariantFieldsEntry - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # @!attribute [rw] key - # @return [::String] - # @!attribute [rw] value - # @return [::Google::Protobuf::Value] - class VariantRollupValuesEntry - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # @!attribute [rw] key - # @return [::String] - # @!attribute [rw] value - # @return [::Google::Cloud::Retail::V2::DoubleList] - class ModelScoresEntry - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - - # A facet result. - # @!attribute [rw] key - # @return [::String] - # The key for this facet. E.g., "colorFamilies" or "price" or - # "attributes.attr1". - # @!attribute [rw] values - # @return [::Array<::Google::Cloud::Retail::V2::SearchResponse::Facet::FacetValue>] - # The facet values for this field. - # @!attribute [rw] dynamic_facet - # @return [::Boolean] - # Whether the facet is dynamically generated. - class Facet - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # A facet value which contains value names and their count. - # @!attribute [rw] value - # @return [::String] - # Text value of a facet, such as "Black" for facet "colorFamilies". - # - # Note: The following fields are mutually exclusive: `value`, `interval`. If a field in that set is populated, all other fields in the set will automatically be cleared. - # @!attribute [rw] interval - # @return [::Google::Cloud::Retail::V2::Interval] - # Interval value for a facet, such as [10, 20) for facet "price". - # - # Note: The following fields are mutually exclusive: `interval`, `value`. If a field in that set is populated, all other fields in the set will automatically be cleared. - # @!attribute [rw] count - # @return [::Integer] - # Number of items that have this facet value. - # @!attribute [rw] min_value - # @return [::Float] - # The minimum value in the - # {::Google::Cloud::Retail::V2::SearchResponse::Facet::FacetValue#interval FacetValue.interval}. - # Only supported on numerical facets and returned if - # {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#return_min_max SearchRequest.FacetSpec.FacetKey.return_min_max} - # is true. - # @!attribute [rw] max_value - # @return [::Float] - # The maximum value in the - # {::Google::Cloud::Retail::V2::SearchResponse::Facet::FacetValue#interval FacetValue.interval}. - # Only supported on numerical facets and returned if - # {::Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#return_min_max SearchRequest.FacetSpec.FacetKey.return_min_max} - # is true. - class FacetValue - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - - # Information describing query expansion including whether expansion has - # occurred. - # @!attribute [rw] expanded_query - # @return [::Boolean] - # Bool describing whether query expansion has occurred. - # @!attribute [rw] pinned_result_count - # @return [::Integer] - # Number of pinned results. This field will only be set when expansion - # happens and - # {::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec#pin_unexpanded_results SearchRequest.QueryExpansionSpec.pin_unexpanded_results} - # is set to true. - class QueryExpansionInfo - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # This field specifies all related information that is needed on client - # side for UI rendering of conversational retail search. - # @!attribute [rw] conversation_id - # @return [::String] - # Conversation UUID. This field will be stored in client side storage to - # maintain the conversation session with server and will be used for next - # search request's - # {::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec#conversation_id SearchRequest.ConversationalSearchSpec.conversation_id} - # to restore conversation state in server. - # @!attribute [rw] refined_query - # @return [::String] - # The current refined query for the conversational search. This field - # will be used in customer UI that the query in the search bar should be - # replaced with the refined query. For example, if - # {::Google::Cloud::Retail::V2::SearchRequest#query SearchRequest.query} is - # `dress` and next - # {::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec::UserAnswer#text_answer SearchRequest.ConversationalSearchSpec.UserAnswer.text_answer} - # is `red color`, which does not match any product attribute value filters, - # the refined query will be `dress, red color`. - # @!attribute [rw] additional_filters - # @deprecated This field is deprecated and may be removed in the next major version update. - # @return [::Array<::Google::Cloud::Retail::V2::SearchResponse::ConversationalSearchResult::AdditionalFilter>] - # This field is deprecated but will be kept for backward compatibility. - # There is expected to have only one additional filter and the value will - # be the same to the same as field `additional_filter`. - # @!attribute [rw] followup_question - # @return [::String] - # The follow-up question. e.g., `What is the color?` - # @!attribute [rw] suggested_answers - # @return [::Array<::Google::Cloud::Retail::V2::SearchResponse::ConversationalSearchResult::SuggestedAnswer>] - # The answer options provided to client for the follow-up question. - # @!attribute [rw] additional_filter - # @return [::Google::Cloud::Retail::V2::SearchResponse::ConversationalSearchResult::AdditionalFilter] - # This is the incremental additional filters implied from the current - # user answer. User should add the suggested addition filters to the - # previous - # {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter}, and - # use the merged filter in the follow up search request. - class ConversationalSearchResult - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # Suggested answers to the follow-up question. - # @!attribute [rw] product_attribute_value - # @return [::Google::Cloud::Retail::V2::ProductAttributeValue] - # Product attribute value, including an attribute key and an - # attribute value. Other types can be added here in the future. - class SuggestedAnswer - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Additional filter that client side need to apply. - # @!attribute [rw] product_attribute_value - # @return [::Google::Cloud::Retail::V2::ProductAttributeValue] - # Product attribute value, including an attribute key and an - # attribute value. Other types can be added here in the future. - class AdditionalFilter - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - - # This field specifies all related information for tile navigation that will - # be used in client side. - # @!attribute [rw] tiles - # @return [::Array<::Google::Cloud::Retail::V2::Tile>] - # The current tiles that are used for tile navigation, sorted by - # engagement. - class TileNavigationResult - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - - # Metadata for active A/B testing experiment. - # @!attribute [rw] serving_config_experiment - # @return [::Google::Cloud::Retail::V2::ExperimentInfo::ServingConfigExperiment] - # A/B test between existing Cloud Retail Search - # {::Google::Cloud::Retail::V2::ServingConfig ServingConfig}s. - # @!attribute [rw] experiment - # @return [::String] - # The fully qualified resource name of the experiment that provides the - # serving config under test, should an active experiment exist. For example: - # `projects/*/locations/global/catalogs/default_catalog/experiments/experiment_id` - class ExperimentInfo - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # Metadata for active serving config A/B tests. - # @!attribute [rw] original_serving_config - # @return [::String] - # The fully qualified resource name of the original - # {::Google::Cloud::Retail::V2::SearchRequest#placement SearchRequest.placement} - # in the search request prior to reassignment by experiment API. For - # example: `projects/*/locations/*/catalogs/*/servingConfigs/*`. - # @!attribute [rw] experiment_serving_config - # @return [::String] - # The fully qualified resource name of the serving config - # `Experiment.VariantArm.serving_config_id` responsible for generating - # the search response. For example: - # `projects/*/locations/*/catalogs/*/servingConfigs/*`. - class ServingConfigExperiment - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/serving_config.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/serving_config.rb deleted file mode 100644 index 2237b3c08193..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/serving_config.rb +++ /dev/null @@ -1,259 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Cloud - module Retail - module V2 - # Configures metadata that is used to generate serving time results (e.g. - # search results or recommendation predictions). - # @!attribute [rw] name - # @return [::String] - # Immutable. Fully qualified name - # `projects/*/locations/global/catalogs/*/servingConfig/*` - # @!attribute [rw] display_name - # @return [::String] - # Required. The human readable serving config display name. Used in Retail - # UI. - # - # This field must be a UTF-8 encoded string with a length limit of 128 - # characters. Otherwise, an INVALID_ARGUMENT error is returned. - # @!attribute [rw] model_id - # @return [::String] - # The id of the model in the same {::Google::Cloud::Retail::V2::Catalog Catalog} - # to use at serving time. Currently only RecommendationModels are supported: - # https://cloud.google.com/retail/recommendations-ai/docs/create-models - # Can be changed but only to a compatible model (e.g. - # others-you-may-like CTR to others-you-may-like CVR). - # - # Required when - # {::Google::Cloud::Retail::V2::ServingConfig#solution_types solution_types} is - # {::Google::Cloud::Retail::V2::SolutionType::SOLUTION_TYPE_RECOMMENDATION SOLUTION_TYPE_RECOMMENDATION}. - # @!attribute [rw] price_reranking_level - # @return [::String] - # How much price ranking we want in serving results. - # Price reranking causes product items with a similar - # recommendation probability to be ordered by price, with the - # highest-priced items first. This setting could result in a decrease in - # click-through and conversion rates. - # Allowed values are: - # - # * `no-price-reranking` - # * `low-price-reranking` - # * `medium-price-reranking` - # * `high-price-reranking` - # - # If not specified, we choose default based on model type. Default value: - # `no-price-reranking`. - # - # Can only be set if - # {::Google::Cloud::Retail::V2::ServingConfig#solution_types solution_types} is - # {::Google::Cloud::Retail::V2::SolutionType::SOLUTION_TYPE_RECOMMENDATION SOLUTION_TYPE_RECOMMENDATION}. - # @!attribute [rw] facet_control_ids - # @return [::Array<::String>] - # Facet specifications for faceted search. If empty, no facets are returned. - # The ids refer to the ids of {::Google::Cloud::Retail::V2::Control Control} - # resources with only the Facet control set. These controls are assumed to be - # in the same {::Google::Cloud::Retail::V2::Catalog Catalog} as the - # {::Google::Cloud::Retail::V2::ServingConfig ServingConfig}. - # A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error - # is returned. - # - # Can only be set if - # {::Google::Cloud::Retail::V2::ServingConfig#solution_types solution_types} is - # {::Google::Cloud::Retail::V2::SolutionType::SOLUTION_TYPE_SEARCH SOLUTION_TYPE_SEARCH}. - # @!attribute [rw] dynamic_facet_spec - # @return [::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec] - # The specification for dynamically generated facets. Notice that only - # textual facets can be dynamically generated. - # - # Can only be set if - # {::Google::Cloud::Retail::V2::ServingConfig#solution_types solution_types} is - # {::Google::Cloud::Retail::V2::SolutionType::SOLUTION_TYPE_SEARCH SOLUTION_TYPE_SEARCH}. - # @!attribute [rw] boost_control_ids - # @return [::Array<::String>] - # Condition boost specifications. If a product matches multiple conditions - # in the specifications, boost scores from these specifications are all - # applied and combined in a non-linear way. Maximum number of - # specifications is 100. - # - # Notice that if both - # {::Google::Cloud::Retail::V2::ServingConfig#boost_control_ids ServingConfig.boost_control_ids} - # and - # {::Google::Cloud::Retail::V2::SearchRequest#boost_spec SearchRequest.boost_spec} - # are set, the boost conditions from both places are evaluated. If a search - # request matches multiple boost conditions, the final boost score is equal - # to the sum of the boost scores from all matched boost conditions. - # - # Can only be set if - # {::Google::Cloud::Retail::V2::ServingConfig#solution_types solution_types} is - # {::Google::Cloud::Retail::V2::SolutionType::SOLUTION_TYPE_SEARCH SOLUTION_TYPE_SEARCH}. - # @!attribute [rw] filter_control_ids - # @return [::Array<::String>] - # Condition filter specifications. If a product matches multiple conditions - # in the specifications, filters from these specifications are all - # applied and combined via the AND operator. Maximum number of - # specifications is 100. - # - # Can only be set if - # {::Google::Cloud::Retail::V2::ServingConfig#solution_types solution_types} is - # {::Google::Cloud::Retail::V2::SolutionType::SOLUTION_TYPE_SEARCH SOLUTION_TYPE_SEARCH}. - # @!attribute [rw] redirect_control_ids - # @return [::Array<::String>] - # Condition redirect specifications. Only the first triggered redirect action - # is applied, even if multiple apply. Maximum number of specifications is - # 1000. - # - # Can only be set if - # {::Google::Cloud::Retail::V2::ServingConfig#solution_types solution_types} is - # {::Google::Cloud::Retail::V2::SolutionType::SOLUTION_TYPE_SEARCH SOLUTION_TYPE_SEARCH}. - # @!attribute [rw] twoway_synonyms_control_ids - # @return [::Array<::String>] - # Condition synonyms specifications. If multiple syonyms conditions match, - # all matching synonyms control in the list will execute. Order of controls - # in the list will not matter. Maximum number of specifications is - # 100. - # - # Can only be set if - # {::Google::Cloud::Retail::V2::ServingConfig#solution_types solution_types} is - # {::Google::Cloud::Retail::V2::SolutionType::SOLUTION_TYPE_SEARCH SOLUTION_TYPE_SEARCH}. - # @!attribute [rw] oneway_synonyms_control_ids - # @return [::Array<::String>] - # Condition oneway synonyms specifications. If multiple oneway synonyms - # conditions match, all matching oneway synonyms controls in the list will - # execute. Order of controls in the list will not matter. Maximum number of - # specifications is 100. - # - # Can only be set if - # {::Google::Cloud::Retail::V2::ServingConfig#solution_types solution_types} is - # {::Google::Cloud::Retail::V2::SolutionType::SOLUTION_TYPE_SEARCH SOLUTION_TYPE_SEARCH}. - # @!attribute [rw] do_not_associate_control_ids - # @return [::Array<::String>] - # Condition do not associate specifications. If multiple do not associate - # conditions match, all matching do not associate controls in the list will - # execute. - # - Order does not matter. - # - Maximum number of specifications is 100. - # - # Can only be set if - # {::Google::Cloud::Retail::V2::ServingConfig#solution_types solution_types} is - # {::Google::Cloud::Retail::V2::SolutionType::SOLUTION_TYPE_SEARCH SOLUTION_TYPE_SEARCH}. - # @!attribute [rw] replacement_control_ids - # @return [::Array<::String>] - # Condition replacement specifications. - # - Applied according to the order in the list. - # - A previously replaced term can not be re-replaced. - # - Maximum number of specifications is 100. - # - # Can only be set if - # {::Google::Cloud::Retail::V2::ServingConfig#solution_types solution_types} is - # {::Google::Cloud::Retail::V2::SolutionType::SOLUTION_TYPE_SEARCH SOLUTION_TYPE_SEARCH}. - # @!attribute [rw] ignore_control_ids - # @return [::Array<::String>] - # Condition ignore specifications. If multiple ignore - # conditions match, all matching ignore controls in the list will - # execute. - # - Order does not matter. - # - Maximum number of specifications is 100. - # - # Can only be set if - # {::Google::Cloud::Retail::V2::ServingConfig#solution_types solution_types} is - # {::Google::Cloud::Retail::V2::SolutionType::SOLUTION_TYPE_SEARCH SOLUTION_TYPE_SEARCH}. - # @!attribute [rw] diversity_level - # @return [::String] - # How much diversity to use in recommendation model results e.g. - # `medium-diversity` or `high-diversity`. Currently supported values: - # - # * `no-diversity` - # * `low-diversity` - # * `medium-diversity` - # * `high-diversity` - # * `auto-diversity` - # - # If not specified, we choose default based on recommendation model - # type. Default value: `no-diversity`. - # - # Can only be set if - # {::Google::Cloud::Retail::V2::ServingConfig#solution_types solution_types} is - # {::Google::Cloud::Retail::V2::SolutionType::SOLUTION_TYPE_RECOMMENDATION SOLUTION_TYPE_RECOMMENDATION}. - # @!attribute [rw] diversity_type - # @return [::Google::Cloud::Retail::V2::ServingConfig::DiversityType] - # What kind of diversity to use - data driven or rule based. If unset, the - # server behavior defaults to - # {::Google::Cloud::Retail::V2::ServingConfig::DiversityType::RULE_BASED_DIVERSITY RULE_BASED_DIVERSITY}. - # @!attribute [rw] enable_category_filter_level - # @return [::String] - # Whether to add additional category filters on the `similar-items` model. - # If not specified, we enable it by default. - # Allowed values are: - # - # * `no-category-match`: No additional filtering of original results from - # the model and the customer's filters. - # * `relaxed-category-match`: Only keep results with categories that match - # at least one item categories in the PredictRequests's context item. - # * If customer also sends filters in the PredictRequest, then the results - # will satisfy both conditions (user given and category match). - # - # Can only be set if - # {::Google::Cloud::Retail::V2::ServingConfig#solution_types solution_types} is - # {::Google::Cloud::Retail::V2::SolutionType::SOLUTION_TYPE_RECOMMENDATION SOLUTION_TYPE_RECOMMENDATION}. - # @!attribute [rw] ignore_recs_denylist - # @return [::Boolean] - # When the flag is enabled, the products in the denylist will not be filtered - # out in the recommendation filtering results. - # @!attribute [rw] personalization_spec - # @return [::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec] - # The specification for personalization spec. - # - # Can only be set if - # {::Google::Cloud::Retail::V2::ServingConfig#solution_types solution_types} is - # {::Google::Cloud::Retail::V2::SolutionType::SOLUTION_TYPE_SEARCH SOLUTION_TYPE_SEARCH}. - # - # Notice that if both - # {::Google::Cloud::Retail::V2::ServingConfig#personalization_spec ServingConfig.personalization_spec} - # and - # {::Google::Cloud::Retail::V2::SearchRequest#personalization_spec SearchRequest.personalization_spec} - # are set. - # {::Google::Cloud::Retail::V2::SearchRequest#personalization_spec SearchRequest.personalization_spec} - # will override - # {::Google::Cloud::Retail::V2::ServingConfig#personalization_spec ServingConfig.personalization_spec}. - # @!attribute [rw] solution_types - # @return [::Array<::Google::Cloud::Retail::V2::SolutionType>] - # Required. Immutable. Specifies the solution types that a serving config can - # be associated with. Currently we support setting only one type of solution. - class ServingConfig - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # What type of diversity - data or rule based. - module DiversityType - # Default value. - DIVERSITY_TYPE_UNSPECIFIED = 0 - - # Rule based diversity. - RULE_BASED_DIVERSITY = 2 - - # Data driven diversity. - DATA_DRIVEN_DIVERSITY = 3 - end - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/serving_config_service.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/serving_config_service.rb deleted file mode 100644 index 943913f2996e..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/serving_config_service.rb +++ /dev/null @@ -1,143 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Cloud - module Retail - module V2 - # Request for CreateServingConfig method. - # @!attribute [rw] parent - # @return [::String] - # Required. Full resource name of parent. Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - # @!attribute [rw] serving_config - # @return [::Google::Cloud::Retail::V2::ServingConfig] - # Required. The ServingConfig to create. - # @!attribute [rw] serving_config_id - # @return [::String] - # Required. The ID to use for the ServingConfig, which will become the final - # component of the ServingConfig's resource name. - # - # This value should be 4-63 characters, and valid characters - # are /[a-z][0-9]-_/. - class CreateServingConfigRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request for UpdateServingConfig method. - # @!attribute [rw] serving_config - # @return [::Google::Cloud::Retail::V2::ServingConfig] - # Required. The ServingConfig to update. - # @!attribute [rw] update_mask - # @return [::Google::Protobuf::FieldMask] - # Indicates which fields in the provided - # {::Google::Cloud::Retail::V2::ServingConfig ServingConfig} to update. The - # following are NOT supported: - # - # * {::Google::Cloud::Retail::V2::ServingConfig#name ServingConfig.name} - # - # If not set, all supported fields are updated. - class UpdateServingConfigRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request for DeleteServingConfig method. - # @!attribute [rw] name - # @return [::String] - # Required. The resource name of the ServingConfig to delete. Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` - class DeleteServingConfigRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request for GetServingConfig method. - # @!attribute [rw] name - # @return [::String] - # Required. The resource name of the ServingConfig to get. Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` - class GetServingConfigRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request for ListServingConfigs method. - # @!attribute [rw] parent - # @return [::String] - # Required. The catalog resource name. Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - # @!attribute [rw] page_size - # @return [::Integer] - # Optional. Maximum number of results to return. If unspecified, defaults - # to 100. If a value greater than 100 is provided, at most 100 results are - # returned. - # @!attribute [rw] page_token - # @return [::String] - # Optional. A page token, received from a previous `ListServingConfigs` call. - # Provide this to retrieve the subsequent page. - class ListServingConfigsRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Response for ListServingConfigs method. - # @!attribute [rw] serving_configs - # @return [::Array<::Google::Cloud::Retail::V2::ServingConfig>] - # All the ServingConfigs for a given catalog. - # @!attribute [rw] next_page_token - # @return [::String] - # Pagination token, if not returned indicates the last page. - class ListServingConfigsResponse - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request for AddControl method. - # @!attribute [rw] serving_config - # @return [::String] - # Required. The source ServingConfig resource name . Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` - # @!attribute [rw] control_id - # @return [::String] - # Required. The id of the control to apply. Assumed to be in the same catalog - # as the serving config - if id is not found a NOT_FOUND error is returned. - class AddControlRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request for RemoveControl method. - # @!attribute [rw] serving_config - # @return [::String] - # Required. The source ServingConfig resource name . Format: - # `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` - # @!attribute [rw] control_id - # @return [::String] - # Required. The id of the control to apply. Assumed to be in the same catalog - # as the serving config. - class RemoveControlRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/user_event.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/user_event.rb deleted file mode 100644 index 2c119fd76473..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/user_event.rb +++ /dev/null @@ -1,364 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Cloud - module Retail - module V2 - # UserEvent captures all metadata information Retail API needs to know about - # how end users interact with customers' website. - # @!attribute [rw] event_type - # @return [::String] - # Required. User event type. Allowed values are: - # - # * `add-to-cart`: Products being added to cart. - # * `remove-from-cart`: Products being removed from cart. - # * `category-page-view`: Special pages such as sale or promotion pages - # viewed. - # * `detail-page-view`: Products detail page viewed. - # * `home-page-view`: Homepage viewed. - # * `purchase-complete`: User finishing a purchase. - # * `search`: Product search. - # * `shopping-cart-page-view`: User viewing a shopping cart. - # @!attribute [rw] visitor_id - # @return [::String] - # Required. A unique identifier for tracking visitors. - # - # For example, this could be implemented with an HTTP cookie, which should be - # able to uniquely identify a visitor on a single device. This unique - # identifier should not change if the visitor log in/out of the website. - # - # Don't set the field to the same fixed ID for different users. This mixes - # the event history of those users together, which results in degraded model - # quality. - # - # The field must be a UTF-8 encoded string with a length limit of 128 - # characters. Otherwise, an INVALID_ARGUMENT error is returned. - # - # The field should not contain PII or user-data. We recommend to use Google - # Analytics [Client - # ID](https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#clientId) - # for this field. - # @!attribute [rw] session_id - # @return [::String] - # A unique identifier for tracking a visitor session with a length limit of - # 128 bytes. A session is an aggregation of an end user behavior in a time - # span. - # - # A general guideline to populate the session_id: - # 1. If user has no activity for 30 min, a new session_id should be assigned. - # 2. The session_id should be unique across users, suggest use uuid or add - # visitor_id as prefix. - # @!attribute [rw] event_time - # @return [::Google::Protobuf::Timestamp] - # Only required for - # {::Google::Cloud::Retail::V2::UserEventService::Client#import_user_events UserEventService.ImportUserEvents} - # method. Timestamp of when the user event happened. - # @!attribute [rw] experiment_ids - # @return [::Array<::String>] - # A list of identifiers for the independent experiment groups this user event - # belongs to. This is used to distinguish between user events associated with - # different experiment setups (e.g. using Retail API, using different - # recommendation models). - # @!attribute [rw] attribution_token - # @return [::String] - # Highly recommended for user events that are the result of - # {::Google::Cloud::Retail::V2::PredictionService::Client#predict PredictionService.Predict}. - # This field enables accurate attribution of recommendation model - # performance. - # - # The value must be a valid - # {::Google::Cloud::Retail::V2::PredictResponse#attribution_token PredictResponse.attribution_token} - # for user events that are the result of - # {::Google::Cloud::Retail::V2::PredictionService::Client#predict PredictionService.Predict}. - # The value must be a valid - # {::Google::Cloud::Retail::V2::SearchResponse#attribution_token SearchResponse.attribution_token} - # for user events that are the result of - # {::Google::Cloud::Retail::V2::SearchService::Client#search SearchService.Search}. - # - # This token enables us to accurately attribute page view or purchase back to - # the event and the particular predict response containing this - # clicked/purchased product. If user clicks on product K in the - # recommendation results, pass - # {::Google::Cloud::Retail::V2::PredictResponse#attribution_token PredictResponse.attribution_token} - # as a URL parameter to product K's page. When recording events on product - # K's page, log the - # {::Google::Cloud::Retail::V2::PredictResponse#attribution_token PredictResponse.attribution_token} - # to this field. - # @!attribute [rw] product_details - # @return [::Array<::Google::Cloud::Retail::V2::ProductDetail>] - # The main product details related to the event. - # - # This field is optional except for the following event types: - # - # * `add-to-cart` - # * `detail-page-view` - # * `purchase-complete` - # - # In a `search` event, this field represents the products returned to the end - # user on the current page (the end user may have not finished browsing the - # whole page yet). When a new page is returned to the end user, after - # pagination/filtering/ordering even for the same query, a new `search` event - # with different - # {::Google::Cloud::Retail::V2::UserEvent#product_details product_details} is - # desired. The end user may have not finished browsing the whole page yet. - # @!attribute [rw] completion_detail - # @return [::Google::Cloud::Retail::V2::CompletionDetail] - # The main auto-completion details related to the event. - # - # This field should be set for `search` event when autocomplete function is - # enabled and the user clicks a suggestion for search. - # @!attribute [rw] attributes - # @return [::Google::Protobuf::Map{::String => ::Google::Cloud::Retail::V2::CustomAttribute}] - # Extra user event features to include in the recommendation model. - # - # If you provide custom attributes for ingested user events, also include - # them in the user events that you associate with prediction requests. Custom - # attribute formatting must be consistent between imported events and events - # provided with prediction requests. This lets the Retail API use - # those custom attributes when training models and serving predictions, which - # helps improve recommendation quality. - # - # This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT - # error is returned: - # - # * The key must be a UTF-8 encoded string with a length limit of 5,000 - # characters. - # * For text attributes, at most 400 values are allowed. Empty values are not - # allowed. Each value must be a UTF-8 encoded string with a length limit of - # 256 characters. - # * For number attributes, at most 400 values are allowed. - # - # For product recommendations, an example of extra user information is - # traffic_channel, which is how a user arrives at the site. Users can arrive - # at the site by coming to the site directly, coming through Google - # search, or in other ways. - # @!attribute [rw] cart_id - # @return [::String] - # The ID or name of the associated shopping cart. This ID is used - # to associate multiple items added or present in the cart before purchase. - # - # This can only be set for `add-to-cart`, `purchase-complete`, or - # `shopping-cart-page-view` events. - # @!attribute [rw] purchase_transaction - # @return [::Google::Cloud::Retail::V2::PurchaseTransaction] - # A transaction represents the entire purchase transaction. - # - # Required for `purchase-complete` events. Other event types should not set - # this field. Otherwise, an INVALID_ARGUMENT error is returned. - # @!attribute [rw] search_query - # @return [::String] - # The user's search query. - # - # See {::Google::Cloud::Retail::V2::SearchRequest#query SearchRequest.query} for - # definition. - # - # The value must be a UTF-8 encoded string with a length limit of 5,000 - # characters. Otherwise, an INVALID_ARGUMENT error is returned. - # - # At least one of - # {::Google::Cloud::Retail::V2::UserEvent#search_query search_query} or - # {::Google::Cloud::Retail::V2::UserEvent#page_categories page_categories} is - # required for `search` events. Other event types should not set this field. - # Otherwise, an INVALID_ARGUMENT error is returned. - # @!attribute [rw] filter - # @return [::String] - # The filter syntax consists of an expression language for constructing a - # predicate from one or more fields of the products being filtered. - # - # See {::Google::Cloud::Retail::V2::SearchRequest#filter SearchRequest.filter} for - # definition and syntax. - # - # The value must be a UTF-8 encoded string with a length limit of 1,000 - # characters. Otherwise, an INVALID_ARGUMENT error is returned. - # @!attribute [rw] order_by - # @return [::String] - # The order in which products are returned. - # - # See {::Google::Cloud::Retail::V2::SearchRequest#order_by SearchRequest.order_by} - # for definition and syntax. - # - # The value must be a UTF-8 encoded string with a length limit of 1,000 - # characters. Otherwise, an INVALID_ARGUMENT error is returned. - # - # This can only be set for `search` events. Other event types should not set - # this field. Otherwise, an INVALID_ARGUMENT error is returned. - # @!attribute [rw] offset - # @return [::Integer] - # An integer that specifies the current offset for pagination (the 0-indexed - # starting location, amongst the products deemed by the API as relevant). - # - # See {::Google::Cloud::Retail::V2::SearchRequest#offset SearchRequest.offset} for - # definition. - # - # If this field is negative, an INVALID_ARGUMENT is returned. - # - # This can only be set for `search` events. Other event types should not set - # this field. Otherwise, an INVALID_ARGUMENT error is returned. - # @!attribute [rw] page_categories - # @return [::Array<::String>] - # The categories associated with a category page. - # - # To represent full path of category, use '>' sign to separate different - # hierarchies. If '>' is part of the category name, replace it with - # other character(s). - # - # Category pages include special pages such as sales or promotions. For - # instance, a special sale page may have the category hierarchy: - # "pageCategories" : ["Sales > 2017 Black Friday Deals"]. - # - # Required for `category-page-view` events. At least one of - # {::Google::Cloud::Retail::V2::UserEvent#search_query search_query} or - # {::Google::Cloud::Retail::V2::UserEvent#page_categories page_categories} is - # required for `search` events. Other event types should not set this field. - # Otherwise, an INVALID_ARGUMENT error is returned. - # @!attribute [rw] user_info - # @return [::Google::Cloud::Retail::V2::UserInfo] - # User information. - # @!attribute [rw] uri - # @return [::String] - # Complete URL (window.location.href) of the user's current page. - # - # When using the client side event reporting with JavaScript pixel and Google - # Tag Manager, this value is filled in automatically. Maximum length 5,000 - # characters. - # @!attribute [rw] referrer_uri - # @return [::String] - # The referrer URL of the current page. - # - # When using the client side event reporting with JavaScript pixel and Google - # Tag Manager, this value is filled in automatically. - # @!attribute [rw] page_view_id - # @return [::String] - # A unique ID of a web page view. - # - # This should be kept the same for all user events triggered from the same - # pageview. For example, an item detail page view could trigger multiple - # events as the user is browsing the page. The `pageViewId` property should - # be kept the same for all these events so that they can be grouped together - # properly. - # - # When using the client side event reporting with JavaScript pixel and Google - # Tag Manager, this value is filled in automatically. - # @!attribute [rw] entity - # @return [::String] - # The entity for customers that may run multiple different entities, domains, - # sites or regions, for example, `Google US`, `Google Ads`, `Waymo`, - # `google.com`, `youtube.com`, etc. - # We recommend that you set this field to get better per-entity search, - # completion, and prediction results. - class UserEvent - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # @!attribute [rw] key - # @return [::String] - # @!attribute [rw] value - # @return [::Google::Cloud::Retail::V2::CustomAttribute] - class AttributesEntry - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - - # Detailed product information associated with a user event. - # @!attribute [rw] product - # @return [::Google::Cloud::Retail::V2::Product] - # Required. {::Google::Cloud::Retail::V2::Product Product} information. - # - # Required field(s): - # - # * {::Google::Cloud::Retail::V2::Product#id Product.id} - # - # Optional override field(s): - # - # * {::Google::Cloud::Retail::V2::Product#price_info Product.price_info} - # - # If any supported optional fields are provided, we will treat them as a full - # override when looking up product information from the catalog. Thus, it is - # important to ensure that the overriding fields are accurate and - # complete. - # - # All other product fields are ignored and instead populated via catalog - # lookup after event ingestion. - # @!attribute [rw] quantity - # @return [::Google::Protobuf::Int32Value] - # Quantity of the product associated with the user event. - # - # For example, this field will be 2 if two products are added to the shopping - # cart for `purchase-complete` event. Required for `add-to-cart` and - # `purchase-complete` event types. - class ProductDetail - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Detailed completion information including completion attribution token and - # clicked completion info. - # @!attribute [rw] completion_attribution_token - # @return [::String] - # Completion attribution token in - # {::Google::Cloud::Retail::V2::CompleteQueryResponse#attribution_token CompleteQueryResponse.attribution_token}. - # @!attribute [rw] selected_suggestion - # @return [::String] - # End user selected - # {::Google::Cloud::Retail::V2::CompleteQueryResponse::CompletionResult#suggestion CompleteQueryResponse.CompletionResult.suggestion}. - # @!attribute [rw] selected_position - # @return [::Integer] - # End user selected - # {::Google::Cloud::Retail::V2::CompleteQueryResponse::CompletionResult#suggestion CompleteQueryResponse.CompletionResult.suggestion} - # position, starting from 0. - class CompletionDetail - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # A transaction represents the entire purchase transaction. - # @!attribute [rw] id - # @return [::String] - # The transaction ID with a length limit of 128 characters. - # @!attribute [rw] revenue - # @return [::Float] - # Required. Total non-zero revenue or grand total associated with the - # transaction. This value include shipping, tax, or other adjustments to - # total revenue that you want to include as part of your revenue - # calculations. - # @!attribute [rw] tax - # @return [::Float] - # All the taxes associated with the transaction. - # @!attribute [rw] cost - # @return [::Float] - # All the costs associated with the products. These can be manufacturing - # costs, shipping expenses not borne by the end user, or any other costs, - # such that: - # - # * Profit = {::Google::Cloud::Retail::V2::PurchaseTransaction#revenue revenue} - - # {::Google::Cloud::Retail::V2::PurchaseTransaction#tax tax} - - # {::Google::Cloud::Retail::V2::PurchaseTransaction#cost cost} - # @!attribute [rw] currency_code - # @return [::String] - # Required. Currency code. Use three-character ISO-4217 code. - class PurchaseTransaction - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/user_event_service.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/user_event_service.rb deleted file mode 100644 index cb0896f85338..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/cloud/retail/v2/user_event_service.rb +++ /dev/null @@ -1,130 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Cloud - module Retail - module V2 - # Request message for WriteUserEvent method. - # @!attribute [rw] parent - # @return [::String] - # Required. The parent catalog resource name, such as - # `projects/1234/locations/global/catalogs/default_catalog`. - # @!attribute [rw] user_event - # @return [::Google::Cloud::Retail::V2::UserEvent] - # Required. User event to write. - # @!attribute [rw] write_async - # @return [::Boolean] - # If set to true, the user event will be written asynchronously after - # validation, and the API will respond without waiting for the write. - # Therefore, silent failures can occur even if the API returns success. In - # case of silent failures, error messages can be found in Stackdriver logs. - class WriteUserEventRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request message for CollectUserEvent method. - # @!attribute [rw] prebuilt_rule - # @return [::String] - # The prebuilt rule name that can convert a specific type of raw_json. - # For example: "ga4_bq" rule for the GA4 user event schema. - # @!attribute [rw] parent - # @return [::String] - # Required. The parent catalog name, such as - # `projects/1234/locations/global/catalogs/default_catalog`. - # @!attribute [rw] user_event - # @return [::String] - # Required. URL encoded UserEvent proto with a length limit of 2,000,000 - # characters. - # @!attribute [rw] uri - # @return [::String] - # The URL including cgi-parameters but excluding the hash fragment with a - # length limit of 5,000 characters. This is often more useful than the - # referer URL, because many browsers only send the domain for 3rd party - # requests. - # @!attribute [rw] ets - # @return [::Integer] - # The event timestamp in milliseconds. This prevents browser caching of - # otherwise identical get requests. The name is abbreviated to reduce the - # payload bytes. - # @!attribute [rw] raw_json - # @return [::String] - # An arbitrary serialized JSON string that contains necessary information - # that can comprise a user event. When this field is specified, the - # user_event field will be ignored. Note: line-delimited JSON is not - # supported, a single JSON only. - class CollectUserEventRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Request message for RejoinUserEvents method. - # @!attribute [rw] parent - # @return [::String] - # Required. The parent catalog resource name, such as - # `projects/1234/locations/global/catalogs/default_catalog`. - # @!attribute [rw] user_event_rejoin_scope - # @return [::Google::Cloud::Retail::V2::RejoinUserEventsRequest::UserEventRejoinScope] - # The type of the user event rejoin to define the scope and range of the user - # events to be rejoined with the latest product catalog. Defaults to - # `USER_EVENT_REJOIN_SCOPE_UNSPECIFIED` if this field is not set, or set to - # an invalid integer value. - class RejoinUserEventsRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # The scope of user events to be rejoined with the latest product catalog. - # If the rejoining aims at reducing number of unjoined events, set - # `UserEventRejoinScope` to `UNJOINED_EVENTS`. - # If the rejoining aims at correcting product catalog information in joined - # events, set `UserEventRejoinScope` to `JOINED_EVENTS`. - # If all events needs to be rejoined, set `UserEventRejoinScope` to - # `USER_EVENT_REJOIN_SCOPE_UNSPECIFIED`. - module UserEventRejoinScope - # Rejoin all events with the latest product catalog, including both joined - # events and unjoined events. - USER_EVENT_REJOIN_SCOPE_UNSPECIFIED = 0 - - # Only rejoin joined events with the latest product catalog. - JOINED_EVENTS = 1 - - # Only rejoin unjoined events with the latest product catalog. - UNJOINED_EVENTS = 2 - end - end - - # Response message for `RejoinUserEvents` method. - # @!attribute [rw] rejoined_user_events_count - # @return [::Integer] - # Number of user events that were joined with latest product catalog. - class RejoinUserEventsResponse - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Metadata for `RejoinUserEvents` method. - class RejoinUserEventsMetadata - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/longrunning/operations.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/longrunning/operations.rb deleted file mode 100644 index 7a757f512165..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/longrunning/operations.rb +++ /dev/null @@ -1,191 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Longrunning - # This resource represents a long-running operation that is the result of a - # network API call. - # @!attribute [rw] name - # @return [::String] - # The server-assigned name, which is only unique within the same service that - # originally returns it. If you use the default HTTP mapping, the - # `name` should be a resource name ending with `operations/{unique_id}`. - # @!attribute [rw] metadata - # @return [::Google::Protobuf::Any] - # Service-specific metadata associated with the operation. It typically - # contains progress information and common metadata such as create time. - # Some services might not provide such metadata. Any method that returns a - # long-running operation should document the metadata type, if any. - # @!attribute [rw] done - # @return [::Boolean] - # If the value is `false`, it means the operation is still in progress. - # If `true`, the operation is completed, and either `error` or `response` is - # available. - # @!attribute [rw] error - # @return [::Google::Rpc::Status] - # The error result of the operation in case of failure or cancellation. - # - # Note: The following fields are mutually exclusive: `error`, `response`. If a field in that set is populated, all other fields in the set will automatically be cleared. - # @!attribute [rw] response - # @return [::Google::Protobuf::Any] - # The normal, successful response of the operation. If the original - # method returns no data on success, such as `Delete`, the response is - # `google.protobuf.Empty`. If the original method is standard - # `Get`/`Create`/`Update`, the response should be the resource. For other - # methods, the response should have the type `XxxResponse`, where `Xxx` - # is the original method name. For example, if the original method name - # is `TakeSnapshot()`, the inferred response type is - # `TakeSnapshotResponse`. - # - # Note: The following fields are mutually exclusive: `response`, `error`. If a field in that set is populated, all other fields in the set will automatically be cleared. - class Operation - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # The request message for - # Operations.GetOperation. - # @!attribute [rw] name - # @return [::String] - # The name of the operation resource. - class GetOperationRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # The request message for - # Operations.ListOperations. - # @!attribute [rw] name - # @return [::String] - # The name of the operation's parent resource. - # @!attribute [rw] filter - # @return [::String] - # The standard list filter. - # @!attribute [rw] page_size - # @return [::Integer] - # The standard list page size. - # @!attribute [rw] page_token - # @return [::String] - # The standard list page token. - # @!attribute [rw] return_partial_success - # @return [::Boolean] - # When set to `true`, operations that are reachable are returned as normal, - # and those that are unreachable are returned in the - # [ListOperationsResponse.unreachable] field. - # - # This can only be `true` when reading across collections e.g. when `parent` - # is set to `"projects/example/locations/-"`. - # - # This field is not by default supported and will result in an - # `UNIMPLEMENTED` error if set unless explicitly documented otherwise in - # service or product specific documentation. - class ListOperationsRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # The response message for - # Operations.ListOperations. - # @!attribute [rw] operations - # @return [::Array<::Google::Longrunning::Operation>] - # A list of operations that matches the specified filter in the request. - # @!attribute [rw] next_page_token - # @return [::String] - # The standard List next-page token. - # @!attribute [rw] unreachable - # @return [::Array<::String>] - # Unordered list. Unreachable resources. Populated when the request sets - # `ListOperationsRequest.return_partial_success` and reads across - # collections e.g. when attempting to list all resources across all supported - # locations. - class ListOperationsResponse - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # The request message for - # Operations.CancelOperation. - # @!attribute [rw] name - # @return [::String] - # The name of the operation resource to be cancelled. - class CancelOperationRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # The request message for - # Operations.DeleteOperation. - # @!attribute [rw] name - # @return [::String] - # The name of the operation resource to be deleted. - class DeleteOperationRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # The request message for - # Operations.WaitOperation. - # @!attribute [rw] name - # @return [::String] - # The name of the operation resource to wait on. - # @!attribute [rw] timeout - # @return [::Google::Protobuf::Duration] - # The maximum duration to wait before timing out. If left blank, the wait - # will be at most the time permitted by the underlying HTTP/RPC protocol. - # If RPC context deadline is also specified, the shorter one will be used. - class WaitOperationRequest - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # A message representing the message types used by a long-running operation. - # - # Example: - # - # rpc Export(ExportRequest) returns (google.longrunning.Operation) { - # option (google.longrunning.operation_info) = { - # response_type: "ExportResponse" - # metadata_type: "ExportMetadata" - # }; - # } - # @!attribute [rw] response_type - # @return [::String] - # Required. The message name of the primary return type for this - # long-running operation. - # This type will be used to deserialize the LRO's response. - # - # If the response is in a different package from the rpc, a fully-qualified - # message name must be used (e.g. `google.protobuf.Struct`). - # - # Note: Altering this value constitutes a breaking change. - # @!attribute [rw] metadata_type - # @return [::String] - # Required. The message name of the metadata type for this long-running - # operation. - # - # If the response is in a different package from the rpc, a fully-qualified - # message name must be used (e.g. `google.protobuf.Struct`). - # - # Note: Altering this value constitutes a breaking change. - class OperationInfo - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/any.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/any.rb deleted file mode 100644 index 58691995f02e..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/any.rb +++ /dev/null @@ -1,145 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Protobuf - # `Any` contains an arbitrary serialized protocol buffer message along with a - # URL that describes the type of the serialized message. - # - # Protobuf library provides support to pack/unpack Any values in the form - # of utility functions or additional generated methods of the Any type. - # - # Example 1: Pack and unpack a message in C++. - # - # Foo foo = ...; - # Any any; - # any.PackFrom(foo); - # ... - # if (any.UnpackTo(&foo)) { - # ... - # } - # - # Example 2: Pack and unpack a message in Java. - # - # Foo foo = ...; - # Any any = Any.pack(foo); - # ... - # if (any.is(Foo.class)) { - # foo = any.unpack(Foo.class); - # } - # // or ... - # if (any.isSameTypeAs(Foo.getDefaultInstance())) { - # foo = any.unpack(Foo.getDefaultInstance()); - # } - # - # Example 3: Pack and unpack a message in Python. - # - # foo = Foo(...) - # any = Any() - # any.Pack(foo) - # ... - # if any.Is(Foo.DESCRIPTOR): - # any.Unpack(foo) - # ... - # - # Example 4: Pack and unpack a message in Go - # - # foo := &pb.Foo{...} - # any, err := anypb.New(foo) - # if err != nil { - # ... - # } - # ... - # foo := &pb.Foo{} - # if err := any.UnmarshalTo(foo); err != nil { - # ... - # } - # - # The pack methods provided by protobuf library will by default use - # 'type.googleapis.com/full.type.name' as the type URL and the unpack - # methods only use the fully qualified type name after the last '/' - # in the type URL, for example "foo.bar.com/x/y.z" will yield type - # name "y.z". - # - # JSON - # ==== - # The JSON representation of an `Any` value uses the regular - # representation of the deserialized, embedded message, with an - # additional field `@type` which contains the type URL. Example: - # - # package google.profile; - # message Person { - # string first_name = 1; - # string last_name = 2; - # } - # - # { - # "@type": "type.googleapis.com/google.profile.Person", - # "firstName": , - # "lastName": - # } - # - # If the embedded message type is well-known and has a custom JSON - # representation, that representation will be embedded adding a field - # `value` which holds the custom JSON in addition to the `@type` - # field. Example (for message [google.protobuf.Duration][]): - # - # { - # "@type": "type.googleapis.com/google.protobuf.Duration", - # "value": "1.212s" - # } - # @!attribute [rw] type_url - # @return [::String] - # A URL/resource name that uniquely identifies the type of the serialized - # protocol buffer message. This string must contain at least - # one "/" character. The last segment of the URL's path must represent - # the fully qualified name of the type (as in - # `path/google.protobuf.Duration`). The name should be in a canonical form - # (e.g., leading "." is not accepted). - # - # In practice, teams usually precompile into the binary all types that they - # expect it to use in the context of Any. However, for URLs which use the - # scheme `http`, `https`, or no scheme, one can optionally set up a type - # server that maps type URLs to message definitions as follows: - # - # * If no scheme is provided, `https` is assumed. - # * An HTTP GET on the URL must yield a [google.protobuf.Type][] - # value in binary format, or produce an error. - # * Applications are allowed to cache lookup results based on the - # URL, or have them precompiled into a binary to avoid any - # lookup. Therefore, binary compatibility needs to be preserved - # on changes to types. (Use versioned type names to manage - # breaking changes.) - # - # Note: this functionality is not currently available in the official - # protobuf release, and it is not used for type URLs beginning with - # type.googleapis.com. As of May 2023, there are no widely used type server - # implementations and no plans to implement one. - # - # Schemes other than `http`, `https` (or the empty scheme) might be - # used with implementation specific semantics. - # @!attribute [rw] value - # @return [::String] - # Must be a valid serialized protocol buffer of the above specified type. - class Any - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/duration.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/duration.rb deleted file mode 100644 index ea59f1f91daf..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/duration.rb +++ /dev/null @@ -1,98 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Protobuf - # A Duration represents a signed, fixed-length span of time represented - # as a count of seconds and fractions of seconds at nanosecond - # resolution. It is independent of any calendar and concepts like "day" - # or "month". It is related to Timestamp in that the difference between - # two Timestamp values is a Duration and it can be added or subtracted - # from a Timestamp. Range is approximately +-10,000 years. - # - # # Examples - # - # Example 1: Compute Duration from two Timestamps in pseudo code. - # - # Timestamp start = ...; - # Timestamp end = ...; - # Duration duration = ...; - # - # duration.seconds = end.seconds - start.seconds; - # duration.nanos = end.nanos - start.nanos; - # - # if (duration.seconds < 0 && duration.nanos > 0) { - # duration.seconds += 1; - # duration.nanos -= 1000000000; - # } else if (duration.seconds > 0 && duration.nanos < 0) { - # duration.seconds -= 1; - # duration.nanos += 1000000000; - # } - # - # Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. - # - # Timestamp start = ...; - # Duration duration = ...; - # Timestamp end = ...; - # - # end.seconds = start.seconds + duration.seconds; - # end.nanos = start.nanos + duration.nanos; - # - # if (end.nanos < 0) { - # end.seconds -= 1; - # end.nanos += 1000000000; - # } else if (end.nanos >= 1000000000) { - # end.seconds += 1; - # end.nanos -= 1000000000; - # } - # - # Example 3: Compute Duration from datetime.timedelta in Python. - # - # td = datetime.timedelta(days=3, minutes=10) - # duration = Duration() - # duration.FromTimedelta(td) - # - # # JSON Mapping - # - # In JSON format, the Duration type is encoded as a string rather than an - # object, where the string ends in the suffix "s" (indicating seconds) and - # is preceded by the number of seconds, with nanoseconds expressed as - # fractional seconds. For example, 3 seconds with 0 nanoseconds should be - # encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should - # be expressed in JSON format as "3.000000001s", and 3 seconds and 1 - # microsecond should be expressed in JSON format as "3.000001s". - # @!attribute [rw] seconds - # @return [::Integer] - # Signed seconds of the span of time. Must be from -315,576,000,000 - # to +315,576,000,000 inclusive. Note: these bounds are computed from: - # 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years - # @!attribute [rw] nanos - # @return [::Integer] - # Signed fractions of a second at nanosecond resolution of the span - # of time. Durations less than one second are represented with a 0 - # `seconds` field and a positive or negative `nanos` field. For durations - # of one second or more, a non-zero value for the `nanos` field must be - # of the same sign as the `seconds` field. Must be from -999,999,999 - # to +999,999,999 inclusive. - class Duration - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/empty.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/empty.rb deleted file mode 100644 index 83e4481834a6..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/empty.rb +++ /dev/null @@ -1,34 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Protobuf - # A generic empty message that you can re-use to avoid defining duplicated - # empty messages in your APIs. A typical example is to use it as the request - # or the response type of an API method. For instance: - # - # service Foo { - # rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); - # } - class Empty - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/field_mask.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/field_mask.rb deleted file mode 100644 index 7f3ffc78601a..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/field_mask.rb +++ /dev/null @@ -1,229 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Protobuf - # `FieldMask` represents a set of symbolic field paths, for example: - # - # paths: "f.a" - # paths: "f.b.d" - # - # Here `f` represents a field in some root message, `a` and `b` - # fields in the message found in `f`, and `d` a field found in the - # message in `f.b`. - # - # Field masks are used to specify a subset of fields that should be - # returned by a get operation or modified by an update operation. - # Field masks also have a custom JSON encoding (see below). - # - # # Field Masks in Projections - # - # When used in the context of a projection, a response message or - # sub-message is filtered by the API to only contain those fields as - # specified in the mask. For example, if the mask in the previous - # example is applied to a response message as follows: - # - # f { - # a : 22 - # b { - # d : 1 - # x : 2 - # } - # y : 13 - # } - # z: 8 - # - # The result will not contain specific values for fields x,y and z - # (their value will be set to the default, and omitted in proto text - # output): - # - # - # f { - # a : 22 - # b { - # d : 1 - # } - # } - # - # A repeated field is not allowed except at the last position of a - # paths string. - # - # If a FieldMask object is not present in a get operation, the - # operation applies to all fields (as if a FieldMask of all fields - # had been specified). - # - # Note that a field mask does not necessarily apply to the - # top-level response message. In case of a REST get operation, the - # field mask applies directly to the response, but in case of a REST - # list operation, the mask instead applies to each individual message - # in the returned resource list. In case of a REST custom method, - # other definitions may be used. Where the mask applies will be - # clearly documented together with its declaration in the API. In - # any case, the effect on the returned resource/resources is required - # behavior for APIs. - # - # # Field Masks in Update Operations - # - # A field mask in update operations specifies which fields of the - # targeted resource are going to be updated. The API is required - # to only change the values of the fields as specified in the mask - # and leave the others untouched. If a resource is passed in to - # describe the updated values, the API ignores the values of all - # fields not covered by the mask. - # - # If a repeated field is specified for an update operation, new values will - # be appended to the existing repeated field in the target resource. Note that - # a repeated field is only allowed in the last position of a `paths` string. - # - # If a sub-message is specified in the last position of the field mask for an - # update operation, then new value will be merged into the existing sub-message - # in the target resource. - # - # For example, given the target message: - # - # f { - # b { - # d: 1 - # x: 2 - # } - # c: [1] - # } - # - # And an update message: - # - # f { - # b { - # d: 10 - # } - # c: [2] - # } - # - # then if the field mask is: - # - # paths: ["f.b", "f.c"] - # - # then the result will be: - # - # f { - # b { - # d: 10 - # x: 2 - # } - # c: [1, 2] - # } - # - # An implementation may provide options to override this default behavior for - # repeated and message fields. - # - # In order to reset a field's value to the default, the field must - # be in the mask and set to the default value in the provided resource. - # Hence, in order to reset all fields of a resource, provide a default - # instance of the resource and set all fields in the mask, or do - # not provide a mask as described below. - # - # If a field mask is not present on update, the operation applies to - # all fields (as if a field mask of all fields has been specified). - # Note that in the presence of schema evolution, this may mean that - # fields the client does not know and has therefore not filled into - # the request will be reset to their default. If this is unwanted - # behavior, a specific service may require a client to always specify - # a field mask, producing an error if not. - # - # As with get operations, the location of the resource which - # describes the updated values in the request message depends on the - # operation kind. In any case, the effect of the field mask is - # required to be honored by the API. - # - # ## Considerations for HTTP REST - # - # The HTTP kind of an update operation which uses a field mask must - # be set to PATCH instead of PUT in order to satisfy HTTP semantics - # (PUT must only be used for full updates). - # - # # JSON Encoding of Field Masks - # - # In JSON, a field mask is encoded as a single string where paths are - # separated by a comma. Fields name in each path are converted - # to/from lower-camel naming conventions. - # - # As an example, consider the following message declarations: - # - # message Profile { - # User user = 1; - # Photo photo = 2; - # } - # message User { - # string display_name = 1; - # string address = 2; - # } - # - # In proto a field mask for `Profile` may look as such: - # - # mask { - # paths: "user.display_name" - # paths: "photo" - # } - # - # In JSON, the same mask is represented as below: - # - # { - # mask: "user.displayName,photo" - # } - # - # # Field Masks and Oneof Fields - # - # Field masks treat fields in oneofs just as regular fields. Consider the - # following message: - # - # message SampleMessage { - # oneof test_oneof { - # string name = 4; - # SubMessage sub_message = 9; - # } - # } - # - # The field mask can be: - # - # mask { - # paths: "name" - # } - # - # Or: - # - # mask { - # paths: "sub_message" - # } - # - # Note that oneof type names ("test_oneof" in this case) cannot be used in - # paths. - # - # ## Field Mask Verification - # - # The implementation of any API method which has a FieldMask type field in the - # request should verify the included field paths, and return an - # `INVALID_ARGUMENT` error if any path is unmappable. - # @!attribute [rw] paths - # @return [::Array<::String>] - # The set of field mask paths. - class FieldMask - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/struct.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/struct.rb deleted file mode 100644 index 39e1aca868d2..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/struct.rb +++ /dev/null @@ -1,108 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Protobuf - # `Struct` represents a structured data value, consisting of fields - # which map to dynamically typed values. In some languages, `Struct` - # might be supported by a native representation. For example, in - # scripting languages like JS a struct is represented as an - # object. The details of that representation are described together - # with the proto support for the language. - # - # The JSON representation for `Struct` is JSON object. - # @!attribute [rw] fields - # @return [::Google::Protobuf::Map{::String => ::Google::Protobuf::Value}] - # Unordered map of dynamically typed values. - class Struct - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - - # @!attribute [rw] key - # @return [::String] - # @!attribute [rw] value - # @return [::Google::Protobuf::Value] - class FieldsEntry - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end - - # `Value` represents a dynamically typed value which can be either - # null, a number, a string, a boolean, a recursive struct value, or a - # list of values. A producer of value is expected to set one of these - # variants. Absence of any variant indicates an error. - # - # The JSON representation for `Value` is JSON value. - # @!attribute [rw] null_value - # @return [::Google::Protobuf::NullValue] - # Represents a null value. - # - # Note: The following fields are mutually exclusive: `null_value`, `number_value`, `string_value`, `bool_value`, `struct_value`, `list_value`. If a field in that set is populated, all other fields in the set will automatically be cleared. - # @!attribute [rw] number_value - # @return [::Float] - # Represents a double value. - # - # Note: The following fields are mutually exclusive: `number_value`, `null_value`, `string_value`, `bool_value`, `struct_value`, `list_value`. If a field in that set is populated, all other fields in the set will automatically be cleared. - # @!attribute [rw] string_value - # @return [::String] - # Represents a string value. - # - # Note: The following fields are mutually exclusive: `string_value`, `null_value`, `number_value`, `bool_value`, `struct_value`, `list_value`. If a field in that set is populated, all other fields in the set will automatically be cleared. - # @!attribute [rw] bool_value - # @return [::Boolean] - # Represents a boolean value. - # - # Note: The following fields are mutually exclusive: `bool_value`, `null_value`, `number_value`, `string_value`, `struct_value`, `list_value`. If a field in that set is populated, all other fields in the set will automatically be cleared. - # @!attribute [rw] struct_value - # @return [::Google::Protobuf::Struct] - # Represents a structured value. - # - # Note: The following fields are mutually exclusive: `struct_value`, `null_value`, `number_value`, `string_value`, `bool_value`, `list_value`. If a field in that set is populated, all other fields in the set will automatically be cleared. - # @!attribute [rw] list_value - # @return [::Google::Protobuf::ListValue] - # Represents a repeated `Value`. - # - # Note: The following fields are mutually exclusive: `list_value`, `null_value`, `number_value`, `string_value`, `bool_value`, `struct_value`. If a field in that set is populated, all other fields in the set will automatically be cleared. - class Value - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # `ListValue` is a wrapper around a repeated field of values. - # - # The JSON representation for `ListValue` is JSON array. - # @!attribute [rw] values - # @return [::Array<::Google::Protobuf::Value>] - # Repeated field of dynamically typed values. - class ListValue - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # `NullValue` is a singleton enumeration to represent the null value for the - # `Value` type union. - # - # The JSON representation for `NullValue` is JSON `null`. - module NullValue - # Null value. - NULL_VALUE = 0 - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/timestamp.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/timestamp.rb deleted file mode 100644 index e58202461f88..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/timestamp.rb +++ /dev/null @@ -1,128 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Protobuf - # A Timestamp represents a point in time independent of any time zone or local - # calendar, encoded as a count of seconds and fractions of seconds at - # nanosecond resolution. The count is relative to an epoch at UTC midnight on - # January 1, 1970, in the proleptic Gregorian calendar which extends the - # Gregorian calendar backwards to year one. - # - # All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap - # second table is needed for interpretation, using a [24-hour linear - # smear](https://developers.google.com/time/smear). - # - # The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By - # restricting to that range, we ensure that we can convert to and from [RFC - # 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. - # - # # Examples - # - # Example 1: Compute Timestamp from POSIX `time()`. - # - # Timestamp timestamp; - # timestamp.set_seconds(time(NULL)); - # timestamp.set_nanos(0); - # - # Example 2: Compute Timestamp from POSIX `gettimeofday()`. - # - # struct timeval tv; - # gettimeofday(&tv, NULL); - # - # Timestamp timestamp; - # timestamp.set_seconds(tv.tv_sec); - # timestamp.set_nanos(tv.tv_usec * 1000); - # - # Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. - # - # FILETIME ft; - # GetSystemTimeAsFileTime(&ft); - # UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - # - # // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z - # // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. - # Timestamp timestamp; - # timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); - # timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); - # - # Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. - # - # long millis = System.currentTimeMillis(); - # - # Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) - # .setNanos((int) ((millis % 1000) * 1000000)).build(); - # - # Example 5: Compute Timestamp from Java `Instant.now()`. - # - # Instant now = Instant.now(); - # - # Timestamp timestamp = - # Timestamp.newBuilder().setSeconds(now.getEpochSecond()) - # .setNanos(now.getNano()).build(); - # - # Example 6: Compute Timestamp from current time in Python. - # - # timestamp = Timestamp() - # timestamp.GetCurrentTime() - # - # # JSON Mapping - # - # In JSON format, the Timestamp type is encoded as a string in the - # [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the - # format is "\\{year}-\\{month}-\\{day}T\\{hour}:\\{min}:\\{sec}[.\\{frac_sec}]Z" - # where \\{year} is always expressed using four digits while \\{month}, \\{day}, - # \\{hour}, \\{min}, and \\{sec} are zero-padded to two digits each. The fractional - # seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), - # are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone - # is required. A proto3 JSON serializer should always use UTC (as indicated by - # "Z") when printing the Timestamp type and a proto3 JSON parser should be - # able to accept both UTC and other timezones (as indicated by an offset). - # - # For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past - # 01:30 UTC on January 15, 2017. - # - # In JavaScript, one can convert a Date object to this format using the - # standard - # [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) - # method. In Python, a standard `datetime.datetime` object can be converted - # to this format using - # [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with - # the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use - # the Joda Time's [`ISODateTimeFormat.dateTime()`]( - # http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime() - # ) to obtain a formatter capable of generating timestamps in this format. - # @!attribute [rw] seconds - # @return [::Integer] - # Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must - # be between -315576000000 and 315576000000 inclusive (which corresponds to - # 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z). - # @!attribute [rw] nanos - # @return [::Integer] - # Non-negative fractions of a second at nanosecond resolution. This field is - # the nanosecond portion of the duration, not an alternative to seconds. - # Negative second values with fractions must still have non-negative nanos - # values that count forward in time. Must be between 0 and 999,999,999 - # inclusive. - class Timestamp - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/wrappers.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/wrappers.rb deleted file mode 100644 index 9a7c0269fa42..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/protobuf/wrappers.rb +++ /dev/null @@ -1,148 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Protobuf - # Wrapper message for `double`. - # - # The JSON representation for `DoubleValue` is JSON number. - # - # Not recommended for use in new APIs, but still useful for legacy APIs and - # has no plan to be removed. - # @!attribute [rw] value - # @return [::Float] - # The double value. - class DoubleValue - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Wrapper message for `float`. - # - # The JSON representation for `FloatValue` is JSON number. - # - # Not recommended for use in new APIs, but still useful for legacy APIs and - # has no plan to be removed. - # @!attribute [rw] value - # @return [::Float] - # The float value. - class FloatValue - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Wrapper message for `int64`. - # - # The JSON representation for `Int64Value` is JSON string. - # - # Not recommended for use in new APIs, but still useful for legacy APIs and - # has no plan to be removed. - # @!attribute [rw] value - # @return [::Integer] - # The int64 value. - class Int64Value - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Wrapper message for `uint64`. - # - # The JSON representation for `UInt64Value` is JSON string. - # - # Not recommended for use in new APIs, but still useful for legacy APIs and - # has no plan to be removed. - # @!attribute [rw] value - # @return [::Integer] - # The uint64 value. - class UInt64Value - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Wrapper message for `int32`. - # - # The JSON representation for `Int32Value` is JSON number. - # - # Not recommended for use in new APIs, but still useful for legacy APIs and - # has no plan to be removed. - # @!attribute [rw] value - # @return [::Integer] - # The int32 value. - class Int32Value - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Wrapper message for `uint32`. - # - # The JSON representation for `UInt32Value` is JSON number. - # - # Not recommended for use in new APIs, but still useful for legacy APIs and - # has no plan to be removed. - # @!attribute [rw] value - # @return [::Integer] - # The uint32 value. - class UInt32Value - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Wrapper message for `bool`. - # - # The JSON representation for `BoolValue` is JSON `true` and `false`. - # - # Not recommended for use in new APIs, but still useful for legacy APIs and - # has no plan to be removed. - # @!attribute [rw] value - # @return [::Boolean] - # The bool value. - class BoolValue - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Wrapper message for `string`. - # - # The JSON representation for `StringValue` is JSON string. - # - # Not recommended for use in new APIs, but still useful for legacy APIs and - # has no plan to be removed. - # @!attribute [rw] value - # @return [::String] - # The string value. - class StringValue - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - - # Wrapper message for `bytes`. - # - # The JSON representation for `BytesValue` is JSON string. - # - # Not recommended for use in new APIs, but still useful for legacy APIs and - # has no plan to be removed. - # @!attribute [rw] value - # @return [::String] - # The bytes value. - class BytesValue - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/rpc/status.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/rpc/status.rb deleted file mode 100644 index c1a1c07eb2db..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/rpc/status.rb +++ /dev/null @@ -1,48 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Rpc - # The `Status` type defines a logical error model that is suitable for - # different programming environments, including REST APIs and RPC APIs. It is - # used by [gRPC](https://github.com/grpc). Each `Status` message contains - # three pieces of data: error code, error message, and error details. - # - # You can find out more about this error model and how to work with it in the - # [API Design Guide](https://cloud.google.com/apis/design/errors). - # @!attribute [rw] code - # @return [::Integer] - # The status code, which should be an enum value of - # [google.rpc.Code][google.rpc.Code]. - # @!attribute [rw] message - # @return [::String] - # A developer-facing error message, which should be in English. Any - # user-facing error message should be localized and sent in the - # {::Google::Rpc::Status#details google.rpc.Status.details} field, or localized - # by the client. - # @!attribute [rw] details - # @return [::Array<::Google::Protobuf::Any>] - # A list of messages that carry the error details. There is a common set of - # message types for APIs to use. - class Status - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/type/date.rb b/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/type/date.rb deleted file mode 100644 index a52275cebf89..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/proto_docs/google/type/date.rb +++ /dev/null @@ -1,56 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - - -module Google - module Type - # Represents a whole or partial calendar date, such as a birthday. The time of - # day and time zone are either specified elsewhere or are insignificant. The - # date is relative to the Gregorian Calendar. This can represent one of the - # following: - # - # * A full date, with non-zero year, month, and day values. - # * A month and day, with a zero year (for example, an anniversary). - # * A year on its own, with a zero month and a zero day. - # * A year and month, with a zero day (for example, a credit card expiration - # date). - # - # Related types: - # - # * [google.type.TimeOfDay][google.type.TimeOfDay] - # * [google.type.DateTime][google.type.DateTime] - # * {::Google::Protobuf::Timestamp google.protobuf.Timestamp} - # @!attribute [rw] year - # @return [::Integer] - # Year of the date. Must be from 1 to 9999, or 0 to specify a date without - # a year. - # @!attribute [rw] month - # @return [::Integer] - # Month of a year. Must be from 1 to 12, or 0 to specify a year without a - # month and day. - # @!attribute [rw] day - # @return [::Integer] - # Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 - # to specify a year by itself or a year and month where the day isn't - # significant. - class Date - include ::Google::Protobuf::MessageExts - extend ::Google::Protobuf::MessageExts::ClassMethods - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/Gemfile b/owl-bot-staging/google-cloud-retail-v2/snippets/Gemfile deleted file mode 100644 index d2cc0c1eb2ed..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/Gemfile +++ /dev/null @@ -1,32 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -source "https://rubygems.org" - -if ENV["GOOGLE_CLOUD_SAMPLES_TEST"] == "master" - gem "google-cloud-retail-v2", path: "../" -else - gem "google-cloud-retail-v2" -end - -group :test do - gem "google-style", "~> 1.26.1" - gem "minitest", "~> 5.16" - gem "minitest-focus", "~> 1.1" - gem "minitest-hooks", "~> 1.5" -end diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/analytics_service/export_analytics_metrics.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/analytics_service/export_analytics_metrics.rb deleted file mode 100644 index f5249b7f1e32..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/analytics_service/export_analytics_metrics.rb +++ /dev/null @@ -1,54 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_AnalyticsService_ExportAnalyticsMetrics_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the export_analytics_metrics call in the AnalyticsService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::AnalyticsService::Client#export_analytics_metrics. -# -def export_analytics_metrics - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::AnalyticsService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::ExportAnalyticsMetricsRequest.new - - # Call the export_analytics_metrics method. - result = client.export_analytics_metrics request - - # The returned object is of type Gapic::Operation. You can use it to - # check the status of an operation, cancel it, or wait for results. - # Here is how to wait for a response. - result.wait_until_done! timeout: 60 - if result.response? - p result.response - else - puts "No response received." - end -end -# [END retail_v2_generated_AnalyticsService_ExportAnalyticsMetrics_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/add_catalog_attribute.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/add_catalog_attribute.rb deleted file mode 100644 index dc85a92e6277..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/add_catalog_attribute.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_CatalogService_AddCatalogAttribute_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the add_catalog_attribute call in the CatalogService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::CatalogService::Client#add_catalog_attribute. -# -def add_catalog_attribute - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::CatalogService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::AddCatalogAttributeRequest.new - - # Call the add_catalog_attribute method. - result = client.add_catalog_attribute request - - # The returned object is of type Google::Cloud::Retail::V2::AttributesConfig. - p result -end -# [END retail_v2_generated_CatalogService_AddCatalogAttribute_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/get_attributes_config.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/get_attributes_config.rb deleted file mode 100644 index cb21a1f8e879..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/get_attributes_config.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_CatalogService_GetAttributesConfig_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the get_attributes_config call in the CatalogService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::CatalogService::Client#get_attributes_config. -# -def get_attributes_config - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::CatalogService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::GetAttributesConfigRequest.new - - # Call the get_attributes_config method. - result = client.get_attributes_config request - - # The returned object is of type Google::Cloud::Retail::V2::AttributesConfig. - p result -end -# [END retail_v2_generated_CatalogService_GetAttributesConfig_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/get_completion_config.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/get_completion_config.rb deleted file mode 100644 index 1668c703deda..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/get_completion_config.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_CatalogService_GetCompletionConfig_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the get_completion_config call in the CatalogService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::CatalogService::Client#get_completion_config. -# -def get_completion_config - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::CatalogService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::GetCompletionConfigRequest.new - - # Call the get_completion_config method. - result = client.get_completion_config request - - # The returned object is of type Google::Cloud::Retail::V2::CompletionConfig. - p result -end -# [END retail_v2_generated_CatalogService_GetCompletionConfig_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/get_default_branch.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/get_default_branch.rb deleted file mode 100644 index a7c5c47a999d..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/get_default_branch.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_CatalogService_GetDefaultBranch_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the get_default_branch call in the CatalogService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::CatalogService::Client#get_default_branch. -# -def get_default_branch - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::CatalogService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::GetDefaultBranchRequest.new - - # Call the get_default_branch method. - result = client.get_default_branch request - - # The returned object is of type Google::Cloud::Retail::V2::GetDefaultBranchResponse. - p result -end -# [END retail_v2_generated_CatalogService_GetDefaultBranch_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/list_catalogs.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/list_catalogs.rb deleted file mode 100644 index 27f668be91bd..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/list_catalogs.rb +++ /dev/null @@ -1,51 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_CatalogService_ListCatalogs_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the list_catalogs call in the CatalogService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::CatalogService::Client#list_catalogs. -# -def list_catalogs - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::CatalogService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::ListCatalogsRequest.new - - # Call the list_catalogs method. - result = client.list_catalogs request - - # The returned object is of type Gapic::PagedEnumerable. You can iterate - # over elements, and API calls will be issued to fetch pages as needed. - result.each do |item| - # Each element is of type ::Google::Cloud::Retail::V2::Catalog. - p item - end -end -# [END retail_v2_generated_CatalogService_ListCatalogs_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/remove_catalog_attribute.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/remove_catalog_attribute.rb deleted file mode 100644 index 7e0a01dc5446..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/remove_catalog_attribute.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_CatalogService_RemoveCatalogAttribute_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the remove_catalog_attribute call in the CatalogService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::CatalogService::Client#remove_catalog_attribute. -# -def remove_catalog_attribute - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::CatalogService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::RemoveCatalogAttributeRequest.new - - # Call the remove_catalog_attribute method. - result = client.remove_catalog_attribute request - - # The returned object is of type Google::Cloud::Retail::V2::AttributesConfig. - p result -end -# [END retail_v2_generated_CatalogService_RemoveCatalogAttribute_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/replace_catalog_attribute.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/replace_catalog_attribute.rb deleted file mode 100644 index 7b7e35e9755b..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/replace_catalog_attribute.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_CatalogService_ReplaceCatalogAttribute_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the replace_catalog_attribute call in the CatalogService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::CatalogService::Client#replace_catalog_attribute. -# -def replace_catalog_attribute - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::CatalogService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::ReplaceCatalogAttributeRequest.new - - # Call the replace_catalog_attribute method. - result = client.replace_catalog_attribute request - - # The returned object is of type Google::Cloud::Retail::V2::AttributesConfig. - p result -end -# [END retail_v2_generated_CatalogService_ReplaceCatalogAttribute_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/set_default_branch.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/set_default_branch.rb deleted file mode 100644 index 9c0d64022fa4..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/set_default_branch.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_CatalogService_SetDefaultBranch_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the set_default_branch call in the CatalogService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::CatalogService::Client#set_default_branch. -# -def set_default_branch - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::CatalogService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::SetDefaultBranchRequest.new - - # Call the set_default_branch method. - result = client.set_default_branch request - - # The returned object is of type Google::Protobuf::Empty. - p result -end -# [END retail_v2_generated_CatalogService_SetDefaultBranch_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/update_attributes_config.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/update_attributes_config.rb deleted file mode 100644 index 1b5fc7f4253a..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/update_attributes_config.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_CatalogService_UpdateAttributesConfig_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the update_attributes_config call in the CatalogService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::CatalogService::Client#update_attributes_config. -# -def update_attributes_config - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::CatalogService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::UpdateAttributesConfigRequest.new - - # Call the update_attributes_config method. - result = client.update_attributes_config request - - # The returned object is of type Google::Cloud::Retail::V2::AttributesConfig. - p result -end -# [END retail_v2_generated_CatalogService_UpdateAttributesConfig_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/update_catalog.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/update_catalog.rb deleted file mode 100644 index ea0eaa4f2b83..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/update_catalog.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_CatalogService_UpdateCatalog_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the update_catalog call in the CatalogService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::CatalogService::Client#update_catalog. -# -def update_catalog - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::CatalogService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::UpdateCatalogRequest.new - - # Call the update_catalog method. - result = client.update_catalog request - - # The returned object is of type Google::Cloud::Retail::V2::Catalog. - p result -end -# [END retail_v2_generated_CatalogService_UpdateCatalog_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/update_completion_config.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/update_completion_config.rb deleted file mode 100644 index 5d8036e6732d..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/catalog_service/update_completion_config.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_CatalogService_UpdateCompletionConfig_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the update_completion_config call in the CatalogService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::CatalogService::Client#update_completion_config. -# -def update_completion_config - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::CatalogService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::UpdateCompletionConfigRequest.new - - # Call the update_completion_config method. - result = client.update_completion_config request - - # The returned object is of type Google::Cloud::Retail::V2::CompletionConfig. - p result -end -# [END retail_v2_generated_CatalogService_UpdateCompletionConfig_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/completion_service/complete_query.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/completion_service/complete_query.rb deleted file mode 100644 index 874d7cee8d67..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/completion_service/complete_query.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_CompletionService_CompleteQuery_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the complete_query call in the CompletionService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::CompletionService::Client#complete_query. -# -def complete_query - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::CompletionService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::CompleteQueryRequest.new - - # Call the complete_query method. - result = client.complete_query request - - # The returned object is of type Google::Cloud::Retail::V2::CompleteQueryResponse. - p result -end -# [END retail_v2_generated_CompletionService_CompleteQuery_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/completion_service/import_completion_data.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/completion_service/import_completion_data.rb deleted file mode 100644 index fe1f28f0844e..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/completion_service/import_completion_data.rb +++ /dev/null @@ -1,54 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_CompletionService_ImportCompletionData_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the import_completion_data call in the CompletionService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::CompletionService::Client#import_completion_data. -# -def import_completion_data - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::CompletionService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::ImportCompletionDataRequest.new - - # Call the import_completion_data method. - result = client.import_completion_data request - - # The returned object is of type Gapic::Operation. You can use it to - # check the status of an operation, cancel it, or wait for results. - # Here is how to wait for a response. - result.wait_until_done! timeout: 60 - if result.response? - p result.response - else - puts "No response received." - end -end -# [END retail_v2_generated_CompletionService_ImportCompletionData_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/control_service/create_control.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/control_service/create_control.rb deleted file mode 100644 index 32b89537acd9..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/control_service/create_control.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_ControlService_CreateControl_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the create_control call in the ControlService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::ControlService::Client#create_control. -# -def create_control - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::ControlService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::CreateControlRequest.new - - # Call the create_control method. - result = client.create_control request - - # The returned object is of type Google::Cloud::Retail::V2::Control. - p result -end -# [END retail_v2_generated_ControlService_CreateControl_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/control_service/delete_control.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/control_service/delete_control.rb deleted file mode 100644 index 42aa73e1063a..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/control_service/delete_control.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_ControlService_DeleteControl_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the delete_control call in the ControlService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::ControlService::Client#delete_control. -# -def delete_control - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::ControlService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::DeleteControlRequest.new - - # Call the delete_control method. - result = client.delete_control request - - # The returned object is of type Google::Protobuf::Empty. - p result -end -# [END retail_v2_generated_ControlService_DeleteControl_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/control_service/get_control.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/control_service/get_control.rb deleted file mode 100644 index 2785feb65202..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/control_service/get_control.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_ControlService_GetControl_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the get_control call in the ControlService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::ControlService::Client#get_control. -# -def get_control - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::ControlService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::GetControlRequest.new - - # Call the get_control method. - result = client.get_control request - - # The returned object is of type Google::Cloud::Retail::V2::Control. - p result -end -# [END retail_v2_generated_ControlService_GetControl_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/control_service/list_controls.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/control_service/list_controls.rb deleted file mode 100644 index 7394fdd3076a..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/control_service/list_controls.rb +++ /dev/null @@ -1,51 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_ControlService_ListControls_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the list_controls call in the ControlService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::ControlService::Client#list_controls. -# -def list_controls - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::ControlService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::ListControlsRequest.new - - # Call the list_controls method. - result = client.list_controls request - - # The returned object is of type Gapic::PagedEnumerable. You can iterate - # over elements, and API calls will be issued to fetch pages as needed. - result.each do |item| - # Each element is of type ::Google::Cloud::Retail::V2::Control. - p item - end -end -# [END retail_v2_generated_ControlService_ListControls_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/control_service/update_control.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/control_service/update_control.rb deleted file mode 100644 index f3bf5821b03b..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/control_service/update_control.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_ControlService_UpdateControl_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the update_control call in the ControlService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::ControlService::Client#update_control. -# -def update_control - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::ControlService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::UpdateControlRequest.new - - # Call the update_control method. - result = client.update_control request - - # The returned object is of type Google::Cloud::Retail::V2::Control. - p result -end -# [END retail_v2_generated_ControlService_UpdateControl_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/conversational_search_service/conversational_search.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/conversational_search_service/conversational_search.rb deleted file mode 100644 index 19ab711ac479..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/conversational_search_service/conversational_search.rb +++ /dev/null @@ -1,50 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_ConversationalSearchService_ConversationalSearch_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the conversational_search call in the ConversationalSearchService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::ConversationalSearchService::Client#conversational_search. -# -def conversational_search - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::ConversationalSearchService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::ConversationalSearchRequest.new - - # Call the conversational_search method to start streaming. - output = client.conversational_search request - - # The returned object is a streamed enumerable yielding elements of type - # ::Google::Cloud::Retail::V2::ConversationalSearchResponse - output.each do |current_response| - p current_response - end -end -# [END retail_v2_generated_ConversationalSearchService_ConversationalSearch_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/generative_question_service/batch_update_generative_question_configs.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/generative_question_service/batch_update_generative_question_configs.rb deleted file mode 100644 index ec7f82414dea..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/generative_question_service/batch_update_generative_question_configs.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_GenerativeQuestionService_BatchUpdateGenerativeQuestionConfigs_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the batch_update_generative_question_configs call in the GenerativeQuestionService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::GenerativeQuestionService::Client#batch_update_generative_question_configs. -# -def batch_update_generative_question_configs - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::GenerativeQuestionService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsRequest.new - - # Call the batch_update_generative_question_configs method. - result = client.batch_update_generative_question_configs request - - # The returned object is of type Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsResponse. - p result -end -# [END retail_v2_generated_GenerativeQuestionService_BatchUpdateGenerativeQuestionConfigs_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/generative_question_service/get_generative_questions_feature_config.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/generative_question_service/get_generative_questions_feature_config.rb deleted file mode 100644 index d9b400ceed6d..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/generative_question_service/get_generative_questions_feature_config.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_GenerativeQuestionService_GetGenerativeQuestionsFeatureConfig_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the get_generative_questions_feature_config call in the GenerativeQuestionService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::GenerativeQuestionService::Client#get_generative_questions_feature_config. -# -def get_generative_questions_feature_config - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::GenerativeQuestionService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::GetGenerativeQuestionsFeatureConfigRequest.new - - # Call the get_generative_questions_feature_config method. - result = client.get_generative_questions_feature_config request - - # The returned object is of type Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig. - p result -end -# [END retail_v2_generated_GenerativeQuestionService_GetGenerativeQuestionsFeatureConfig_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/generative_question_service/list_generative_question_configs.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/generative_question_service/list_generative_question_configs.rb deleted file mode 100644 index 66d6f2d20042..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/generative_question_service/list_generative_question_configs.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_GenerativeQuestionService_ListGenerativeQuestionConfigs_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the list_generative_question_configs call in the GenerativeQuestionService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::GenerativeQuestionService::Client#list_generative_question_configs. -# -def list_generative_question_configs - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::GenerativeQuestionService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsRequest.new - - # Call the list_generative_question_configs method. - result = client.list_generative_question_configs request - - # The returned object is of type Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsResponse. - p result -end -# [END retail_v2_generated_GenerativeQuestionService_ListGenerativeQuestionConfigs_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/generative_question_service/update_generative_question_config.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/generative_question_service/update_generative_question_config.rb deleted file mode 100644 index 73faa0a00347..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/generative_question_service/update_generative_question_config.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_GenerativeQuestionService_UpdateGenerativeQuestionConfig_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the update_generative_question_config call in the GenerativeQuestionService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::GenerativeQuestionService::Client#update_generative_question_config. -# -def update_generative_question_config - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::GenerativeQuestionService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::UpdateGenerativeQuestionConfigRequest.new - - # Call the update_generative_question_config method. - result = client.update_generative_question_config request - - # The returned object is of type Google::Cloud::Retail::V2::GenerativeQuestionConfig. - p result -end -# [END retail_v2_generated_GenerativeQuestionService_UpdateGenerativeQuestionConfig_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/generative_question_service/update_generative_questions_feature_config.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/generative_question_service/update_generative_questions_feature_config.rb deleted file mode 100644 index edec3d61d8a8..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/generative_question_service/update_generative_questions_feature_config.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_GenerativeQuestionService_UpdateGenerativeQuestionsFeatureConfig_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the update_generative_questions_feature_config call in the GenerativeQuestionService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::GenerativeQuestionService::Client#update_generative_questions_feature_config. -# -def update_generative_questions_feature_config - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::GenerativeQuestionService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::UpdateGenerativeQuestionsFeatureConfigRequest.new - - # Call the update_generative_questions_feature_config method. - result = client.update_generative_questions_feature_config request - - # The returned object is of type Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig. - p result -end -# [END retail_v2_generated_GenerativeQuestionService_UpdateGenerativeQuestionsFeatureConfig_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/model_service/create_model.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/model_service/create_model.rb deleted file mode 100644 index ffbfd59f4a13..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/model_service/create_model.rb +++ /dev/null @@ -1,54 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_ModelService_CreateModel_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the create_model call in the ModelService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::ModelService::Client#create_model. -# -def create_model - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::ModelService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::CreateModelRequest.new - - # Call the create_model method. - result = client.create_model request - - # The returned object is of type Gapic::Operation. You can use it to - # check the status of an operation, cancel it, or wait for results. - # Here is how to wait for a response. - result.wait_until_done! timeout: 60 - if result.response? - p result.response - else - puts "No response received." - end -end -# [END retail_v2_generated_ModelService_CreateModel_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/model_service/delete_model.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/model_service/delete_model.rb deleted file mode 100644 index 8a92e3fe6c8e..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/model_service/delete_model.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_ModelService_DeleteModel_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the delete_model call in the ModelService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::ModelService::Client#delete_model. -# -def delete_model - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::ModelService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::DeleteModelRequest.new - - # Call the delete_model method. - result = client.delete_model request - - # The returned object is of type Google::Protobuf::Empty. - p result -end -# [END retail_v2_generated_ModelService_DeleteModel_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/model_service/get_model.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/model_service/get_model.rb deleted file mode 100644 index 8ca949873471..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/model_service/get_model.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_ModelService_GetModel_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the get_model call in the ModelService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::ModelService::Client#get_model. -# -def get_model - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::ModelService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::GetModelRequest.new - - # Call the get_model method. - result = client.get_model request - - # The returned object is of type Google::Cloud::Retail::V2::Model. - p result -end -# [END retail_v2_generated_ModelService_GetModel_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/model_service/list_models.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/model_service/list_models.rb deleted file mode 100644 index a652ccbdc26a..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/model_service/list_models.rb +++ /dev/null @@ -1,51 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_ModelService_ListModels_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the list_models call in the ModelService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::ModelService::Client#list_models. -# -def list_models - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::ModelService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::ListModelsRequest.new - - # Call the list_models method. - result = client.list_models request - - # The returned object is of type Gapic::PagedEnumerable. You can iterate - # over elements, and API calls will be issued to fetch pages as needed. - result.each do |item| - # Each element is of type ::Google::Cloud::Retail::V2::Model. - p item - end -end -# [END retail_v2_generated_ModelService_ListModels_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/model_service/pause_model.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/model_service/pause_model.rb deleted file mode 100644 index d563bf2a6c88..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/model_service/pause_model.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_ModelService_PauseModel_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the pause_model call in the ModelService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::ModelService::Client#pause_model. -# -def pause_model - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::ModelService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::PauseModelRequest.new - - # Call the pause_model method. - result = client.pause_model request - - # The returned object is of type Google::Cloud::Retail::V2::Model. - p result -end -# [END retail_v2_generated_ModelService_PauseModel_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/model_service/resume_model.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/model_service/resume_model.rb deleted file mode 100644 index 175e84817b36..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/model_service/resume_model.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_ModelService_ResumeModel_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the resume_model call in the ModelService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::ModelService::Client#resume_model. -# -def resume_model - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::ModelService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::ResumeModelRequest.new - - # Call the resume_model method. - result = client.resume_model request - - # The returned object is of type Google::Cloud::Retail::V2::Model. - p result -end -# [END retail_v2_generated_ModelService_ResumeModel_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/model_service/tune_model.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/model_service/tune_model.rb deleted file mode 100644 index 8b60f30ed5ee..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/model_service/tune_model.rb +++ /dev/null @@ -1,54 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_ModelService_TuneModel_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the tune_model call in the ModelService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::ModelService::Client#tune_model. -# -def tune_model - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::ModelService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::TuneModelRequest.new - - # Call the tune_model method. - result = client.tune_model request - - # The returned object is of type Gapic::Operation. You can use it to - # check the status of an operation, cancel it, or wait for results. - # Here is how to wait for a response. - result.wait_until_done! timeout: 60 - if result.response? - p result.response - else - puts "No response received." - end -end -# [END retail_v2_generated_ModelService_TuneModel_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/model_service/update_model.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/model_service/update_model.rb deleted file mode 100644 index 0648bf6ab25e..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/model_service/update_model.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_ModelService_UpdateModel_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the update_model call in the ModelService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::ModelService::Client#update_model. -# -def update_model - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::ModelService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::UpdateModelRequest.new - - # Call the update_model method. - result = client.update_model request - - # The returned object is of type Google::Cloud::Retail::V2::Model. - p result -end -# [END retail_v2_generated_ModelService_UpdateModel_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/prediction_service/predict.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/prediction_service/predict.rb deleted file mode 100644 index da0cc34c34ab..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/prediction_service/predict.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_PredictionService_Predict_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the predict call in the PredictionService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::PredictionService::Client#predict. -# -def predict - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::PredictionService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::PredictRequest.new - - # Call the predict method. - result = client.predict request - - # The returned object is of type Google::Cloud::Retail::V2::PredictResponse. - p result -end -# [END retail_v2_generated_PredictionService_Predict_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/add_fulfillment_places.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/add_fulfillment_places.rb deleted file mode 100644 index 4ec26b4419f7..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/add_fulfillment_places.rb +++ /dev/null @@ -1,54 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_ProductService_AddFulfillmentPlaces_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the add_fulfillment_places call in the ProductService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::ProductService::Client#add_fulfillment_places. -# -def add_fulfillment_places - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::ProductService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest.new - - # Call the add_fulfillment_places method. - result = client.add_fulfillment_places request - - # The returned object is of type Gapic::Operation. You can use it to - # check the status of an operation, cancel it, or wait for results. - # Here is how to wait for a response. - result.wait_until_done! timeout: 60 - if result.response? - p result.response - else - puts "No response received." - end -end -# [END retail_v2_generated_ProductService_AddFulfillmentPlaces_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/add_local_inventories.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/add_local_inventories.rb deleted file mode 100644 index 2f4627281ccb..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/add_local_inventories.rb +++ /dev/null @@ -1,54 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_ProductService_AddLocalInventories_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the add_local_inventories call in the ProductService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::ProductService::Client#add_local_inventories. -# -def add_local_inventories - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::ProductService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::AddLocalInventoriesRequest.new - - # Call the add_local_inventories method. - result = client.add_local_inventories request - - # The returned object is of type Gapic::Operation. You can use it to - # check the status of an operation, cancel it, or wait for results. - # Here is how to wait for a response. - result.wait_until_done! timeout: 60 - if result.response? - p result.response - else - puts "No response received." - end -end -# [END retail_v2_generated_ProductService_AddLocalInventories_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/create_product.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/create_product.rb deleted file mode 100644 index 4042ed4becf7..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/create_product.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_ProductService_CreateProduct_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the create_product call in the ProductService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::ProductService::Client#create_product. -# -def create_product - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::ProductService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::CreateProductRequest.new - - # Call the create_product method. - result = client.create_product request - - # The returned object is of type Google::Cloud::Retail::V2::Product. - p result -end -# [END retail_v2_generated_ProductService_CreateProduct_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/delete_product.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/delete_product.rb deleted file mode 100644 index 6a95e9192bfa..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/delete_product.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_ProductService_DeleteProduct_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the delete_product call in the ProductService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::ProductService::Client#delete_product. -# -def delete_product - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::ProductService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::DeleteProductRequest.new - - # Call the delete_product method. - result = client.delete_product request - - # The returned object is of type Google::Protobuf::Empty. - p result -end -# [END retail_v2_generated_ProductService_DeleteProduct_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/get_product.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/get_product.rb deleted file mode 100644 index 72fa221658aa..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/get_product.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_ProductService_GetProduct_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the get_product call in the ProductService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::ProductService::Client#get_product. -# -def get_product - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::ProductService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::GetProductRequest.new - - # Call the get_product method. - result = client.get_product request - - # The returned object is of type Google::Cloud::Retail::V2::Product. - p result -end -# [END retail_v2_generated_ProductService_GetProduct_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/import_products.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/import_products.rb deleted file mode 100644 index 1db99c203a0e..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/import_products.rb +++ /dev/null @@ -1,54 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_ProductService_ImportProducts_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the import_products call in the ProductService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::ProductService::Client#import_products. -# -def import_products - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::ProductService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::ImportProductsRequest.new - - # Call the import_products method. - result = client.import_products request - - # The returned object is of type Gapic::Operation. You can use it to - # check the status of an operation, cancel it, or wait for results. - # Here is how to wait for a response. - result.wait_until_done! timeout: 60 - if result.response? - p result.response - else - puts "No response received." - end -end -# [END retail_v2_generated_ProductService_ImportProducts_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/list_products.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/list_products.rb deleted file mode 100644 index 3c55a501794a..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/list_products.rb +++ /dev/null @@ -1,51 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_ProductService_ListProducts_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the list_products call in the ProductService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::ProductService::Client#list_products. -# -def list_products - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::ProductService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::ListProductsRequest.new - - # Call the list_products method. - result = client.list_products request - - # The returned object is of type Gapic::PagedEnumerable. You can iterate - # over elements, and API calls will be issued to fetch pages as needed. - result.each do |item| - # Each element is of type ::Google::Cloud::Retail::V2::Product. - p item - end -end -# [END retail_v2_generated_ProductService_ListProducts_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/purge_products.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/purge_products.rb deleted file mode 100644 index 6ba93cc5c41b..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/purge_products.rb +++ /dev/null @@ -1,54 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_ProductService_PurgeProducts_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the purge_products call in the ProductService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::ProductService::Client#purge_products. -# -def purge_products - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::ProductService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::PurgeProductsRequest.new - - # Call the purge_products method. - result = client.purge_products request - - # The returned object is of type Gapic::Operation. You can use it to - # check the status of an operation, cancel it, or wait for results. - # Here is how to wait for a response. - result.wait_until_done! timeout: 60 - if result.response? - p result.response - else - puts "No response received." - end -end -# [END retail_v2_generated_ProductService_PurgeProducts_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/remove_fulfillment_places.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/remove_fulfillment_places.rb deleted file mode 100644 index 7e48ed058cec..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/remove_fulfillment_places.rb +++ /dev/null @@ -1,54 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_ProductService_RemoveFulfillmentPlaces_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the remove_fulfillment_places call in the ProductService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::ProductService::Client#remove_fulfillment_places. -# -def remove_fulfillment_places - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::ProductService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest.new - - # Call the remove_fulfillment_places method. - result = client.remove_fulfillment_places request - - # The returned object is of type Gapic::Operation. You can use it to - # check the status of an operation, cancel it, or wait for results. - # Here is how to wait for a response. - result.wait_until_done! timeout: 60 - if result.response? - p result.response - else - puts "No response received." - end -end -# [END retail_v2_generated_ProductService_RemoveFulfillmentPlaces_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/remove_local_inventories.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/remove_local_inventories.rb deleted file mode 100644 index 348089c03910..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/remove_local_inventories.rb +++ /dev/null @@ -1,54 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_ProductService_RemoveLocalInventories_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the remove_local_inventories call in the ProductService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::ProductService::Client#remove_local_inventories. -# -def remove_local_inventories - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::ProductService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::RemoveLocalInventoriesRequest.new - - # Call the remove_local_inventories method. - result = client.remove_local_inventories request - - # The returned object is of type Gapic::Operation. You can use it to - # check the status of an operation, cancel it, or wait for results. - # Here is how to wait for a response. - result.wait_until_done! timeout: 60 - if result.response? - p result.response - else - puts "No response received." - end -end -# [END retail_v2_generated_ProductService_RemoveLocalInventories_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/set_inventory.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/set_inventory.rb deleted file mode 100644 index bae7bf9a57e5..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/set_inventory.rb +++ /dev/null @@ -1,54 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_ProductService_SetInventory_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the set_inventory call in the ProductService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::ProductService::Client#set_inventory. -# -def set_inventory - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::ProductService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::SetInventoryRequest.new - - # Call the set_inventory method. - result = client.set_inventory request - - # The returned object is of type Gapic::Operation. You can use it to - # check the status of an operation, cancel it, or wait for results. - # Here is how to wait for a response. - result.wait_until_done! timeout: 60 - if result.response? - p result.response - else - puts "No response received." - end -end -# [END retail_v2_generated_ProductService_SetInventory_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/update_product.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/update_product.rb deleted file mode 100644 index 36642534fa9e..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/product_service/update_product.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_ProductService_UpdateProduct_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the update_product call in the ProductService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::ProductService::Client#update_product. -# -def update_product - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::ProductService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::UpdateProductRequest.new - - # Call the update_product method. - result = client.update_product request - - # The returned object is of type Google::Cloud::Retail::V2::Product. - p result -end -# [END retail_v2_generated_ProductService_UpdateProduct_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/search_service/search.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/search_service/search.rb deleted file mode 100644 index 5dc88c9cf583..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/search_service/search.rb +++ /dev/null @@ -1,51 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_SearchService_Search_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the search call in the SearchService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::SearchService::Client#search. -# -def search - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::SearchService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::SearchRequest.new - - # Call the search method. - result = client.search request - - # The returned object is of type Gapic::PagedEnumerable. You can iterate - # over elements, and API calls will be issued to fetch pages as needed. - result.each do |item| - # Each element is of type ::Google::Cloud::Retail::V2::SearchResponse::SearchResult. - p item - end -end -# [END retail_v2_generated_SearchService_Search_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/add_control.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/add_control.rb deleted file mode 100644 index 220931b22733..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/add_control.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_ServingConfigService_AddControl_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the add_control call in the ServingConfigService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::ServingConfigService::Client#add_control. -# -def add_control - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::ServingConfigService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::AddControlRequest.new - - # Call the add_control method. - result = client.add_control request - - # The returned object is of type Google::Cloud::Retail::V2::ServingConfig. - p result -end -# [END retail_v2_generated_ServingConfigService_AddControl_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/create_serving_config.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/create_serving_config.rb deleted file mode 100644 index 83294bf46733..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/create_serving_config.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_ServingConfigService_CreateServingConfig_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the create_serving_config call in the ServingConfigService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::ServingConfigService::Client#create_serving_config. -# -def create_serving_config - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::ServingConfigService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::CreateServingConfigRequest.new - - # Call the create_serving_config method. - result = client.create_serving_config request - - # The returned object is of type Google::Cloud::Retail::V2::ServingConfig. - p result -end -# [END retail_v2_generated_ServingConfigService_CreateServingConfig_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/delete_serving_config.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/delete_serving_config.rb deleted file mode 100644 index 40f9a2606fca..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/delete_serving_config.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_ServingConfigService_DeleteServingConfig_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the delete_serving_config call in the ServingConfigService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::ServingConfigService::Client#delete_serving_config. -# -def delete_serving_config - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::ServingConfigService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::DeleteServingConfigRequest.new - - # Call the delete_serving_config method. - result = client.delete_serving_config request - - # The returned object is of type Google::Protobuf::Empty. - p result -end -# [END retail_v2_generated_ServingConfigService_DeleteServingConfig_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/get_serving_config.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/get_serving_config.rb deleted file mode 100644 index c2f3df505c5f..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/get_serving_config.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_ServingConfigService_GetServingConfig_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the get_serving_config call in the ServingConfigService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::ServingConfigService::Client#get_serving_config. -# -def get_serving_config - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::ServingConfigService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::GetServingConfigRequest.new - - # Call the get_serving_config method. - result = client.get_serving_config request - - # The returned object is of type Google::Cloud::Retail::V2::ServingConfig. - p result -end -# [END retail_v2_generated_ServingConfigService_GetServingConfig_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/list_serving_configs.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/list_serving_configs.rb deleted file mode 100644 index 1c0c7dcdf923..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/list_serving_configs.rb +++ /dev/null @@ -1,51 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_ServingConfigService_ListServingConfigs_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the list_serving_configs call in the ServingConfigService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::ServingConfigService::Client#list_serving_configs. -# -def list_serving_configs - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::ServingConfigService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::ListServingConfigsRequest.new - - # Call the list_serving_configs method. - result = client.list_serving_configs request - - # The returned object is of type Gapic::PagedEnumerable. You can iterate - # over elements, and API calls will be issued to fetch pages as needed. - result.each do |item| - # Each element is of type ::Google::Cloud::Retail::V2::ServingConfig. - p item - end -end -# [END retail_v2_generated_ServingConfigService_ListServingConfigs_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/remove_control.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/remove_control.rb deleted file mode 100644 index 7917bea15485..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/remove_control.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_ServingConfigService_RemoveControl_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the remove_control call in the ServingConfigService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::ServingConfigService::Client#remove_control. -# -def remove_control - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::ServingConfigService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::RemoveControlRequest.new - - # Call the remove_control method. - result = client.remove_control request - - # The returned object is of type Google::Cloud::Retail::V2::ServingConfig. - p result -end -# [END retail_v2_generated_ServingConfigService_RemoveControl_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/update_serving_config.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/update_serving_config.rb deleted file mode 100644 index 669a5bd2a303..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/serving_config_service/update_serving_config.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_ServingConfigService_UpdateServingConfig_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the update_serving_config call in the ServingConfigService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::ServingConfigService::Client#update_serving_config. -# -def update_serving_config - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::ServingConfigService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::UpdateServingConfigRequest.new - - # Call the update_serving_config method. - result = client.update_serving_config request - - # The returned object is of type Google::Cloud::Retail::V2::ServingConfig. - p result -end -# [END retail_v2_generated_ServingConfigService_UpdateServingConfig_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/snippet_metadata_google.cloud.retail.v2.json b/owl-bot-staging/google-cloud-retail-v2/snippets/snippet_metadata_google.cloud.retail.v2.json deleted file mode 100644 index 3903e19ad375..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/snippet_metadata_google.cloud.retail.v2.json +++ /dev/null @@ -1,2375 +0,0 @@ -{ - "client_library": { - "name": "google-cloud-retail-v2", - "version": "", - "language": "RUBY", - "apis": [ - { - "id": "google.cloud.retail.v2", - "version": "v2" - } - ] - }, - "snippets": [ - { - "region_tag": "retail_v2_generated_AnalyticsService_ExportAnalyticsMetrics_sync", - "title": "Snippet for the export_analytics_metrics call in the AnalyticsService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::AnalyticsService::Client#export_analytics_metrics.", - "file": "analytics_service/export_analytics_metrics.rb", - "language": "RUBY", - "client_method": { - "short_name": "export_analytics_metrics", - "full_name": "::Google::Cloud::Retail::V2::AnalyticsService::Client#export_analytics_metrics", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::ExportAnalyticsMetricsRequest", - "name": "request" - } - ], - "result_type": "::Google::Longrunning::Operation", - "client": { - "short_name": "AnalyticsService::Client", - "full_name": "::Google::Cloud::Retail::V2::AnalyticsService::Client" - }, - "method": { - "short_name": "ExportAnalyticsMetrics", - "full_name": "google.cloud.retail.v2.AnalyticsService.ExportAnalyticsMetrics", - "service": { - "short_name": "AnalyticsService", - "full_name": "google.cloud.retail.v2.AnalyticsService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 53, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_CatalogService_ListCatalogs_sync", - "title": "Snippet for the list_catalogs call in the CatalogService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::CatalogService::Client#list_catalogs.", - "file": "catalog_service/list_catalogs.rb", - "language": "RUBY", - "client_method": { - "short_name": "list_catalogs", - "full_name": "::Google::Cloud::Retail::V2::CatalogService::Client#list_catalogs", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::ListCatalogsRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Retail::V2::ListCatalogsResponse", - "client": { - "short_name": "CatalogService::Client", - "full_name": "::Google::Cloud::Retail::V2::CatalogService::Client" - }, - "method": { - "short_name": "ListCatalogs", - "full_name": "google.cloud.retail.v2.CatalogService.ListCatalogs", - "service": { - "short_name": "CatalogService", - "full_name": "google.cloud.retail.v2.CatalogService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 50, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_CatalogService_UpdateCatalog_sync", - "title": "Snippet for the update_catalog call in the CatalogService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::CatalogService::Client#update_catalog.", - "file": "catalog_service/update_catalog.rb", - "language": "RUBY", - "client_method": { - "short_name": "update_catalog", - "full_name": "::Google::Cloud::Retail::V2::CatalogService::Client#update_catalog", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::UpdateCatalogRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Retail::V2::Catalog", - "client": { - "short_name": "CatalogService::Client", - "full_name": "::Google::Cloud::Retail::V2::CatalogService::Client" - }, - "method": { - "short_name": "UpdateCatalog", - "full_name": "google.cloud.retail.v2.CatalogService.UpdateCatalog", - "service": { - "short_name": "CatalogService", - "full_name": "google.cloud.retail.v2.CatalogService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_CatalogService_SetDefaultBranch_sync", - "title": "Snippet for the set_default_branch call in the CatalogService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::CatalogService::Client#set_default_branch.", - "file": "catalog_service/set_default_branch.rb", - "language": "RUBY", - "client_method": { - "short_name": "set_default_branch", - "full_name": "::Google::Cloud::Retail::V2::CatalogService::Client#set_default_branch", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::SetDefaultBranchRequest", - "name": "request" - } - ], - "result_type": "::Google::Protobuf::Empty", - "client": { - "short_name": "CatalogService::Client", - "full_name": "::Google::Cloud::Retail::V2::CatalogService::Client" - }, - "method": { - "short_name": "SetDefaultBranch", - "full_name": "google.cloud.retail.v2.CatalogService.SetDefaultBranch", - "service": { - "short_name": "CatalogService", - "full_name": "google.cloud.retail.v2.CatalogService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_CatalogService_GetDefaultBranch_sync", - "title": "Snippet for the get_default_branch call in the CatalogService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::CatalogService::Client#get_default_branch.", - "file": "catalog_service/get_default_branch.rb", - "language": "RUBY", - "client_method": { - "short_name": "get_default_branch", - "full_name": "::Google::Cloud::Retail::V2::CatalogService::Client#get_default_branch", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::GetDefaultBranchRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Retail::V2::GetDefaultBranchResponse", - "client": { - "short_name": "CatalogService::Client", - "full_name": "::Google::Cloud::Retail::V2::CatalogService::Client" - }, - "method": { - "short_name": "GetDefaultBranch", - "full_name": "google.cloud.retail.v2.CatalogService.GetDefaultBranch", - "service": { - "short_name": "CatalogService", - "full_name": "google.cloud.retail.v2.CatalogService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_CatalogService_GetCompletionConfig_sync", - "title": "Snippet for the get_completion_config call in the CatalogService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::CatalogService::Client#get_completion_config.", - "file": "catalog_service/get_completion_config.rb", - "language": "RUBY", - "client_method": { - "short_name": "get_completion_config", - "full_name": "::Google::Cloud::Retail::V2::CatalogService::Client#get_completion_config", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::GetCompletionConfigRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Retail::V2::CompletionConfig", - "client": { - "short_name": "CatalogService::Client", - "full_name": "::Google::Cloud::Retail::V2::CatalogService::Client" - }, - "method": { - "short_name": "GetCompletionConfig", - "full_name": "google.cloud.retail.v2.CatalogService.GetCompletionConfig", - "service": { - "short_name": "CatalogService", - "full_name": "google.cloud.retail.v2.CatalogService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_CatalogService_UpdateCompletionConfig_sync", - "title": "Snippet for the update_completion_config call in the CatalogService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::CatalogService::Client#update_completion_config.", - "file": "catalog_service/update_completion_config.rb", - "language": "RUBY", - "client_method": { - "short_name": "update_completion_config", - "full_name": "::Google::Cloud::Retail::V2::CatalogService::Client#update_completion_config", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::UpdateCompletionConfigRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Retail::V2::CompletionConfig", - "client": { - "short_name": "CatalogService::Client", - "full_name": "::Google::Cloud::Retail::V2::CatalogService::Client" - }, - "method": { - "short_name": "UpdateCompletionConfig", - "full_name": "google.cloud.retail.v2.CatalogService.UpdateCompletionConfig", - "service": { - "short_name": "CatalogService", - "full_name": "google.cloud.retail.v2.CatalogService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_CatalogService_GetAttributesConfig_sync", - "title": "Snippet for the get_attributes_config call in the CatalogService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::CatalogService::Client#get_attributes_config.", - "file": "catalog_service/get_attributes_config.rb", - "language": "RUBY", - "client_method": { - "short_name": "get_attributes_config", - "full_name": "::Google::Cloud::Retail::V2::CatalogService::Client#get_attributes_config", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::GetAttributesConfigRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Retail::V2::AttributesConfig", - "client": { - "short_name": "CatalogService::Client", - "full_name": "::Google::Cloud::Retail::V2::CatalogService::Client" - }, - "method": { - "short_name": "GetAttributesConfig", - "full_name": "google.cloud.retail.v2.CatalogService.GetAttributesConfig", - "service": { - "short_name": "CatalogService", - "full_name": "google.cloud.retail.v2.CatalogService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_CatalogService_UpdateAttributesConfig_sync", - "title": "Snippet for the update_attributes_config call in the CatalogService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::CatalogService::Client#update_attributes_config.", - "file": "catalog_service/update_attributes_config.rb", - "language": "RUBY", - "client_method": { - "short_name": "update_attributes_config", - "full_name": "::Google::Cloud::Retail::V2::CatalogService::Client#update_attributes_config", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::UpdateAttributesConfigRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Retail::V2::AttributesConfig", - "client": { - "short_name": "CatalogService::Client", - "full_name": "::Google::Cloud::Retail::V2::CatalogService::Client" - }, - "method": { - "short_name": "UpdateAttributesConfig", - "full_name": "google.cloud.retail.v2.CatalogService.UpdateAttributesConfig", - "service": { - "short_name": "CatalogService", - "full_name": "google.cloud.retail.v2.CatalogService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_CatalogService_AddCatalogAttribute_sync", - "title": "Snippet for the add_catalog_attribute call in the CatalogService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::CatalogService::Client#add_catalog_attribute.", - "file": "catalog_service/add_catalog_attribute.rb", - "language": "RUBY", - "client_method": { - "short_name": "add_catalog_attribute", - "full_name": "::Google::Cloud::Retail::V2::CatalogService::Client#add_catalog_attribute", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::AddCatalogAttributeRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Retail::V2::AttributesConfig", - "client": { - "short_name": "CatalogService::Client", - "full_name": "::Google::Cloud::Retail::V2::CatalogService::Client" - }, - "method": { - "short_name": "AddCatalogAttribute", - "full_name": "google.cloud.retail.v2.CatalogService.AddCatalogAttribute", - "service": { - "short_name": "CatalogService", - "full_name": "google.cloud.retail.v2.CatalogService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_CatalogService_RemoveCatalogAttribute_sync", - "title": "Snippet for the remove_catalog_attribute call in the CatalogService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::CatalogService::Client#remove_catalog_attribute.", - "file": "catalog_service/remove_catalog_attribute.rb", - "language": "RUBY", - "client_method": { - "short_name": "remove_catalog_attribute", - "full_name": "::Google::Cloud::Retail::V2::CatalogService::Client#remove_catalog_attribute", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::RemoveCatalogAttributeRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Retail::V2::AttributesConfig", - "client": { - "short_name": "CatalogService::Client", - "full_name": "::Google::Cloud::Retail::V2::CatalogService::Client" - }, - "method": { - "short_name": "RemoveCatalogAttribute", - "full_name": "google.cloud.retail.v2.CatalogService.RemoveCatalogAttribute", - "service": { - "short_name": "CatalogService", - "full_name": "google.cloud.retail.v2.CatalogService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_CatalogService_ReplaceCatalogAttribute_sync", - "title": "Snippet for the replace_catalog_attribute call in the CatalogService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::CatalogService::Client#replace_catalog_attribute.", - "file": "catalog_service/replace_catalog_attribute.rb", - "language": "RUBY", - "client_method": { - "short_name": "replace_catalog_attribute", - "full_name": "::Google::Cloud::Retail::V2::CatalogService::Client#replace_catalog_attribute", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::ReplaceCatalogAttributeRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Retail::V2::AttributesConfig", - "client": { - "short_name": "CatalogService::Client", - "full_name": "::Google::Cloud::Retail::V2::CatalogService::Client" - }, - "method": { - "short_name": "ReplaceCatalogAttribute", - "full_name": "google.cloud.retail.v2.CatalogService.ReplaceCatalogAttribute", - "service": { - "short_name": "CatalogService", - "full_name": "google.cloud.retail.v2.CatalogService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_CompletionService_CompleteQuery_sync", - "title": "Snippet for the complete_query call in the CompletionService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::CompletionService::Client#complete_query.", - "file": "completion_service/complete_query.rb", - "language": "RUBY", - "client_method": { - "short_name": "complete_query", - "full_name": "::Google::Cloud::Retail::V2::CompletionService::Client#complete_query", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::CompleteQueryRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Retail::V2::CompleteQueryResponse", - "client": { - "short_name": "CompletionService::Client", - "full_name": "::Google::Cloud::Retail::V2::CompletionService::Client" - }, - "method": { - "short_name": "CompleteQuery", - "full_name": "google.cloud.retail.v2.CompletionService.CompleteQuery", - "service": { - "short_name": "CompletionService", - "full_name": "google.cloud.retail.v2.CompletionService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_CompletionService_ImportCompletionData_sync", - "title": "Snippet for the import_completion_data call in the CompletionService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::CompletionService::Client#import_completion_data.", - "file": "completion_service/import_completion_data.rb", - "language": "RUBY", - "client_method": { - "short_name": "import_completion_data", - "full_name": "::Google::Cloud::Retail::V2::CompletionService::Client#import_completion_data", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::ImportCompletionDataRequest", - "name": "request" - } - ], - "result_type": "::Google::Longrunning::Operation", - "client": { - "short_name": "CompletionService::Client", - "full_name": "::Google::Cloud::Retail::V2::CompletionService::Client" - }, - "method": { - "short_name": "ImportCompletionData", - "full_name": "google.cloud.retail.v2.CompletionService.ImportCompletionData", - "service": { - "short_name": "CompletionService", - "full_name": "google.cloud.retail.v2.CompletionService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 53, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_ControlService_CreateControl_sync", - "title": "Snippet for the create_control call in the ControlService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ControlService::Client#create_control.", - "file": "control_service/create_control.rb", - "language": "RUBY", - "client_method": { - "short_name": "create_control", - "full_name": "::Google::Cloud::Retail::V2::ControlService::Client#create_control", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::CreateControlRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Retail::V2::Control", - "client": { - "short_name": "ControlService::Client", - "full_name": "::Google::Cloud::Retail::V2::ControlService::Client" - }, - "method": { - "short_name": "CreateControl", - "full_name": "google.cloud.retail.v2.ControlService.CreateControl", - "service": { - "short_name": "ControlService", - "full_name": "google.cloud.retail.v2.ControlService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_ControlService_DeleteControl_sync", - "title": "Snippet for the delete_control call in the ControlService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ControlService::Client#delete_control.", - "file": "control_service/delete_control.rb", - "language": "RUBY", - "client_method": { - "short_name": "delete_control", - "full_name": "::Google::Cloud::Retail::V2::ControlService::Client#delete_control", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::DeleteControlRequest", - "name": "request" - } - ], - "result_type": "::Google::Protobuf::Empty", - "client": { - "short_name": "ControlService::Client", - "full_name": "::Google::Cloud::Retail::V2::ControlService::Client" - }, - "method": { - "short_name": "DeleteControl", - "full_name": "google.cloud.retail.v2.ControlService.DeleteControl", - "service": { - "short_name": "ControlService", - "full_name": "google.cloud.retail.v2.ControlService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_ControlService_UpdateControl_sync", - "title": "Snippet for the update_control call in the ControlService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ControlService::Client#update_control.", - "file": "control_service/update_control.rb", - "language": "RUBY", - "client_method": { - "short_name": "update_control", - "full_name": "::Google::Cloud::Retail::V2::ControlService::Client#update_control", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::UpdateControlRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Retail::V2::Control", - "client": { - "short_name": "ControlService::Client", - "full_name": "::Google::Cloud::Retail::V2::ControlService::Client" - }, - "method": { - "short_name": "UpdateControl", - "full_name": "google.cloud.retail.v2.ControlService.UpdateControl", - "service": { - "short_name": "ControlService", - "full_name": "google.cloud.retail.v2.ControlService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_ControlService_GetControl_sync", - "title": "Snippet for the get_control call in the ControlService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ControlService::Client#get_control.", - "file": "control_service/get_control.rb", - "language": "RUBY", - "client_method": { - "short_name": "get_control", - "full_name": "::Google::Cloud::Retail::V2::ControlService::Client#get_control", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::GetControlRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Retail::V2::Control", - "client": { - "short_name": "ControlService::Client", - "full_name": "::Google::Cloud::Retail::V2::ControlService::Client" - }, - "method": { - "short_name": "GetControl", - "full_name": "google.cloud.retail.v2.ControlService.GetControl", - "service": { - "short_name": "ControlService", - "full_name": "google.cloud.retail.v2.ControlService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_ControlService_ListControls_sync", - "title": "Snippet for the list_controls call in the ControlService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ControlService::Client#list_controls.", - "file": "control_service/list_controls.rb", - "language": "RUBY", - "client_method": { - "short_name": "list_controls", - "full_name": "::Google::Cloud::Retail::V2::ControlService::Client#list_controls", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::ListControlsRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Retail::V2::ListControlsResponse", - "client": { - "short_name": "ControlService::Client", - "full_name": "::Google::Cloud::Retail::V2::ControlService::Client" - }, - "method": { - "short_name": "ListControls", - "full_name": "google.cloud.retail.v2.ControlService.ListControls", - "service": { - "short_name": "ControlService", - "full_name": "google.cloud.retail.v2.ControlService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 50, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_SearchService_Search_sync", - "title": "Snippet for the search call in the SearchService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::SearchService::Client#search.", - "file": "search_service/search.rb", - "language": "RUBY", - "client_method": { - "short_name": "search", - "full_name": "::Google::Cloud::Retail::V2::SearchService::Client#search", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::SearchRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Retail::V2::SearchResponse", - "client": { - "short_name": "SearchService::Client", - "full_name": "::Google::Cloud::Retail::V2::SearchService::Client" - }, - "method": { - "short_name": "Search", - "full_name": "google.cloud.retail.v2.SearchService.Search", - "service": { - "short_name": "SearchService", - "full_name": "google.cloud.retail.v2.SearchService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 50, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_ConversationalSearchService_ConversationalSearch_sync", - "title": "Snippet for the conversational_search call in the ConversationalSearchService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ConversationalSearchService::Client#conversational_search.", - "file": "conversational_search_service/conversational_search.rb", - "language": "RUBY", - "client_method": { - "short_name": "conversational_search", - "full_name": "::Google::Cloud::Retail::V2::ConversationalSearchService::Client#conversational_search", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::ConversationalSearchRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Retail::V2::ConversationalSearchResponse", - "client": { - "short_name": "ConversationalSearchService::Client", - "full_name": "::Google::Cloud::Retail::V2::ConversationalSearchService::Client" - }, - "method": { - "short_name": "ConversationalSearch", - "full_name": "google.cloud.retail.v2.ConversationalSearchService.ConversationalSearch", - "service": { - "short_name": "ConversationalSearchService", - "full_name": "google.cloud.retail.v2.ConversationalSearchService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 49, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_GenerativeQuestionService_UpdateGenerativeQuestionsFeatureConfig_sync", - "title": "Snippet for the update_generative_questions_feature_config call in the GenerativeQuestionService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::GenerativeQuestionService::Client#update_generative_questions_feature_config.", - "file": "generative_question_service/update_generative_questions_feature_config.rb", - "language": "RUBY", - "client_method": { - "short_name": "update_generative_questions_feature_config", - "full_name": "::Google::Cloud::Retail::V2::GenerativeQuestionService::Client#update_generative_questions_feature_config", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::UpdateGenerativeQuestionsFeatureConfigRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig", - "client": { - "short_name": "GenerativeQuestionService::Client", - "full_name": "::Google::Cloud::Retail::V2::GenerativeQuestionService::Client" - }, - "method": { - "short_name": "UpdateGenerativeQuestionsFeatureConfig", - "full_name": "google.cloud.retail.v2.GenerativeQuestionService.UpdateGenerativeQuestionsFeatureConfig", - "service": { - "short_name": "GenerativeQuestionService", - "full_name": "google.cloud.retail.v2.GenerativeQuestionService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_GenerativeQuestionService_GetGenerativeQuestionsFeatureConfig_sync", - "title": "Snippet for the get_generative_questions_feature_config call in the GenerativeQuestionService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::GenerativeQuestionService::Client#get_generative_questions_feature_config.", - "file": "generative_question_service/get_generative_questions_feature_config.rb", - "language": "RUBY", - "client_method": { - "short_name": "get_generative_questions_feature_config", - "full_name": "::Google::Cloud::Retail::V2::GenerativeQuestionService::Client#get_generative_questions_feature_config", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::GetGenerativeQuestionsFeatureConfigRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig", - "client": { - "short_name": "GenerativeQuestionService::Client", - "full_name": "::Google::Cloud::Retail::V2::GenerativeQuestionService::Client" - }, - "method": { - "short_name": "GetGenerativeQuestionsFeatureConfig", - "full_name": "google.cloud.retail.v2.GenerativeQuestionService.GetGenerativeQuestionsFeatureConfig", - "service": { - "short_name": "GenerativeQuestionService", - "full_name": "google.cloud.retail.v2.GenerativeQuestionService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_GenerativeQuestionService_ListGenerativeQuestionConfigs_sync", - "title": "Snippet for the list_generative_question_configs call in the GenerativeQuestionService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::GenerativeQuestionService::Client#list_generative_question_configs.", - "file": "generative_question_service/list_generative_question_configs.rb", - "language": "RUBY", - "client_method": { - "short_name": "list_generative_question_configs", - "full_name": "::Google::Cloud::Retail::V2::GenerativeQuestionService::Client#list_generative_question_configs", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsResponse", - "client": { - "short_name": "GenerativeQuestionService::Client", - "full_name": "::Google::Cloud::Retail::V2::GenerativeQuestionService::Client" - }, - "method": { - "short_name": "ListGenerativeQuestionConfigs", - "full_name": "google.cloud.retail.v2.GenerativeQuestionService.ListGenerativeQuestionConfigs", - "service": { - "short_name": "GenerativeQuestionService", - "full_name": "google.cloud.retail.v2.GenerativeQuestionService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_GenerativeQuestionService_UpdateGenerativeQuestionConfig_sync", - "title": "Snippet for the update_generative_question_config call in the GenerativeQuestionService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::GenerativeQuestionService::Client#update_generative_question_config.", - "file": "generative_question_service/update_generative_question_config.rb", - "language": "RUBY", - "client_method": { - "short_name": "update_generative_question_config", - "full_name": "::Google::Cloud::Retail::V2::GenerativeQuestionService::Client#update_generative_question_config", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::UpdateGenerativeQuestionConfigRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Retail::V2::GenerativeQuestionConfig", - "client": { - "short_name": "GenerativeQuestionService::Client", - "full_name": "::Google::Cloud::Retail::V2::GenerativeQuestionService::Client" - }, - "method": { - "short_name": "UpdateGenerativeQuestionConfig", - "full_name": "google.cloud.retail.v2.GenerativeQuestionService.UpdateGenerativeQuestionConfig", - "service": { - "short_name": "GenerativeQuestionService", - "full_name": "google.cloud.retail.v2.GenerativeQuestionService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_GenerativeQuestionService_BatchUpdateGenerativeQuestionConfigs_sync", - "title": "Snippet for the batch_update_generative_question_configs call in the GenerativeQuestionService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::GenerativeQuestionService::Client#batch_update_generative_question_configs.", - "file": "generative_question_service/batch_update_generative_question_configs.rb", - "language": "RUBY", - "client_method": { - "short_name": "batch_update_generative_question_configs", - "full_name": "::Google::Cloud::Retail::V2::GenerativeQuestionService::Client#batch_update_generative_question_configs", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsResponse", - "client": { - "short_name": "GenerativeQuestionService::Client", - "full_name": "::Google::Cloud::Retail::V2::GenerativeQuestionService::Client" - }, - "method": { - "short_name": "BatchUpdateGenerativeQuestionConfigs", - "full_name": "google.cloud.retail.v2.GenerativeQuestionService.BatchUpdateGenerativeQuestionConfigs", - "service": { - "short_name": "GenerativeQuestionService", - "full_name": "google.cloud.retail.v2.GenerativeQuestionService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_ModelService_CreateModel_sync", - "title": "Snippet for the create_model call in the ModelService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ModelService::Client#create_model.", - "file": "model_service/create_model.rb", - "language": "RUBY", - "client_method": { - "short_name": "create_model", - "full_name": "::Google::Cloud::Retail::V2::ModelService::Client#create_model", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::CreateModelRequest", - "name": "request" - } - ], - "result_type": "::Google::Longrunning::Operation", - "client": { - "short_name": "ModelService::Client", - "full_name": "::Google::Cloud::Retail::V2::ModelService::Client" - }, - "method": { - "short_name": "CreateModel", - "full_name": "google.cloud.retail.v2.ModelService.CreateModel", - "service": { - "short_name": "ModelService", - "full_name": "google.cloud.retail.v2.ModelService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 53, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_ModelService_GetModel_sync", - "title": "Snippet for the get_model call in the ModelService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ModelService::Client#get_model.", - "file": "model_service/get_model.rb", - "language": "RUBY", - "client_method": { - "short_name": "get_model", - "full_name": "::Google::Cloud::Retail::V2::ModelService::Client#get_model", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::GetModelRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Retail::V2::Model", - "client": { - "short_name": "ModelService::Client", - "full_name": "::Google::Cloud::Retail::V2::ModelService::Client" - }, - "method": { - "short_name": "GetModel", - "full_name": "google.cloud.retail.v2.ModelService.GetModel", - "service": { - "short_name": "ModelService", - "full_name": "google.cloud.retail.v2.ModelService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_ModelService_PauseModel_sync", - "title": "Snippet for the pause_model call in the ModelService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ModelService::Client#pause_model.", - "file": "model_service/pause_model.rb", - "language": "RUBY", - "client_method": { - "short_name": "pause_model", - "full_name": "::Google::Cloud::Retail::V2::ModelService::Client#pause_model", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::PauseModelRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Retail::V2::Model", - "client": { - "short_name": "ModelService::Client", - "full_name": "::Google::Cloud::Retail::V2::ModelService::Client" - }, - "method": { - "short_name": "PauseModel", - "full_name": "google.cloud.retail.v2.ModelService.PauseModel", - "service": { - "short_name": "ModelService", - "full_name": "google.cloud.retail.v2.ModelService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_ModelService_ResumeModel_sync", - "title": "Snippet for the resume_model call in the ModelService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ModelService::Client#resume_model.", - "file": "model_service/resume_model.rb", - "language": "RUBY", - "client_method": { - "short_name": "resume_model", - "full_name": "::Google::Cloud::Retail::V2::ModelService::Client#resume_model", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::ResumeModelRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Retail::V2::Model", - "client": { - "short_name": "ModelService::Client", - "full_name": "::Google::Cloud::Retail::V2::ModelService::Client" - }, - "method": { - "short_name": "ResumeModel", - "full_name": "google.cloud.retail.v2.ModelService.ResumeModel", - "service": { - "short_name": "ModelService", - "full_name": "google.cloud.retail.v2.ModelService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_ModelService_DeleteModel_sync", - "title": "Snippet for the delete_model call in the ModelService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ModelService::Client#delete_model.", - "file": "model_service/delete_model.rb", - "language": "RUBY", - "client_method": { - "short_name": "delete_model", - "full_name": "::Google::Cloud::Retail::V2::ModelService::Client#delete_model", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::DeleteModelRequest", - "name": "request" - } - ], - "result_type": "::Google::Protobuf::Empty", - "client": { - "short_name": "ModelService::Client", - "full_name": "::Google::Cloud::Retail::V2::ModelService::Client" - }, - "method": { - "short_name": "DeleteModel", - "full_name": "google.cloud.retail.v2.ModelService.DeleteModel", - "service": { - "short_name": "ModelService", - "full_name": "google.cloud.retail.v2.ModelService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_ModelService_ListModels_sync", - "title": "Snippet for the list_models call in the ModelService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ModelService::Client#list_models.", - "file": "model_service/list_models.rb", - "language": "RUBY", - "client_method": { - "short_name": "list_models", - "full_name": "::Google::Cloud::Retail::V2::ModelService::Client#list_models", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::ListModelsRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Retail::V2::ListModelsResponse", - "client": { - "short_name": "ModelService::Client", - "full_name": "::Google::Cloud::Retail::V2::ModelService::Client" - }, - "method": { - "short_name": "ListModels", - "full_name": "google.cloud.retail.v2.ModelService.ListModels", - "service": { - "short_name": "ModelService", - "full_name": "google.cloud.retail.v2.ModelService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 50, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_ModelService_UpdateModel_sync", - "title": "Snippet for the update_model call in the ModelService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ModelService::Client#update_model.", - "file": "model_service/update_model.rb", - "language": "RUBY", - "client_method": { - "short_name": "update_model", - "full_name": "::Google::Cloud::Retail::V2::ModelService::Client#update_model", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::UpdateModelRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Retail::V2::Model", - "client": { - "short_name": "ModelService::Client", - "full_name": "::Google::Cloud::Retail::V2::ModelService::Client" - }, - "method": { - "short_name": "UpdateModel", - "full_name": "google.cloud.retail.v2.ModelService.UpdateModel", - "service": { - "short_name": "ModelService", - "full_name": "google.cloud.retail.v2.ModelService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_ModelService_TuneModel_sync", - "title": "Snippet for the tune_model call in the ModelService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ModelService::Client#tune_model.", - "file": "model_service/tune_model.rb", - "language": "RUBY", - "client_method": { - "short_name": "tune_model", - "full_name": "::Google::Cloud::Retail::V2::ModelService::Client#tune_model", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::TuneModelRequest", - "name": "request" - } - ], - "result_type": "::Google::Longrunning::Operation", - "client": { - "short_name": "ModelService::Client", - "full_name": "::Google::Cloud::Retail::V2::ModelService::Client" - }, - "method": { - "short_name": "TuneModel", - "full_name": "google.cloud.retail.v2.ModelService.TuneModel", - "service": { - "short_name": "ModelService", - "full_name": "google.cloud.retail.v2.ModelService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 53, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_PredictionService_Predict_sync", - "title": "Snippet for the predict call in the PredictionService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::PredictionService::Client#predict.", - "file": "prediction_service/predict.rb", - "language": "RUBY", - "client_method": { - "short_name": "predict", - "full_name": "::Google::Cloud::Retail::V2::PredictionService::Client#predict", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::PredictRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Retail::V2::PredictResponse", - "client": { - "short_name": "PredictionService::Client", - "full_name": "::Google::Cloud::Retail::V2::PredictionService::Client" - }, - "method": { - "short_name": "Predict", - "full_name": "google.cloud.retail.v2.PredictionService.Predict", - "service": { - "short_name": "PredictionService", - "full_name": "google.cloud.retail.v2.PredictionService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_ProductService_CreateProduct_sync", - "title": "Snippet for the create_product call in the ProductService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ProductService::Client#create_product.", - "file": "product_service/create_product.rb", - "language": "RUBY", - "client_method": { - "short_name": "create_product", - "full_name": "::Google::Cloud::Retail::V2::ProductService::Client#create_product", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::CreateProductRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Retail::V2::Product", - "client": { - "short_name": "ProductService::Client", - "full_name": "::Google::Cloud::Retail::V2::ProductService::Client" - }, - "method": { - "short_name": "CreateProduct", - "full_name": "google.cloud.retail.v2.ProductService.CreateProduct", - "service": { - "short_name": "ProductService", - "full_name": "google.cloud.retail.v2.ProductService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_ProductService_GetProduct_sync", - "title": "Snippet for the get_product call in the ProductService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ProductService::Client#get_product.", - "file": "product_service/get_product.rb", - "language": "RUBY", - "client_method": { - "short_name": "get_product", - "full_name": "::Google::Cloud::Retail::V2::ProductService::Client#get_product", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::GetProductRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Retail::V2::Product", - "client": { - "short_name": "ProductService::Client", - "full_name": "::Google::Cloud::Retail::V2::ProductService::Client" - }, - "method": { - "short_name": "GetProduct", - "full_name": "google.cloud.retail.v2.ProductService.GetProduct", - "service": { - "short_name": "ProductService", - "full_name": "google.cloud.retail.v2.ProductService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_ProductService_ListProducts_sync", - "title": "Snippet for the list_products call in the ProductService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ProductService::Client#list_products.", - "file": "product_service/list_products.rb", - "language": "RUBY", - "client_method": { - "short_name": "list_products", - "full_name": "::Google::Cloud::Retail::V2::ProductService::Client#list_products", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::ListProductsRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Retail::V2::ListProductsResponse", - "client": { - "short_name": "ProductService::Client", - "full_name": "::Google::Cloud::Retail::V2::ProductService::Client" - }, - "method": { - "short_name": "ListProducts", - "full_name": "google.cloud.retail.v2.ProductService.ListProducts", - "service": { - "short_name": "ProductService", - "full_name": "google.cloud.retail.v2.ProductService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 50, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_ProductService_UpdateProduct_sync", - "title": "Snippet for the update_product call in the ProductService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ProductService::Client#update_product.", - "file": "product_service/update_product.rb", - "language": "RUBY", - "client_method": { - "short_name": "update_product", - "full_name": "::Google::Cloud::Retail::V2::ProductService::Client#update_product", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::UpdateProductRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Retail::V2::Product", - "client": { - "short_name": "ProductService::Client", - "full_name": "::Google::Cloud::Retail::V2::ProductService::Client" - }, - "method": { - "short_name": "UpdateProduct", - "full_name": "google.cloud.retail.v2.ProductService.UpdateProduct", - "service": { - "short_name": "ProductService", - "full_name": "google.cloud.retail.v2.ProductService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_ProductService_DeleteProduct_sync", - "title": "Snippet for the delete_product call in the ProductService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ProductService::Client#delete_product.", - "file": "product_service/delete_product.rb", - "language": "RUBY", - "client_method": { - "short_name": "delete_product", - "full_name": "::Google::Cloud::Retail::V2::ProductService::Client#delete_product", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::DeleteProductRequest", - "name": "request" - } - ], - "result_type": "::Google::Protobuf::Empty", - "client": { - "short_name": "ProductService::Client", - "full_name": "::Google::Cloud::Retail::V2::ProductService::Client" - }, - "method": { - "short_name": "DeleteProduct", - "full_name": "google.cloud.retail.v2.ProductService.DeleteProduct", - "service": { - "short_name": "ProductService", - "full_name": "google.cloud.retail.v2.ProductService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_ProductService_PurgeProducts_sync", - "title": "Snippet for the purge_products call in the ProductService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ProductService::Client#purge_products.", - "file": "product_service/purge_products.rb", - "language": "RUBY", - "client_method": { - "short_name": "purge_products", - "full_name": "::Google::Cloud::Retail::V2::ProductService::Client#purge_products", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::PurgeProductsRequest", - "name": "request" - } - ], - "result_type": "::Google::Longrunning::Operation", - "client": { - "short_name": "ProductService::Client", - "full_name": "::Google::Cloud::Retail::V2::ProductService::Client" - }, - "method": { - "short_name": "PurgeProducts", - "full_name": "google.cloud.retail.v2.ProductService.PurgeProducts", - "service": { - "short_name": "ProductService", - "full_name": "google.cloud.retail.v2.ProductService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 53, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_ProductService_ImportProducts_sync", - "title": "Snippet for the import_products call in the ProductService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ProductService::Client#import_products.", - "file": "product_service/import_products.rb", - "language": "RUBY", - "client_method": { - "short_name": "import_products", - "full_name": "::Google::Cloud::Retail::V2::ProductService::Client#import_products", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::ImportProductsRequest", - "name": "request" - } - ], - "result_type": "::Google::Longrunning::Operation", - "client": { - "short_name": "ProductService::Client", - "full_name": "::Google::Cloud::Retail::V2::ProductService::Client" - }, - "method": { - "short_name": "ImportProducts", - "full_name": "google.cloud.retail.v2.ProductService.ImportProducts", - "service": { - "short_name": "ProductService", - "full_name": "google.cloud.retail.v2.ProductService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 53, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_ProductService_SetInventory_sync", - "title": "Snippet for the set_inventory call in the ProductService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ProductService::Client#set_inventory.", - "file": "product_service/set_inventory.rb", - "language": "RUBY", - "client_method": { - "short_name": "set_inventory", - "full_name": "::Google::Cloud::Retail::V2::ProductService::Client#set_inventory", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::SetInventoryRequest", - "name": "request" - } - ], - "result_type": "::Google::Longrunning::Operation", - "client": { - "short_name": "ProductService::Client", - "full_name": "::Google::Cloud::Retail::V2::ProductService::Client" - }, - "method": { - "short_name": "SetInventory", - "full_name": "google.cloud.retail.v2.ProductService.SetInventory", - "service": { - "short_name": "ProductService", - "full_name": "google.cloud.retail.v2.ProductService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 53, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_ProductService_AddFulfillmentPlaces_sync", - "title": "Snippet for the add_fulfillment_places call in the ProductService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ProductService::Client#add_fulfillment_places.", - "file": "product_service/add_fulfillment_places.rb", - "language": "RUBY", - "client_method": { - "short_name": "add_fulfillment_places", - "full_name": "::Google::Cloud::Retail::V2::ProductService::Client#add_fulfillment_places", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest", - "name": "request" - } - ], - "result_type": "::Google::Longrunning::Operation", - "client": { - "short_name": "ProductService::Client", - "full_name": "::Google::Cloud::Retail::V2::ProductService::Client" - }, - "method": { - "short_name": "AddFulfillmentPlaces", - "full_name": "google.cloud.retail.v2.ProductService.AddFulfillmentPlaces", - "service": { - "short_name": "ProductService", - "full_name": "google.cloud.retail.v2.ProductService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 53, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_ProductService_RemoveFulfillmentPlaces_sync", - "title": "Snippet for the remove_fulfillment_places call in the ProductService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ProductService::Client#remove_fulfillment_places.", - "file": "product_service/remove_fulfillment_places.rb", - "language": "RUBY", - "client_method": { - "short_name": "remove_fulfillment_places", - "full_name": "::Google::Cloud::Retail::V2::ProductService::Client#remove_fulfillment_places", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest", - "name": "request" - } - ], - "result_type": "::Google::Longrunning::Operation", - "client": { - "short_name": "ProductService::Client", - "full_name": "::Google::Cloud::Retail::V2::ProductService::Client" - }, - "method": { - "short_name": "RemoveFulfillmentPlaces", - "full_name": "google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces", - "service": { - "short_name": "ProductService", - "full_name": "google.cloud.retail.v2.ProductService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 53, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_ProductService_AddLocalInventories_sync", - "title": "Snippet for the add_local_inventories call in the ProductService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ProductService::Client#add_local_inventories.", - "file": "product_service/add_local_inventories.rb", - "language": "RUBY", - "client_method": { - "short_name": "add_local_inventories", - "full_name": "::Google::Cloud::Retail::V2::ProductService::Client#add_local_inventories", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::AddLocalInventoriesRequest", - "name": "request" - } - ], - "result_type": "::Google::Longrunning::Operation", - "client": { - "short_name": "ProductService::Client", - "full_name": "::Google::Cloud::Retail::V2::ProductService::Client" - }, - "method": { - "short_name": "AddLocalInventories", - "full_name": "google.cloud.retail.v2.ProductService.AddLocalInventories", - "service": { - "short_name": "ProductService", - "full_name": "google.cloud.retail.v2.ProductService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 53, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_ProductService_RemoveLocalInventories_sync", - "title": "Snippet for the remove_local_inventories call in the ProductService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ProductService::Client#remove_local_inventories.", - "file": "product_service/remove_local_inventories.rb", - "language": "RUBY", - "client_method": { - "short_name": "remove_local_inventories", - "full_name": "::Google::Cloud::Retail::V2::ProductService::Client#remove_local_inventories", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::RemoveLocalInventoriesRequest", - "name": "request" - } - ], - "result_type": "::Google::Longrunning::Operation", - "client": { - "short_name": "ProductService::Client", - "full_name": "::Google::Cloud::Retail::V2::ProductService::Client" - }, - "method": { - "short_name": "RemoveLocalInventories", - "full_name": "google.cloud.retail.v2.ProductService.RemoveLocalInventories", - "service": { - "short_name": "ProductService", - "full_name": "google.cloud.retail.v2.ProductService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 53, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_ServingConfigService_CreateServingConfig_sync", - "title": "Snippet for the create_serving_config call in the ServingConfigService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ServingConfigService::Client#create_serving_config.", - "file": "serving_config_service/create_serving_config.rb", - "language": "RUBY", - "client_method": { - "short_name": "create_serving_config", - "full_name": "::Google::Cloud::Retail::V2::ServingConfigService::Client#create_serving_config", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::CreateServingConfigRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Retail::V2::ServingConfig", - "client": { - "short_name": "ServingConfigService::Client", - "full_name": "::Google::Cloud::Retail::V2::ServingConfigService::Client" - }, - "method": { - "short_name": "CreateServingConfig", - "full_name": "google.cloud.retail.v2.ServingConfigService.CreateServingConfig", - "service": { - "short_name": "ServingConfigService", - "full_name": "google.cloud.retail.v2.ServingConfigService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_ServingConfigService_DeleteServingConfig_sync", - "title": "Snippet for the delete_serving_config call in the ServingConfigService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ServingConfigService::Client#delete_serving_config.", - "file": "serving_config_service/delete_serving_config.rb", - "language": "RUBY", - "client_method": { - "short_name": "delete_serving_config", - "full_name": "::Google::Cloud::Retail::V2::ServingConfigService::Client#delete_serving_config", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::DeleteServingConfigRequest", - "name": "request" - } - ], - "result_type": "::Google::Protobuf::Empty", - "client": { - "short_name": "ServingConfigService::Client", - "full_name": "::Google::Cloud::Retail::V2::ServingConfigService::Client" - }, - "method": { - "short_name": "DeleteServingConfig", - "full_name": "google.cloud.retail.v2.ServingConfigService.DeleteServingConfig", - "service": { - "short_name": "ServingConfigService", - "full_name": "google.cloud.retail.v2.ServingConfigService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_ServingConfigService_UpdateServingConfig_sync", - "title": "Snippet for the update_serving_config call in the ServingConfigService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ServingConfigService::Client#update_serving_config.", - "file": "serving_config_service/update_serving_config.rb", - "language": "RUBY", - "client_method": { - "short_name": "update_serving_config", - "full_name": "::Google::Cloud::Retail::V2::ServingConfigService::Client#update_serving_config", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::UpdateServingConfigRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Retail::V2::ServingConfig", - "client": { - "short_name": "ServingConfigService::Client", - "full_name": "::Google::Cloud::Retail::V2::ServingConfigService::Client" - }, - "method": { - "short_name": "UpdateServingConfig", - "full_name": "google.cloud.retail.v2.ServingConfigService.UpdateServingConfig", - "service": { - "short_name": "ServingConfigService", - "full_name": "google.cloud.retail.v2.ServingConfigService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_ServingConfigService_GetServingConfig_sync", - "title": "Snippet for the get_serving_config call in the ServingConfigService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ServingConfigService::Client#get_serving_config.", - "file": "serving_config_service/get_serving_config.rb", - "language": "RUBY", - "client_method": { - "short_name": "get_serving_config", - "full_name": "::Google::Cloud::Retail::V2::ServingConfigService::Client#get_serving_config", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::GetServingConfigRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Retail::V2::ServingConfig", - "client": { - "short_name": "ServingConfigService::Client", - "full_name": "::Google::Cloud::Retail::V2::ServingConfigService::Client" - }, - "method": { - "short_name": "GetServingConfig", - "full_name": "google.cloud.retail.v2.ServingConfigService.GetServingConfig", - "service": { - "short_name": "ServingConfigService", - "full_name": "google.cloud.retail.v2.ServingConfigService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_ServingConfigService_ListServingConfigs_sync", - "title": "Snippet for the list_serving_configs call in the ServingConfigService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ServingConfigService::Client#list_serving_configs.", - "file": "serving_config_service/list_serving_configs.rb", - "language": "RUBY", - "client_method": { - "short_name": "list_serving_configs", - "full_name": "::Google::Cloud::Retail::V2::ServingConfigService::Client#list_serving_configs", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::ListServingConfigsRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Retail::V2::ListServingConfigsResponse", - "client": { - "short_name": "ServingConfigService::Client", - "full_name": "::Google::Cloud::Retail::V2::ServingConfigService::Client" - }, - "method": { - "short_name": "ListServingConfigs", - "full_name": "google.cloud.retail.v2.ServingConfigService.ListServingConfigs", - "service": { - "short_name": "ServingConfigService", - "full_name": "google.cloud.retail.v2.ServingConfigService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 50, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_ServingConfigService_AddControl_sync", - "title": "Snippet for the add_control call in the ServingConfigService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ServingConfigService::Client#add_control.", - "file": "serving_config_service/add_control.rb", - "language": "RUBY", - "client_method": { - "short_name": "add_control", - "full_name": "::Google::Cloud::Retail::V2::ServingConfigService::Client#add_control", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::AddControlRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Retail::V2::ServingConfig", - "client": { - "short_name": "ServingConfigService::Client", - "full_name": "::Google::Cloud::Retail::V2::ServingConfigService::Client" - }, - "method": { - "short_name": "AddControl", - "full_name": "google.cloud.retail.v2.ServingConfigService.AddControl", - "service": { - "short_name": "ServingConfigService", - "full_name": "google.cloud.retail.v2.ServingConfigService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_ServingConfigService_RemoveControl_sync", - "title": "Snippet for the remove_control call in the ServingConfigService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::ServingConfigService::Client#remove_control.", - "file": "serving_config_service/remove_control.rb", - "language": "RUBY", - "client_method": { - "short_name": "remove_control", - "full_name": "::Google::Cloud::Retail::V2::ServingConfigService::Client#remove_control", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::RemoveControlRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Retail::V2::ServingConfig", - "client": { - "short_name": "ServingConfigService::Client", - "full_name": "::Google::Cloud::Retail::V2::ServingConfigService::Client" - }, - "method": { - "short_name": "RemoveControl", - "full_name": "google.cloud.retail.v2.ServingConfigService.RemoveControl", - "service": { - "short_name": "ServingConfigService", - "full_name": "google.cloud.retail.v2.ServingConfigService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_UserEventService_WriteUserEvent_sync", - "title": "Snippet for the write_user_event call in the UserEventService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::UserEventService::Client#write_user_event.", - "file": "user_event_service/write_user_event.rb", - "language": "RUBY", - "client_method": { - "short_name": "write_user_event", - "full_name": "::Google::Cloud::Retail::V2::UserEventService::Client#write_user_event", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::WriteUserEventRequest", - "name": "request" - } - ], - "result_type": "::Google::Cloud::Retail::V2::UserEvent", - "client": { - "short_name": "UserEventService::Client", - "full_name": "::Google::Cloud::Retail::V2::UserEventService::Client" - }, - "method": { - "short_name": "WriteUserEvent", - "full_name": "google.cloud.retail.v2.UserEventService.WriteUserEvent", - "service": { - "short_name": "UserEventService", - "full_name": "google.cloud.retail.v2.UserEventService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_UserEventService_CollectUserEvent_sync", - "title": "Snippet for the collect_user_event call in the UserEventService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::UserEventService::Client#collect_user_event.", - "file": "user_event_service/collect_user_event.rb", - "language": "RUBY", - "client_method": { - "short_name": "collect_user_event", - "full_name": "::Google::Cloud::Retail::V2::UserEventService::Client#collect_user_event", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::CollectUserEventRequest", - "name": "request" - } - ], - "result_type": "::Google::Api::HttpBody", - "client": { - "short_name": "UserEventService::Client", - "full_name": "::Google::Cloud::Retail::V2::UserEventService::Client" - }, - "method": { - "short_name": "CollectUserEvent", - "full_name": "google.cloud.retail.v2.UserEventService.CollectUserEvent", - "service": { - "short_name": "UserEventService", - "full_name": "google.cloud.retail.v2.UserEventService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 46, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_UserEventService_PurgeUserEvents_sync", - "title": "Snippet for the purge_user_events call in the UserEventService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::UserEventService::Client#purge_user_events.", - "file": "user_event_service/purge_user_events.rb", - "language": "RUBY", - "client_method": { - "short_name": "purge_user_events", - "full_name": "::Google::Cloud::Retail::V2::UserEventService::Client#purge_user_events", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::PurgeUserEventsRequest", - "name": "request" - } - ], - "result_type": "::Google::Longrunning::Operation", - "client": { - "short_name": "UserEventService::Client", - "full_name": "::Google::Cloud::Retail::V2::UserEventService::Client" - }, - "method": { - "short_name": "PurgeUserEvents", - "full_name": "google.cloud.retail.v2.UserEventService.PurgeUserEvents", - "service": { - "short_name": "UserEventService", - "full_name": "google.cloud.retail.v2.UserEventService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 53, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_UserEventService_ImportUserEvents_sync", - "title": "Snippet for the import_user_events call in the UserEventService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::UserEventService::Client#import_user_events.", - "file": "user_event_service/import_user_events.rb", - "language": "RUBY", - "client_method": { - "short_name": "import_user_events", - "full_name": "::Google::Cloud::Retail::V2::UserEventService::Client#import_user_events", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::ImportUserEventsRequest", - "name": "request" - } - ], - "result_type": "::Google::Longrunning::Operation", - "client": { - "short_name": "UserEventService::Client", - "full_name": "::Google::Cloud::Retail::V2::UserEventService::Client" - }, - "method": { - "short_name": "ImportUserEvents", - "full_name": "google.cloud.retail.v2.UserEventService.ImportUserEvents", - "service": { - "short_name": "UserEventService", - "full_name": "google.cloud.retail.v2.UserEventService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 53, - "type": "FULL" - } - ] - }, - { - "region_tag": "retail_v2_generated_UserEventService_RejoinUserEvents_sync", - "title": "Snippet for the rejoin_user_events call in the UserEventService service", - "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Retail::V2::UserEventService::Client#rejoin_user_events.", - "file": "user_event_service/rejoin_user_events.rb", - "language": "RUBY", - "client_method": { - "short_name": "rejoin_user_events", - "full_name": "::Google::Cloud::Retail::V2::UserEventService::Client#rejoin_user_events", - "async": false, - "parameters": [ - { - "type": "::Google::Cloud::Retail::V2::RejoinUserEventsRequest", - "name": "request" - } - ], - "result_type": "::Google::Longrunning::Operation", - "client": { - "short_name": "UserEventService::Client", - "full_name": "::Google::Cloud::Retail::V2::UserEventService::Client" - }, - "method": { - "short_name": "RejoinUserEvents", - "full_name": "google.cloud.retail.v2.UserEventService.RejoinUserEvents", - "service": { - "short_name": "UserEventService", - "full_name": "google.cloud.retail.v2.UserEventService" - } - } - }, - "canonical": true, - "origin": "API_DEFINITION", - "segments": [ - { - "start": 20, - "end": 53, - "type": "FULL" - } - ] - } - ] -} \ No newline at end of file diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/user_event_service/collect_user_event.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/user_event_service/collect_user_event.rb deleted file mode 100644 index ee81b5ede9b4..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/user_event_service/collect_user_event.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_UserEventService_CollectUserEvent_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the collect_user_event call in the UserEventService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::UserEventService::Client#collect_user_event. -# -def collect_user_event - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::UserEventService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::CollectUserEventRequest.new - - # Call the collect_user_event method. - result = client.collect_user_event request - - # The returned object is of type Google::Api::HttpBody. - p result -end -# [END retail_v2_generated_UserEventService_CollectUserEvent_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/user_event_service/import_user_events.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/user_event_service/import_user_events.rb deleted file mode 100644 index 4c20c5a126d4..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/user_event_service/import_user_events.rb +++ /dev/null @@ -1,54 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_UserEventService_ImportUserEvents_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the import_user_events call in the UserEventService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::UserEventService::Client#import_user_events. -# -def import_user_events - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::UserEventService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::ImportUserEventsRequest.new - - # Call the import_user_events method. - result = client.import_user_events request - - # The returned object is of type Gapic::Operation. You can use it to - # check the status of an operation, cancel it, or wait for results. - # Here is how to wait for a response. - result.wait_until_done! timeout: 60 - if result.response? - p result.response - else - puts "No response received." - end -end -# [END retail_v2_generated_UserEventService_ImportUserEvents_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/user_event_service/purge_user_events.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/user_event_service/purge_user_events.rb deleted file mode 100644 index 7d7df5d779bd..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/user_event_service/purge_user_events.rb +++ /dev/null @@ -1,54 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_UserEventService_PurgeUserEvents_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the purge_user_events call in the UserEventService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::UserEventService::Client#purge_user_events. -# -def purge_user_events - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::UserEventService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::PurgeUserEventsRequest.new - - # Call the purge_user_events method. - result = client.purge_user_events request - - # The returned object is of type Gapic::Operation. You can use it to - # check the status of an operation, cancel it, or wait for results. - # Here is how to wait for a response. - result.wait_until_done! timeout: 60 - if result.response? - p result.response - else - puts "No response received." - end -end -# [END retail_v2_generated_UserEventService_PurgeUserEvents_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/user_event_service/rejoin_user_events.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/user_event_service/rejoin_user_events.rb deleted file mode 100644 index 38e48c8b00d3..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/user_event_service/rejoin_user_events.rb +++ /dev/null @@ -1,54 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_UserEventService_RejoinUserEvents_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the rejoin_user_events call in the UserEventService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::UserEventService::Client#rejoin_user_events. -# -def rejoin_user_events - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::UserEventService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::RejoinUserEventsRequest.new - - # Call the rejoin_user_events method. - result = client.rejoin_user_events request - - # The returned object is of type Gapic::Operation. You can use it to - # check the status of an operation, cancel it, or wait for results. - # Here is how to wait for a response. - result.wait_until_done! timeout: 60 - if result.response? - p result.response - else - puts "No response received." - end -end -# [END retail_v2_generated_UserEventService_RejoinUserEvents_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/snippets/user_event_service/write_user_event.rb b/owl-bot-staging/google-cloud-retail-v2/snippets/user_event_service/write_user_event.rb deleted file mode 100644 index e1946f8c6a8d..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/snippets/user_event_service/write_user_event.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# [START retail_v2_generated_UserEventService_WriteUserEvent_sync] -require "google/cloud/retail/v2" - -## -# Snippet for the write_user_event call in the UserEventService service -# -# This snippet has been automatically generated and should be regarded as a code -# template only. It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in https://cloud.google.com/ruby/docs/reference. -# -# This is an auto-generated example demonstrating basic usage of -# Google::Cloud::Retail::V2::UserEventService::Client#write_user_event. -# -def write_user_event - # Create a client object. The client can be reused for multiple calls. - client = Google::Cloud::Retail::V2::UserEventService::Client.new - - # Create a request. To set request fields, pass in keyword arguments. - request = Google::Cloud::Retail::V2::WriteUserEventRequest.new - - # Call the write_user_event method. - result = client.write_user_event request - - # The returned object is of type Google::Cloud::Retail::V2::UserEvent. - p result -end -# [END retail_v2_generated_UserEventService_WriteUserEvent_sync] diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/analytics_service_operations_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/analytics_service_operations_test.rb deleted file mode 100644 index 66822830d222..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/analytics_service_operations_test.rb +++ /dev/null @@ -1,400 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "helper" - -require "gapic/grpc/service_stub" - -require "google/cloud/retail/v2/analytics_service_pb" -require "google/cloud/retail/v2/analytics_service_services_pb" -require "google/cloud/retail/v2/analytics_service" - -class ::Google::Cloud::Retail::V2::AnalyticsService::OperationsTest < Minitest::Test - class ClientStub - attr_accessor :call_rpc_count, :requests - - def initialize response, operation, &block - @response = response - @operation = operation - @block = block - @call_rpc_count = 0 - @requests = [] - end - - def call_rpc *args, **kwargs - @call_rpc_count += 1 - - @requests << @block&.call(*args, **kwargs) - - catch :response do - yield @response, @operation if block_given? - @response - end - end - - def endpoint - "endpoint.example.com" - end - - def universe_domain - "example.com" - end - - def stub_logger - nil - end - - def logger - nil - end - end - - def test_list_operations - # Create GRPC objects. - grpc_response = ::Google::Longrunning::ListOperationsResponse.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - filter = "hello world" - page_size = 42 - page_token = "hello world" - return_partial_success = true - - list_operations_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :list_operations, name - assert_kind_of ::Google::Longrunning::ListOperationsRequest, request - assert_equal "hello world", request["name"] - assert_equal "hello world", request["filter"] - assert_equal 42, request["page_size"] - assert_equal "hello world", request["page_token"] - assert_equal true, request["return_partial_success"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, list_operations_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::AnalyticsService::Operations.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.list_operations({ name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success }) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.list_operations name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.list_operations ::Google::Longrunning::ListOperationsRequest.new(name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.list_operations({ name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success }, grpc_options) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.list_operations(::Google::Longrunning::ListOperationsRequest.new(name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success), grpc_options) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, list_operations_client_stub.call_rpc_count - end - end - - def test_get_operation - # Create GRPC objects. - grpc_response = ::Google::Longrunning::Operation.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - get_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :get_operation, name - assert_kind_of ::Google::Longrunning::GetOperationRequest, request - assert_equal "hello world", request["name"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, get_operation_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::AnalyticsService::Operations.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.get_operation({ name: name }) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use named arguments - c.get_operation name: name do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.get_operation ::Google::Longrunning::GetOperationRequest.new(name: name) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.get_operation({ name: name }, grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.get_operation(::Google::Longrunning::GetOperationRequest.new(name: name), grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, get_operation_client_stub.call_rpc_count - end - end - - def test_delete_operation - # Create GRPC objects. - grpc_response = ::Google::Protobuf::Empty.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - delete_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :delete_operation, name - assert_kind_of ::Google::Longrunning::DeleteOperationRequest, request - assert_equal "hello world", request["name"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, delete_operation_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::AnalyticsService::Operations.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.delete_operation({ name: name }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.delete_operation name: name do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.delete_operation ::Google::Longrunning::DeleteOperationRequest.new(name: name) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.delete_operation({ name: name }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.delete_operation(::Google::Longrunning::DeleteOperationRequest.new(name: name), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, delete_operation_client_stub.call_rpc_count - end - end - - def test_cancel_operation - # Create GRPC objects. - grpc_response = ::Google::Protobuf::Empty.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - cancel_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :cancel_operation, name - assert_kind_of ::Google::Longrunning::CancelOperationRequest, request - assert_equal "hello world", request["name"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, cancel_operation_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::AnalyticsService::Operations.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.cancel_operation({ name: name }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.cancel_operation name: name do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.cancel_operation ::Google::Longrunning::CancelOperationRequest.new(name: name) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.cancel_operation({ name: name }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.cancel_operation(::Google::Longrunning::CancelOperationRequest.new(name: name), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, cancel_operation_client_stub.call_rpc_count - end - end - - def test_wait_operation - # Create GRPC objects. - grpc_response = ::Google::Longrunning::Operation.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - timeout = {} - - wait_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :wait_operation, name - assert_kind_of ::Google::Longrunning::WaitOperationRequest, request - assert_equal "hello world", request["name"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::Duration), request["timeout"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, wait_operation_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::AnalyticsService::Operations.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.wait_operation({ name: name, timeout: timeout }) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use named arguments - c.wait_operation name: name, timeout: timeout do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.wait_operation ::Google::Longrunning::WaitOperationRequest.new(name: name, timeout: timeout) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.wait_operation({ name: name, timeout: timeout }, grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.wait_operation(::Google::Longrunning::WaitOperationRequest.new(name: name, timeout: timeout), grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, wait_operation_client_stub.call_rpc_count - end - end - - def test_configure - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - - client = block_config = config = nil - dummy_stub = ClientStub.new nil, nil - Gapic::ServiceStub.stub :new, dummy_stub do - client = ::Google::Cloud::Retail::V2::AnalyticsService::Operations.new do |config| - config.credentials = grpc_channel - end - end - - config = client.configure do |c| - block_config = c - end - - assert_same block_config, config - assert_kind_of ::Google::Cloud::Retail::V2::AnalyticsService::Operations::Configuration, config - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/analytics_service_rest_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/analytics_service_rest_test.rb deleted file mode 100644 index 28b40dfe1bfd..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/analytics_service_rest_test.rb +++ /dev/null @@ -1,155 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "helper" -require "gapic/rest" -require "google/cloud/retail/v2/analytics_service_pb" -require "google/cloud/retail/v2/analytics_service/rest" - - -class ::Google::Cloud::Retail::V2::AnalyticsService::Rest::ClientTest < Minitest::Test - class ClientStub - attr_accessor :call_count, :requests - - def initialize response, &block - @response = response - @block = block - @call_count = 0 - @requests = [] - end - - def make_get_request uri:, params: {}, options: {}, method_name: nil - make_http_request :get, uri: uri, body: nil, params: params, options: options, method_name: method_name - end - - def make_delete_request uri:, params: {}, options: {}, method_name: nil - make_http_request :delete, uri: uri, body: nil, params: params, options: options, method_name: method_name - end - - def make_post_request uri:, body: nil, params: {}, options: {}, method_name: nil - make_http_request :post, uri: uri, body: body, params: params, options: options, method_name: method_name - end - - def make_patch_request uri:, body:, params: {}, options: {}, method_name: nil - make_http_request :patch, uri: uri, body: body, params: params, options: options, method_name: method_name - end - - def make_put_request uri:, body:, params: {}, options: {}, method_name: nil - make_http_request :put, uri: uri, body: body, params: params, options: options, method_name: method_name - end - - def make_http_request *args, **kwargs - @call_count += 1 - - @requests << @block&.call(*args, **kwargs) - - @response - end - - def endpoint - "endpoint.example.com" - end - - def universe_domain - "example.com" - end - - def stub_logger - nil - end - - def logger - nil - end - end - - def test_export_analytics_metrics - # Create test objects. - client_result = ::Google::Longrunning::Operation.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - catalog = "hello world" - output_config = {} - filter = "hello world" - - export_analytics_metrics_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::AnalyticsService::Rest::ServiceStub.stub :transcode_export_analytics_metrics_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, export_analytics_metrics_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::AnalyticsService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.export_analytics_metrics({ catalog: catalog, output_config: output_config, filter: filter }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.export_analytics_metrics catalog: catalog, output_config: output_config, filter: filter do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.export_analytics_metrics ::Google::Cloud::Retail::V2::ExportAnalyticsMetricsRequest.new(catalog: catalog, output_config: output_config, filter: filter) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.export_analytics_metrics({ catalog: catalog, output_config: output_config, filter: filter }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.export_analytics_metrics(::Google::Cloud::Retail::V2::ExportAnalyticsMetricsRequest.new(catalog: catalog, output_config: output_config, filter: filter), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, export_analytics_metrics_client_stub.call_count - end - end - end - - def test_configure - credentials_token = :dummy_value - - client = block_config = config = nil - dummy_stub = ClientStub.new nil - Gapic::Rest::ClientStub.stub :new, dummy_stub do - client = ::Google::Cloud::Retail::V2::AnalyticsService::Rest::Client.new do |config| - config.credentials = credentials_token - end - end - - config = client.configure do |c| - block_config = c - end - - assert_same block_config, config - assert_kind_of ::Google::Cloud::Retail::V2::AnalyticsService::Rest::Client::Configuration, config - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/analytics_service_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/analytics_service_test.rb deleted file mode 100644 index 271b5dd21581..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/analytics_service_test.rb +++ /dev/null @@ -1,185 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "helper" - -require "gapic/grpc/service_stub" - -require "google/cloud/retail/v2/analytics_service_pb" -require "google/cloud/retail/v2/analytics_service" - -class ::Google::Cloud::Retail::V2::AnalyticsService::ClientTest < Minitest::Test - class ClientStub - attr_accessor :call_rpc_count, :requests - - def initialize response, operation, &block - @response = response - @operation = operation - @block = block - @call_rpc_count = 0 - @requests = [] - end - - def call_rpc *args, **kwargs - @call_rpc_count += 1 - - @requests << @block&.call(*args, **kwargs) - - catch :response do - yield @response, @operation if block_given? - @response - end - end - - def endpoint - "endpoint.example.com" - end - - def universe_domain - "example.com" - end - - def stub_logger - nil - end - - def logger - nil - end - end - - def test_export_analytics_metrics - # Create GRPC objects. - grpc_response = ::Google::Longrunning::Operation.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - catalog = "hello world" - output_config = {} - filter = "hello world" - - export_analytics_metrics_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :export_analytics_metrics, name - assert_kind_of ::Google::Cloud::Retail::V2::ExportAnalyticsMetricsRequest, request - assert_equal "hello world", request["catalog"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::OutputConfig), request["output_config"] - assert_equal "hello world", request["filter"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, export_analytics_metrics_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::AnalyticsService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.export_analytics_metrics({ catalog: catalog, output_config: output_config, filter: filter }) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use named arguments - c.export_analytics_metrics catalog: catalog, output_config: output_config, filter: filter do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.export_analytics_metrics ::Google::Cloud::Retail::V2::ExportAnalyticsMetricsRequest.new(catalog: catalog, output_config: output_config, filter: filter) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.export_analytics_metrics({ catalog: catalog, output_config: output_config, filter: filter }, grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.export_analytics_metrics(::Google::Cloud::Retail::V2::ExportAnalyticsMetricsRequest.new(catalog: catalog, output_config: output_config, filter: filter), grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, export_analytics_metrics_client_stub.call_rpc_count - end - end - - def test_configure - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - - client = block_config = config = nil - dummy_stub = ClientStub.new nil, nil - Gapic::ServiceStub.stub :new, dummy_stub do - client = ::Google::Cloud::Retail::V2::AnalyticsService::Client.new do |config| - config.credentials = grpc_channel - end - end - - config = client.configure do |c| - block_config = c - end - - assert_same block_config, config - assert_kind_of ::Google::Cloud::Retail::V2::AnalyticsService::Client::Configuration, config - end - - def test_credentials - key = OpenSSL::PKey::RSA.new 2048 - cred_json = { - "private_key" => key.to_pem, - "client_email" => "app@developer.gserviceaccount.com", - "type" => "service_account" - } - key_file = StringIO.new cred_json.to_json - creds = Google::Auth::ServiceAccountCredentials.make_creds({ json_key_io: key_file }) - - dummy_stub = ClientStub.new nil, nil - Gapic::ServiceStub.stub :new, dummy_stub do - client = ::Google::Cloud::Retail::V2::AnalyticsService::Client.new do |config| - config.credentials = creds - end - assert_kind_of ::Google::Cloud::Retail::V2::AnalyticsService::Client, client - assert_equal creds, client.configure.credentials - end - end - - def test_operations_client - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - - client = nil - dummy_stub = ClientStub.new nil, nil - Gapic::ServiceStub.stub :new, dummy_stub do - client = ::Google::Cloud::Retail::V2::AnalyticsService::Client.new do |config| - config.credentials = grpc_channel - end - end - - assert_kind_of ::Google::Cloud::Retail::V2::AnalyticsService::Operations, client.operations_client - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/catalog_service_paths_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/catalog_service_paths_test.rb deleted file mode 100644 index e107597737b1..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/catalog_service_paths_test.rb +++ /dev/null @@ -1,103 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "helper" - -require "gapic/grpc/service_stub" - -require "google/cloud/retail/v2/catalog_service" - -class ::Google::Cloud::Retail::V2::CatalogService::ClientPathsTest < Minitest::Test - class DummyStub - def endpoint - "endpoint.example.com" - end - - def universe_domain - "example.com" - end - - def stub_logger - nil - end - - def logger - nil - end - end - - def test_attributes_config_path - grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - ::Gapic::ServiceStub.stub :new, DummyStub.new do - client = ::Google::Cloud::Retail::V2::CatalogService::Client.new do |config| - config.credentials = grpc_channel - end - - path = client.attributes_config_path project: "value0", location: "value1", catalog: "value2" - assert_equal "projects/value0/locations/value1/catalogs/value2/attributesConfig", path - end - end - - def test_branch_path - grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - ::Gapic::ServiceStub.stub :new, DummyStub.new do - client = ::Google::Cloud::Retail::V2::CatalogService::Client.new do |config| - config.credentials = grpc_channel - end - - path = client.branch_path project: "value0", location: "value1", catalog: "value2", branch: "value3" - assert_equal "projects/value0/locations/value1/catalogs/value2/branches/value3", path - end - end - - def test_catalog_path - grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - ::Gapic::ServiceStub.stub :new, DummyStub.new do - client = ::Google::Cloud::Retail::V2::CatalogService::Client.new do |config| - config.credentials = grpc_channel - end - - path = client.catalog_path project: "value0", location: "value1", catalog: "value2" - assert_equal "projects/value0/locations/value1/catalogs/value2", path - end - end - - def test_completion_config_path - grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - ::Gapic::ServiceStub.stub :new, DummyStub.new do - client = ::Google::Cloud::Retail::V2::CatalogService::Client.new do |config| - config.credentials = grpc_channel - end - - path = client.completion_config_path project: "value0", location: "value1", catalog: "value2" - assert_equal "projects/value0/locations/value1/catalogs/value2/completionConfig", path - end - end - - def test_location_path - grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - ::Gapic::ServiceStub.stub :new, DummyStub.new do - client = ::Google::Cloud::Retail::V2::CatalogService::Client.new do |config| - config.credentials = grpc_channel - end - - path = client.location_path project: "value0", location: "value1" - assert_equal "projects/value0/locations/value1", path - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/catalog_service_rest_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/catalog_service_rest_test.rb deleted file mode 100644 index b763a2854144..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/catalog_service_rest_test.rb +++ /dev/null @@ -1,705 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "helper" -require "gapic/rest" -require "google/cloud/retail/v2/catalog_service_pb" -require "google/cloud/retail/v2/catalog_service/rest" - - -class ::Google::Cloud::Retail::V2::CatalogService::Rest::ClientTest < Minitest::Test - class ClientStub - attr_accessor :call_count, :requests - - def initialize response, &block - @response = response - @block = block - @call_count = 0 - @requests = [] - end - - def make_get_request uri:, params: {}, options: {}, method_name: nil - make_http_request :get, uri: uri, body: nil, params: params, options: options, method_name: method_name - end - - def make_delete_request uri:, params: {}, options: {}, method_name: nil - make_http_request :delete, uri: uri, body: nil, params: params, options: options, method_name: method_name - end - - def make_post_request uri:, body: nil, params: {}, options: {}, method_name: nil - make_http_request :post, uri: uri, body: body, params: params, options: options, method_name: method_name - end - - def make_patch_request uri:, body:, params: {}, options: {}, method_name: nil - make_http_request :patch, uri: uri, body: body, params: params, options: options, method_name: method_name - end - - def make_put_request uri:, body:, params: {}, options: {}, method_name: nil - make_http_request :put, uri: uri, body: body, params: params, options: options, method_name: method_name - end - - def make_http_request *args, **kwargs - @call_count += 1 - - @requests << @block&.call(*args, **kwargs) - - @response - end - - def endpoint - "endpoint.example.com" - end - - def universe_domain - "example.com" - end - - def stub_logger - nil - end - - def logger - nil - end - end - - def test_list_catalogs - # Create test objects. - client_result = ::Google::Cloud::Retail::V2::ListCatalogsResponse.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - page_size = 42 - page_token = "hello world" - - list_catalogs_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::CatalogService::Rest::ServiceStub.stub :transcode_list_catalogs_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, list_catalogs_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::CatalogService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.list_catalogs({ parent: parent, page_size: page_size, page_token: page_token }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.list_catalogs parent: parent, page_size: page_size, page_token: page_token do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.list_catalogs ::Google::Cloud::Retail::V2::ListCatalogsRequest.new(parent: parent, page_size: page_size, page_token: page_token) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.list_catalogs({ parent: parent, page_size: page_size, page_token: page_token }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.list_catalogs(::Google::Cloud::Retail::V2::ListCatalogsRequest.new(parent: parent, page_size: page_size, page_token: page_token), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, list_catalogs_client_stub.call_count - end - end - end - - def test_update_catalog - # Create test objects. - client_result = ::Google::Cloud::Retail::V2::Catalog.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - catalog = {} - update_mask = {} - - update_catalog_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::CatalogService::Rest::ServiceStub.stub :transcode_update_catalog_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, update_catalog_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::CatalogService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.update_catalog({ catalog: catalog, update_mask: update_mask }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.update_catalog catalog: catalog, update_mask: update_mask do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.update_catalog ::Google::Cloud::Retail::V2::UpdateCatalogRequest.new(catalog: catalog, update_mask: update_mask) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.update_catalog({ catalog: catalog, update_mask: update_mask }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.update_catalog(::Google::Cloud::Retail::V2::UpdateCatalogRequest.new(catalog: catalog, update_mask: update_mask), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, update_catalog_client_stub.call_count - end - end - end - - def test_set_default_branch - # Create test objects. - client_result = ::Google::Protobuf::Empty.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - catalog = "hello world" - branch_id = "hello world" - note = "hello world" - force = true - - set_default_branch_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::CatalogService::Rest::ServiceStub.stub :transcode_set_default_branch_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, set_default_branch_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::CatalogService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.set_default_branch({ catalog: catalog, branch_id: branch_id, note: note, force: force }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.set_default_branch catalog: catalog, branch_id: branch_id, note: note, force: force do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.set_default_branch ::Google::Cloud::Retail::V2::SetDefaultBranchRequest.new(catalog: catalog, branch_id: branch_id, note: note, force: force) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.set_default_branch({ catalog: catalog, branch_id: branch_id, note: note, force: force }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.set_default_branch(::Google::Cloud::Retail::V2::SetDefaultBranchRequest.new(catalog: catalog, branch_id: branch_id, note: note, force: force), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, set_default_branch_client_stub.call_count - end - end - end - - def test_get_default_branch - # Create test objects. - client_result = ::Google::Cloud::Retail::V2::GetDefaultBranchResponse.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - catalog = "hello world" - - get_default_branch_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::CatalogService::Rest::ServiceStub.stub :transcode_get_default_branch_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, get_default_branch_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::CatalogService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.get_default_branch({ catalog: catalog }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.get_default_branch catalog: catalog do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.get_default_branch ::Google::Cloud::Retail::V2::GetDefaultBranchRequest.new(catalog: catalog) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.get_default_branch({ catalog: catalog }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.get_default_branch(::Google::Cloud::Retail::V2::GetDefaultBranchRequest.new(catalog: catalog), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, get_default_branch_client_stub.call_count - end - end - end - - def test_get_completion_config - # Create test objects. - client_result = ::Google::Cloud::Retail::V2::CompletionConfig.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - get_completion_config_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::CatalogService::Rest::ServiceStub.stub :transcode_get_completion_config_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, get_completion_config_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::CatalogService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.get_completion_config({ name: name }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.get_completion_config name: name do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.get_completion_config ::Google::Cloud::Retail::V2::GetCompletionConfigRequest.new(name: name) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.get_completion_config({ name: name }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.get_completion_config(::Google::Cloud::Retail::V2::GetCompletionConfigRequest.new(name: name), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, get_completion_config_client_stub.call_count - end - end - end - - def test_update_completion_config - # Create test objects. - client_result = ::Google::Cloud::Retail::V2::CompletionConfig.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - completion_config = {} - update_mask = {} - - update_completion_config_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::CatalogService::Rest::ServiceStub.stub :transcode_update_completion_config_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, update_completion_config_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::CatalogService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.update_completion_config({ completion_config: completion_config, update_mask: update_mask }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.update_completion_config completion_config: completion_config, update_mask: update_mask do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.update_completion_config ::Google::Cloud::Retail::V2::UpdateCompletionConfigRequest.new(completion_config: completion_config, update_mask: update_mask) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.update_completion_config({ completion_config: completion_config, update_mask: update_mask }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.update_completion_config(::Google::Cloud::Retail::V2::UpdateCompletionConfigRequest.new(completion_config: completion_config, update_mask: update_mask), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, update_completion_config_client_stub.call_count - end - end - end - - def test_get_attributes_config - # Create test objects. - client_result = ::Google::Cloud::Retail::V2::AttributesConfig.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - get_attributes_config_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::CatalogService::Rest::ServiceStub.stub :transcode_get_attributes_config_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, get_attributes_config_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::CatalogService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.get_attributes_config({ name: name }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.get_attributes_config name: name do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.get_attributes_config ::Google::Cloud::Retail::V2::GetAttributesConfigRequest.new(name: name) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.get_attributes_config({ name: name }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.get_attributes_config(::Google::Cloud::Retail::V2::GetAttributesConfigRequest.new(name: name), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, get_attributes_config_client_stub.call_count - end - end - end - - def test_update_attributes_config - # Create test objects. - client_result = ::Google::Cloud::Retail::V2::AttributesConfig.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - attributes_config = {} - update_mask = {} - - update_attributes_config_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::CatalogService::Rest::ServiceStub.stub :transcode_update_attributes_config_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, update_attributes_config_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::CatalogService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.update_attributes_config({ attributes_config: attributes_config, update_mask: update_mask }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.update_attributes_config attributes_config: attributes_config, update_mask: update_mask do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.update_attributes_config ::Google::Cloud::Retail::V2::UpdateAttributesConfigRequest.new(attributes_config: attributes_config, update_mask: update_mask) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.update_attributes_config({ attributes_config: attributes_config, update_mask: update_mask }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.update_attributes_config(::Google::Cloud::Retail::V2::UpdateAttributesConfigRequest.new(attributes_config: attributes_config, update_mask: update_mask), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, update_attributes_config_client_stub.call_count - end - end - end - - def test_add_catalog_attribute - # Create test objects. - client_result = ::Google::Cloud::Retail::V2::AttributesConfig.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - attributes_config = "hello world" - catalog_attribute = {} - - add_catalog_attribute_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::CatalogService::Rest::ServiceStub.stub :transcode_add_catalog_attribute_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, add_catalog_attribute_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::CatalogService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.add_catalog_attribute({ attributes_config: attributes_config, catalog_attribute: catalog_attribute }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.add_catalog_attribute attributes_config: attributes_config, catalog_attribute: catalog_attribute do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.add_catalog_attribute ::Google::Cloud::Retail::V2::AddCatalogAttributeRequest.new(attributes_config: attributes_config, catalog_attribute: catalog_attribute) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.add_catalog_attribute({ attributes_config: attributes_config, catalog_attribute: catalog_attribute }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.add_catalog_attribute(::Google::Cloud::Retail::V2::AddCatalogAttributeRequest.new(attributes_config: attributes_config, catalog_attribute: catalog_attribute), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, add_catalog_attribute_client_stub.call_count - end - end - end - - def test_remove_catalog_attribute - # Create test objects. - client_result = ::Google::Cloud::Retail::V2::AttributesConfig.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - attributes_config = "hello world" - key = "hello world" - - remove_catalog_attribute_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::CatalogService::Rest::ServiceStub.stub :transcode_remove_catalog_attribute_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, remove_catalog_attribute_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::CatalogService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.remove_catalog_attribute({ attributes_config: attributes_config, key: key }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.remove_catalog_attribute attributes_config: attributes_config, key: key do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.remove_catalog_attribute ::Google::Cloud::Retail::V2::RemoveCatalogAttributeRequest.new(attributes_config: attributes_config, key: key) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.remove_catalog_attribute({ attributes_config: attributes_config, key: key }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.remove_catalog_attribute(::Google::Cloud::Retail::V2::RemoveCatalogAttributeRequest.new(attributes_config: attributes_config, key: key), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, remove_catalog_attribute_client_stub.call_count - end - end - end - - def test_replace_catalog_attribute - # Create test objects. - client_result = ::Google::Cloud::Retail::V2::AttributesConfig.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - attributes_config = "hello world" - catalog_attribute = {} - update_mask = {} - - replace_catalog_attribute_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::CatalogService::Rest::ServiceStub.stub :transcode_replace_catalog_attribute_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, replace_catalog_attribute_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::CatalogService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.replace_catalog_attribute({ attributes_config: attributes_config, catalog_attribute: catalog_attribute, update_mask: update_mask }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.replace_catalog_attribute attributes_config: attributes_config, catalog_attribute: catalog_attribute, update_mask: update_mask do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.replace_catalog_attribute ::Google::Cloud::Retail::V2::ReplaceCatalogAttributeRequest.new(attributes_config: attributes_config, catalog_attribute: catalog_attribute, update_mask: update_mask) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.replace_catalog_attribute({ attributes_config: attributes_config, catalog_attribute: catalog_attribute, update_mask: update_mask }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.replace_catalog_attribute(::Google::Cloud::Retail::V2::ReplaceCatalogAttributeRequest.new(attributes_config: attributes_config, catalog_attribute: catalog_attribute, update_mask: update_mask), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, replace_catalog_attribute_client_stub.call_count - end - end - end - - def test_configure - credentials_token = :dummy_value - - client = block_config = config = nil - dummy_stub = ClientStub.new nil - Gapic::Rest::ClientStub.stub :new, dummy_stub do - client = ::Google::Cloud::Retail::V2::CatalogService::Rest::Client.new do |config| - config.credentials = credentials_token - end - end - - config = client.configure do |c| - block_config = c - end - - assert_same block_config, config - assert_kind_of ::Google::Cloud::Retail::V2::CatalogService::Rest::Client::Configuration, config - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/catalog_service_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/catalog_service_test.rb deleted file mode 100644 index 78d3255c5df3..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/catalog_service_test.rb +++ /dev/null @@ -1,771 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "helper" - -require "gapic/grpc/service_stub" - -require "google/cloud/retail/v2/catalog_service_pb" -require "google/cloud/retail/v2/catalog_service" - -class ::Google::Cloud::Retail::V2::CatalogService::ClientTest < Minitest::Test - class ClientStub - attr_accessor :call_rpc_count, :requests - - def initialize response, operation, &block - @response = response - @operation = operation - @block = block - @call_rpc_count = 0 - @requests = [] - end - - def call_rpc *args, **kwargs - @call_rpc_count += 1 - - @requests << @block&.call(*args, **kwargs) - - catch :response do - yield @response, @operation if block_given? - @response - end - end - - def endpoint - "endpoint.example.com" - end - - def universe_domain - "example.com" - end - - def stub_logger - nil - end - - def logger - nil - end - end - - def test_list_catalogs - # Create GRPC objects. - grpc_response = ::Google::Cloud::Retail::V2::ListCatalogsResponse.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - page_size = 42 - page_token = "hello world" - - list_catalogs_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :list_catalogs, name - assert_kind_of ::Google::Cloud::Retail::V2::ListCatalogsRequest, request - assert_equal "hello world", request["parent"] - assert_equal 42, request["page_size"] - assert_equal "hello world", request["page_token"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, list_catalogs_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::CatalogService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.list_catalogs({ parent: parent, page_size: page_size, page_token: page_token }) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.list_catalogs parent: parent, page_size: page_size, page_token: page_token do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.list_catalogs ::Google::Cloud::Retail::V2::ListCatalogsRequest.new(parent: parent, page_size: page_size, page_token: page_token) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.list_catalogs({ parent: parent, page_size: page_size, page_token: page_token }, grpc_options) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.list_catalogs(::Google::Cloud::Retail::V2::ListCatalogsRequest.new(parent: parent, page_size: page_size, page_token: page_token), grpc_options) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, list_catalogs_client_stub.call_rpc_count - end - end - - def test_update_catalog - # Create GRPC objects. - grpc_response = ::Google::Cloud::Retail::V2::Catalog.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - catalog = {} - update_mask = {} - - update_catalog_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :update_catalog, name - assert_kind_of ::Google::Cloud::Retail::V2::UpdateCatalogRequest, request - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::Catalog), request["catalog"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::FieldMask), request["update_mask"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, update_catalog_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::CatalogService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.update_catalog({ catalog: catalog, update_mask: update_mask }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.update_catalog catalog: catalog, update_mask: update_mask do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.update_catalog ::Google::Cloud::Retail::V2::UpdateCatalogRequest.new(catalog: catalog, update_mask: update_mask) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.update_catalog({ catalog: catalog, update_mask: update_mask }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.update_catalog(::Google::Cloud::Retail::V2::UpdateCatalogRequest.new(catalog: catalog, update_mask: update_mask), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, update_catalog_client_stub.call_rpc_count - end - end - - def test_set_default_branch - # Create GRPC objects. - grpc_response = ::Google::Protobuf::Empty.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - catalog = "hello world" - branch_id = "hello world" - note = "hello world" - force = true - - set_default_branch_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :set_default_branch, name - assert_kind_of ::Google::Cloud::Retail::V2::SetDefaultBranchRequest, request - assert_equal "hello world", request["catalog"] - assert_equal "hello world", request["branch_id"] - assert_equal "hello world", request["note"] - assert_equal true, request["force"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, set_default_branch_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::CatalogService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.set_default_branch({ catalog: catalog, branch_id: branch_id, note: note, force: force }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.set_default_branch catalog: catalog, branch_id: branch_id, note: note, force: force do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.set_default_branch ::Google::Cloud::Retail::V2::SetDefaultBranchRequest.new(catalog: catalog, branch_id: branch_id, note: note, force: force) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.set_default_branch({ catalog: catalog, branch_id: branch_id, note: note, force: force }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.set_default_branch(::Google::Cloud::Retail::V2::SetDefaultBranchRequest.new(catalog: catalog, branch_id: branch_id, note: note, force: force), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, set_default_branch_client_stub.call_rpc_count - end - end - - def test_get_default_branch - # Create GRPC objects. - grpc_response = ::Google::Cloud::Retail::V2::GetDefaultBranchResponse.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - catalog = "hello world" - - get_default_branch_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :get_default_branch, name - assert_kind_of ::Google::Cloud::Retail::V2::GetDefaultBranchRequest, request - assert_equal "hello world", request["catalog"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, get_default_branch_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::CatalogService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.get_default_branch({ catalog: catalog }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.get_default_branch catalog: catalog do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.get_default_branch ::Google::Cloud::Retail::V2::GetDefaultBranchRequest.new(catalog: catalog) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.get_default_branch({ catalog: catalog }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.get_default_branch(::Google::Cloud::Retail::V2::GetDefaultBranchRequest.new(catalog: catalog), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, get_default_branch_client_stub.call_rpc_count - end - end - - def test_get_completion_config - # Create GRPC objects. - grpc_response = ::Google::Cloud::Retail::V2::CompletionConfig.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - get_completion_config_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :get_completion_config, name - assert_kind_of ::Google::Cloud::Retail::V2::GetCompletionConfigRequest, request - assert_equal "hello world", request["name"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, get_completion_config_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::CatalogService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.get_completion_config({ name: name }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.get_completion_config name: name do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.get_completion_config ::Google::Cloud::Retail::V2::GetCompletionConfigRequest.new(name: name) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.get_completion_config({ name: name }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.get_completion_config(::Google::Cloud::Retail::V2::GetCompletionConfigRequest.new(name: name), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, get_completion_config_client_stub.call_rpc_count - end - end - - def test_update_completion_config - # Create GRPC objects. - grpc_response = ::Google::Cloud::Retail::V2::CompletionConfig.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - completion_config = {} - update_mask = {} - - update_completion_config_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :update_completion_config, name - assert_kind_of ::Google::Cloud::Retail::V2::UpdateCompletionConfigRequest, request - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::CompletionConfig), request["completion_config"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::FieldMask), request["update_mask"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, update_completion_config_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::CatalogService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.update_completion_config({ completion_config: completion_config, update_mask: update_mask }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.update_completion_config completion_config: completion_config, update_mask: update_mask do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.update_completion_config ::Google::Cloud::Retail::V2::UpdateCompletionConfigRequest.new(completion_config: completion_config, update_mask: update_mask) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.update_completion_config({ completion_config: completion_config, update_mask: update_mask }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.update_completion_config(::Google::Cloud::Retail::V2::UpdateCompletionConfigRequest.new(completion_config: completion_config, update_mask: update_mask), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, update_completion_config_client_stub.call_rpc_count - end - end - - def test_get_attributes_config - # Create GRPC objects. - grpc_response = ::Google::Cloud::Retail::V2::AttributesConfig.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - get_attributes_config_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :get_attributes_config, name - assert_kind_of ::Google::Cloud::Retail::V2::GetAttributesConfigRequest, request - assert_equal "hello world", request["name"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, get_attributes_config_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::CatalogService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.get_attributes_config({ name: name }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.get_attributes_config name: name do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.get_attributes_config ::Google::Cloud::Retail::V2::GetAttributesConfigRequest.new(name: name) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.get_attributes_config({ name: name }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.get_attributes_config(::Google::Cloud::Retail::V2::GetAttributesConfigRequest.new(name: name), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, get_attributes_config_client_stub.call_rpc_count - end - end - - def test_update_attributes_config - # Create GRPC objects. - grpc_response = ::Google::Cloud::Retail::V2::AttributesConfig.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - attributes_config = {} - update_mask = {} - - update_attributes_config_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :update_attributes_config, name - assert_kind_of ::Google::Cloud::Retail::V2::UpdateAttributesConfigRequest, request - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::AttributesConfig), request["attributes_config"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::FieldMask), request["update_mask"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, update_attributes_config_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::CatalogService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.update_attributes_config({ attributes_config: attributes_config, update_mask: update_mask }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.update_attributes_config attributes_config: attributes_config, update_mask: update_mask do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.update_attributes_config ::Google::Cloud::Retail::V2::UpdateAttributesConfigRequest.new(attributes_config: attributes_config, update_mask: update_mask) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.update_attributes_config({ attributes_config: attributes_config, update_mask: update_mask }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.update_attributes_config(::Google::Cloud::Retail::V2::UpdateAttributesConfigRequest.new(attributes_config: attributes_config, update_mask: update_mask), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, update_attributes_config_client_stub.call_rpc_count - end - end - - def test_add_catalog_attribute - # Create GRPC objects. - grpc_response = ::Google::Cloud::Retail::V2::AttributesConfig.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - attributes_config = "hello world" - catalog_attribute = {} - - add_catalog_attribute_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :add_catalog_attribute, name - assert_kind_of ::Google::Cloud::Retail::V2::AddCatalogAttributeRequest, request - assert_equal "hello world", request["attributes_config"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::CatalogAttribute), request["catalog_attribute"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, add_catalog_attribute_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::CatalogService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.add_catalog_attribute({ attributes_config: attributes_config, catalog_attribute: catalog_attribute }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.add_catalog_attribute attributes_config: attributes_config, catalog_attribute: catalog_attribute do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.add_catalog_attribute ::Google::Cloud::Retail::V2::AddCatalogAttributeRequest.new(attributes_config: attributes_config, catalog_attribute: catalog_attribute) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.add_catalog_attribute({ attributes_config: attributes_config, catalog_attribute: catalog_attribute }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.add_catalog_attribute(::Google::Cloud::Retail::V2::AddCatalogAttributeRequest.new(attributes_config: attributes_config, catalog_attribute: catalog_attribute), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, add_catalog_attribute_client_stub.call_rpc_count - end - end - - def test_remove_catalog_attribute - # Create GRPC objects. - grpc_response = ::Google::Cloud::Retail::V2::AttributesConfig.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - attributes_config = "hello world" - key = "hello world" - - remove_catalog_attribute_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :remove_catalog_attribute, name - assert_kind_of ::Google::Cloud::Retail::V2::RemoveCatalogAttributeRequest, request - assert_equal "hello world", request["attributes_config"] - assert_equal "hello world", request["key"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, remove_catalog_attribute_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::CatalogService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.remove_catalog_attribute({ attributes_config: attributes_config, key: key }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.remove_catalog_attribute attributes_config: attributes_config, key: key do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.remove_catalog_attribute ::Google::Cloud::Retail::V2::RemoveCatalogAttributeRequest.new(attributes_config: attributes_config, key: key) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.remove_catalog_attribute({ attributes_config: attributes_config, key: key }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.remove_catalog_attribute(::Google::Cloud::Retail::V2::RemoveCatalogAttributeRequest.new(attributes_config: attributes_config, key: key), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, remove_catalog_attribute_client_stub.call_rpc_count - end - end - - def test_replace_catalog_attribute - # Create GRPC objects. - grpc_response = ::Google::Cloud::Retail::V2::AttributesConfig.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - attributes_config = "hello world" - catalog_attribute = {} - update_mask = {} - - replace_catalog_attribute_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :replace_catalog_attribute, name - assert_kind_of ::Google::Cloud::Retail::V2::ReplaceCatalogAttributeRequest, request - assert_equal "hello world", request["attributes_config"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::CatalogAttribute), request["catalog_attribute"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::FieldMask), request["update_mask"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, replace_catalog_attribute_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::CatalogService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.replace_catalog_attribute({ attributes_config: attributes_config, catalog_attribute: catalog_attribute, update_mask: update_mask }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.replace_catalog_attribute attributes_config: attributes_config, catalog_attribute: catalog_attribute, update_mask: update_mask do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.replace_catalog_attribute ::Google::Cloud::Retail::V2::ReplaceCatalogAttributeRequest.new(attributes_config: attributes_config, catalog_attribute: catalog_attribute, update_mask: update_mask) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.replace_catalog_attribute({ attributes_config: attributes_config, catalog_attribute: catalog_attribute, update_mask: update_mask }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.replace_catalog_attribute(::Google::Cloud::Retail::V2::ReplaceCatalogAttributeRequest.new(attributes_config: attributes_config, catalog_attribute: catalog_attribute, update_mask: update_mask), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, replace_catalog_attribute_client_stub.call_rpc_count - end - end - - def test_configure - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - - client = block_config = config = nil - dummy_stub = ClientStub.new nil, nil - Gapic::ServiceStub.stub :new, dummy_stub do - client = ::Google::Cloud::Retail::V2::CatalogService::Client.new do |config| - config.credentials = grpc_channel - end - end - - config = client.configure do |c| - block_config = c - end - - assert_same block_config, config - assert_kind_of ::Google::Cloud::Retail::V2::CatalogService::Client::Configuration, config - end - - def test_credentials - key = OpenSSL::PKey::RSA.new 2048 - cred_json = { - "private_key" => key.to_pem, - "client_email" => "app@developer.gserviceaccount.com", - "type" => "service_account" - } - key_file = StringIO.new cred_json.to_json - creds = Google::Auth::ServiceAccountCredentials.make_creds({ json_key_io: key_file }) - - dummy_stub = ClientStub.new nil, nil - Gapic::ServiceStub.stub :new, dummy_stub do - client = ::Google::Cloud::Retail::V2::CatalogService::Client.new do |config| - config.credentials = creds - end - assert_kind_of ::Google::Cloud::Retail::V2::CatalogService::Client, client - assert_equal creds, client.configure.credentials - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/completion_service_operations_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/completion_service_operations_test.rb deleted file mode 100644 index 1fc78ca333ed..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/completion_service_operations_test.rb +++ /dev/null @@ -1,400 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "helper" - -require "gapic/grpc/service_stub" - -require "google/cloud/retail/v2/completion_service_pb" -require "google/cloud/retail/v2/completion_service_services_pb" -require "google/cloud/retail/v2/completion_service" - -class ::Google::Cloud::Retail::V2::CompletionService::OperationsTest < Minitest::Test - class ClientStub - attr_accessor :call_rpc_count, :requests - - def initialize response, operation, &block - @response = response - @operation = operation - @block = block - @call_rpc_count = 0 - @requests = [] - end - - def call_rpc *args, **kwargs - @call_rpc_count += 1 - - @requests << @block&.call(*args, **kwargs) - - catch :response do - yield @response, @operation if block_given? - @response - end - end - - def endpoint - "endpoint.example.com" - end - - def universe_domain - "example.com" - end - - def stub_logger - nil - end - - def logger - nil - end - end - - def test_list_operations - # Create GRPC objects. - grpc_response = ::Google::Longrunning::ListOperationsResponse.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - filter = "hello world" - page_size = 42 - page_token = "hello world" - return_partial_success = true - - list_operations_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :list_operations, name - assert_kind_of ::Google::Longrunning::ListOperationsRequest, request - assert_equal "hello world", request["name"] - assert_equal "hello world", request["filter"] - assert_equal 42, request["page_size"] - assert_equal "hello world", request["page_token"] - assert_equal true, request["return_partial_success"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, list_operations_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::CompletionService::Operations.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.list_operations({ name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success }) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.list_operations name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.list_operations ::Google::Longrunning::ListOperationsRequest.new(name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.list_operations({ name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success }, grpc_options) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.list_operations(::Google::Longrunning::ListOperationsRequest.new(name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success), grpc_options) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, list_operations_client_stub.call_rpc_count - end - end - - def test_get_operation - # Create GRPC objects. - grpc_response = ::Google::Longrunning::Operation.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - get_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :get_operation, name - assert_kind_of ::Google::Longrunning::GetOperationRequest, request - assert_equal "hello world", request["name"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, get_operation_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::CompletionService::Operations.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.get_operation({ name: name }) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use named arguments - c.get_operation name: name do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.get_operation ::Google::Longrunning::GetOperationRequest.new(name: name) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.get_operation({ name: name }, grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.get_operation(::Google::Longrunning::GetOperationRequest.new(name: name), grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, get_operation_client_stub.call_rpc_count - end - end - - def test_delete_operation - # Create GRPC objects. - grpc_response = ::Google::Protobuf::Empty.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - delete_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :delete_operation, name - assert_kind_of ::Google::Longrunning::DeleteOperationRequest, request - assert_equal "hello world", request["name"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, delete_operation_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::CompletionService::Operations.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.delete_operation({ name: name }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.delete_operation name: name do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.delete_operation ::Google::Longrunning::DeleteOperationRequest.new(name: name) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.delete_operation({ name: name }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.delete_operation(::Google::Longrunning::DeleteOperationRequest.new(name: name), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, delete_operation_client_stub.call_rpc_count - end - end - - def test_cancel_operation - # Create GRPC objects. - grpc_response = ::Google::Protobuf::Empty.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - cancel_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :cancel_operation, name - assert_kind_of ::Google::Longrunning::CancelOperationRequest, request - assert_equal "hello world", request["name"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, cancel_operation_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::CompletionService::Operations.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.cancel_operation({ name: name }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.cancel_operation name: name do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.cancel_operation ::Google::Longrunning::CancelOperationRequest.new(name: name) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.cancel_operation({ name: name }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.cancel_operation(::Google::Longrunning::CancelOperationRequest.new(name: name), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, cancel_operation_client_stub.call_rpc_count - end - end - - def test_wait_operation - # Create GRPC objects. - grpc_response = ::Google::Longrunning::Operation.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - timeout = {} - - wait_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :wait_operation, name - assert_kind_of ::Google::Longrunning::WaitOperationRequest, request - assert_equal "hello world", request["name"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::Duration), request["timeout"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, wait_operation_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::CompletionService::Operations.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.wait_operation({ name: name, timeout: timeout }) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use named arguments - c.wait_operation name: name, timeout: timeout do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.wait_operation ::Google::Longrunning::WaitOperationRequest.new(name: name, timeout: timeout) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.wait_operation({ name: name, timeout: timeout }, grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.wait_operation(::Google::Longrunning::WaitOperationRequest.new(name: name, timeout: timeout), grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, wait_operation_client_stub.call_rpc_count - end - end - - def test_configure - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - - client = block_config = config = nil - dummy_stub = ClientStub.new nil, nil - Gapic::ServiceStub.stub :new, dummy_stub do - client = ::Google::Cloud::Retail::V2::CompletionService::Operations.new do |config| - config.credentials = grpc_channel - end - end - - config = client.configure do |c| - block_config = c - end - - assert_same block_config, config - assert_kind_of ::Google::Cloud::Retail::V2::CompletionService::Operations::Configuration, config - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/completion_service_paths_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/completion_service_paths_test.rb deleted file mode 100644 index 1fdf7e2de46a..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/completion_service_paths_test.rb +++ /dev/null @@ -1,55 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "helper" - -require "gapic/grpc/service_stub" - -require "google/cloud/retail/v2/completion_service" - -class ::Google::Cloud::Retail::V2::CompletionService::ClientPathsTest < Minitest::Test - class DummyStub - def endpoint - "endpoint.example.com" - end - - def universe_domain - "example.com" - end - - def stub_logger - nil - end - - def logger - nil - end - end - - def test_catalog_path - grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - ::Gapic::ServiceStub.stub :new, DummyStub.new do - client = ::Google::Cloud::Retail::V2::CompletionService::Client.new do |config| - config.credentials = grpc_channel - end - - path = client.catalog_path project: "value0", location: "value1", catalog: "value2" - assert_equal "projects/value0/locations/value1/catalogs/value2", path - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/completion_service_rest_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/completion_service_rest_test.rb deleted file mode 100644 index 2e1ef337e812..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/completion_service_rest_test.rb +++ /dev/null @@ -1,217 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "helper" -require "gapic/rest" -require "google/cloud/retail/v2/completion_service_pb" -require "google/cloud/retail/v2/completion_service/rest" - - -class ::Google::Cloud::Retail::V2::CompletionService::Rest::ClientTest < Minitest::Test - class ClientStub - attr_accessor :call_count, :requests - - def initialize response, &block - @response = response - @block = block - @call_count = 0 - @requests = [] - end - - def make_get_request uri:, params: {}, options: {}, method_name: nil - make_http_request :get, uri: uri, body: nil, params: params, options: options, method_name: method_name - end - - def make_delete_request uri:, params: {}, options: {}, method_name: nil - make_http_request :delete, uri: uri, body: nil, params: params, options: options, method_name: method_name - end - - def make_post_request uri:, body: nil, params: {}, options: {}, method_name: nil - make_http_request :post, uri: uri, body: body, params: params, options: options, method_name: method_name - end - - def make_patch_request uri:, body:, params: {}, options: {}, method_name: nil - make_http_request :patch, uri: uri, body: body, params: params, options: options, method_name: method_name - end - - def make_put_request uri:, body:, params: {}, options: {}, method_name: nil - make_http_request :put, uri: uri, body: body, params: params, options: options, method_name: method_name - end - - def make_http_request *args, **kwargs - @call_count += 1 - - @requests << @block&.call(*args, **kwargs) - - @response - end - - def endpoint - "endpoint.example.com" - end - - def universe_domain - "example.com" - end - - def stub_logger - nil - end - - def logger - nil - end - end - - def test_complete_query - # Create test objects. - client_result = ::Google::Cloud::Retail::V2::CompleteQueryResponse.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - catalog = "hello world" - query = "hello world" - visitor_id = "hello world" - language_codes = ["hello world"] - device_type = "hello world" - dataset = "hello world" - max_suggestions = 42 - enable_attribute_suggestions = true - entity = "hello world" - - complete_query_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::CompletionService::Rest::ServiceStub.stub :transcode_complete_query_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, complete_query_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::CompletionService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.complete_query({ catalog: catalog, query: query, visitor_id: visitor_id, language_codes: language_codes, device_type: device_type, dataset: dataset, max_suggestions: max_suggestions, enable_attribute_suggestions: enable_attribute_suggestions, entity: entity }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.complete_query catalog: catalog, query: query, visitor_id: visitor_id, language_codes: language_codes, device_type: device_type, dataset: dataset, max_suggestions: max_suggestions, enable_attribute_suggestions: enable_attribute_suggestions, entity: entity do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.complete_query ::Google::Cloud::Retail::V2::CompleteQueryRequest.new(catalog: catalog, query: query, visitor_id: visitor_id, language_codes: language_codes, device_type: device_type, dataset: dataset, max_suggestions: max_suggestions, enable_attribute_suggestions: enable_attribute_suggestions, entity: entity) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.complete_query({ catalog: catalog, query: query, visitor_id: visitor_id, language_codes: language_codes, device_type: device_type, dataset: dataset, max_suggestions: max_suggestions, enable_attribute_suggestions: enable_attribute_suggestions, entity: entity }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.complete_query(::Google::Cloud::Retail::V2::CompleteQueryRequest.new(catalog: catalog, query: query, visitor_id: visitor_id, language_codes: language_codes, device_type: device_type, dataset: dataset, max_suggestions: max_suggestions, enable_attribute_suggestions: enable_attribute_suggestions, entity: entity), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, complete_query_client_stub.call_count - end - end - end - - def test_import_completion_data - # Create test objects. - client_result = ::Google::Longrunning::Operation.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - input_config = {} - notification_pubsub_topic = "hello world" - - import_completion_data_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::CompletionService::Rest::ServiceStub.stub :transcode_import_completion_data_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, import_completion_data_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::CompletionService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.import_completion_data({ parent: parent, input_config: input_config, notification_pubsub_topic: notification_pubsub_topic }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.import_completion_data parent: parent, input_config: input_config, notification_pubsub_topic: notification_pubsub_topic do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.import_completion_data ::Google::Cloud::Retail::V2::ImportCompletionDataRequest.new(parent: parent, input_config: input_config, notification_pubsub_topic: notification_pubsub_topic) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.import_completion_data({ parent: parent, input_config: input_config, notification_pubsub_topic: notification_pubsub_topic }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.import_completion_data(::Google::Cloud::Retail::V2::ImportCompletionDataRequest.new(parent: parent, input_config: input_config, notification_pubsub_topic: notification_pubsub_topic), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, import_completion_data_client_stub.call_count - end - end - end - - def test_configure - credentials_token = :dummy_value - - client = block_config = config = nil - dummy_stub = ClientStub.new nil - Gapic::Rest::ClientStub.stub :new, dummy_stub do - client = ::Google::Cloud::Retail::V2::CompletionService::Rest::Client.new do |config| - config.credentials = credentials_token - end - end - - config = client.configure do |c| - block_config = c - end - - assert_same block_config, config - assert_kind_of ::Google::Cloud::Retail::V2::CompletionService::Rest::Client::Configuration, config - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/completion_service_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/completion_service_test.rb deleted file mode 100644 index cfa7fce3193e..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/completion_service_test.rb +++ /dev/null @@ -1,259 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "helper" - -require "gapic/grpc/service_stub" - -require "google/cloud/retail/v2/completion_service_pb" -require "google/cloud/retail/v2/completion_service" - -class ::Google::Cloud::Retail::V2::CompletionService::ClientTest < Minitest::Test - class ClientStub - attr_accessor :call_rpc_count, :requests - - def initialize response, operation, &block - @response = response - @operation = operation - @block = block - @call_rpc_count = 0 - @requests = [] - end - - def call_rpc *args, **kwargs - @call_rpc_count += 1 - - @requests << @block&.call(*args, **kwargs) - - catch :response do - yield @response, @operation if block_given? - @response - end - end - - def endpoint - "endpoint.example.com" - end - - def universe_domain - "example.com" - end - - def stub_logger - nil - end - - def logger - nil - end - end - - def test_complete_query - # Create GRPC objects. - grpc_response = ::Google::Cloud::Retail::V2::CompleteQueryResponse.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - catalog = "hello world" - query = "hello world" - visitor_id = "hello world" - language_codes = ["hello world"] - device_type = "hello world" - dataset = "hello world" - max_suggestions = 42 - enable_attribute_suggestions = true - entity = "hello world" - - complete_query_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :complete_query, name - assert_kind_of ::Google::Cloud::Retail::V2::CompleteQueryRequest, request - assert_equal "hello world", request["catalog"] - assert_equal "hello world", request["query"] - assert_equal "hello world", request["visitor_id"] - assert_equal ["hello world"], request["language_codes"] - assert_equal "hello world", request["device_type"] - assert_equal "hello world", request["dataset"] - assert_equal 42, request["max_suggestions"] - assert_equal true, request["enable_attribute_suggestions"] - assert_equal "hello world", request["entity"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, complete_query_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::CompletionService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.complete_query({ catalog: catalog, query: query, visitor_id: visitor_id, language_codes: language_codes, device_type: device_type, dataset: dataset, max_suggestions: max_suggestions, enable_attribute_suggestions: enable_attribute_suggestions, entity: entity }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.complete_query catalog: catalog, query: query, visitor_id: visitor_id, language_codes: language_codes, device_type: device_type, dataset: dataset, max_suggestions: max_suggestions, enable_attribute_suggestions: enable_attribute_suggestions, entity: entity do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.complete_query ::Google::Cloud::Retail::V2::CompleteQueryRequest.new(catalog: catalog, query: query, visitor_id: visitor_id, language_codes: language_codes, device_type: device_type, dataset: dataset, max_suggestions: max_suggestions, enable_attribute_suggestions: enable_attribute_suggestions, entity: entity) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.complete_query({ catalog: catalog, query: query, visitor_id: visitor_id, language_codes: language_codes, device_type: device_type, dataset: dataset, max_suggestions: max_suggestions, enable_attribute_suggestions: enable_attribute_suggestions, entity: entity }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.complete_query(::Google::Cloud::Retail::V2::CompleteQueryRequest.new(catalog: catalog, query: query, visitor_id: visitor_id, language_codes: language_codes, device_type: device_type, dataset: dataset, max_suggestions: max_suggestions, enable_attribute_suggestions: enable_attribute_suggestions, entity: entity), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, complete_query_client_stub.call_rpc_count - end - end - - def test_import_completion_data - # Create GRPC objects. - grpc_response = ::Google::Longrunning::Operation.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - input_config = {} - notification_pubsub_topic = "hello world" - - import_completion_data_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :import_completion_data, name - assert_kind_of ::Google::Cloud::Retail::V2::ImportCompletionDataRequest, request - assert_equal "hello world", request["parent"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::CompletionDataInputConfig), request["input_config"] - assert_equal "hello world", request["notification_pubsub_topic"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, import_completion_data_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::CompletionService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.import_completion_data({ parent: parent, input_config: input_config, notification_pubsub_topic: notification_pubsub_topic }) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use named arguments - c.import_completion_data parent: parent, input_config: input_config, notification_pubsub_topic: notification_pubsub_topic do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.import_completion_data ::Google::Cloud::Retail::V2::ImportCompletionDataRequest.new(parent: parent, input_config: input_config, notification_pubsub_topic: notification_pubsub_topic) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.import_completion_data({ parent: parent, input_config: input_config, notification_pubsub_topic: notification_pubsub_topic }, grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.import_completion_data(::Google::Cloud::Retail::V2::ImportCompletionDataRequest.new(parent: parent, input_config: input_config, notification_pubsub_topic: notification_pubsub_topic), grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, import_completion_data_client_stub.call_rpc_count - end - end - - def test_configure - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - - client = block_config = config = nil - dummy_stub = ClientStub.new nil, nil - Gapic::ServiceStub.stub :new, dummy_stub do - client = ::Google::Cloud::Retail::V2::CompletionService::Client.new do |config| - config.credentials = grpc_channel - end - end - - config = client.configure do |c| - block_config = c - end - - assert_same block_config, config - assert_kind_of ::Google::Cloud::Retail::V2::CompletionService::Client::Configuration, config - end - - def test_credentials - key = OpenSSL::PKey::RSA.new 2048 - cred_json = { - "private_key" => key.to_pem, - "client_email" => "app@developer.gserviceaccount.com", - "type" => "service_account" - } - key_file = StringIO.new cred_json.to_json - creds = Google::Auth::ServiceAccountCredentials.make_creds({ json_key_io: key_file }) - - dummy_stub = ClientStub.new nil, nil - Gapic::ServiceStub.stub :new, dummy_stub do - client = ::Google::Cloud::Retail::V2::CompletionService::Client.new do |config| - config.credentials = creds - end - assert_kind_of ::Google::Cloud::Retail::V2::CompletionService::Client, client - assert_equal creds, client.configure.credentials - end - end - - def test_operations_client - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - - client = nil - dummy_stub = ClientStub.new nil, nil - Gapic::ServiceStub.stub :new, dummy_stub do - client = ::Google::Cloud::Retail::V2::CompletionService::Client.new do |config| - config.credentials = grpc_channel - end - end - - assert_kind_of ::Google::Cloud::Retail::V2::CompletionService::Operations, client.operations_client - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/control_service_paths_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/control_service_paths_test.rb deleted file mode 100644 index 3a2ba3c8bc0f..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/control_service_paths_test.rb +++ /dev/null @@ -1,67 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "helper" - -require "gapic/grpc/service_stub" - -require "google/cloud/retail/v2/control_service" - -class ::Google::Cloud::Retail::V2::ControlService::ClientPathsTest < Minitest::Test - class DummyStub - def endpoint - "endpoint.example.com" - end - - def universe_domain - "example.com" - end - - def stub_logger - nil - end - - def logger - nil - end - end - - def test_catalog_path - grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - ::Gapic::ServiceStub.stub :new, DummyStub.new do - client = ::Google::Cloud::Retail::V2::ControlService::Client.new do |config| - config.credentials = grpc_channel - end - - path = client.catalog_path project: "value0", location: "value1", catalog: "value2" - assert_equal "projects/value0/locations/value1/catalogs/value2", path - end - end - - def test_control_path - grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - ::Gapic::ServiceStub.stub :new, DummyStub.new do - client = ::Google::Cloud::Retail::V2::ControlService::Client.new do |config| - config.credentials = grpc_channel - end - - path = client.control_path project: "value0", location: "value1", catalog: "value2", control: "value3" - assert_equal "projects/value0/locations/value1/catalogs/value2/controls/value3", path - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/control_service_rest_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/control_service_rest_test.rb deleted file mode 100644 index a01a2054149f..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/control_service_rest_test.rb +++ /dev/null @@ -1,375 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "helper" -require "gapic/rest" -require "google/cloud/retail/v2/control_service_pb" -require "google/cloud/retail/v2/control_service/rest" - - -class ::Google::Cloud::Retail::V2::ControlService::Rest::ClientTest < Minitest::Test - class ClientStub - attr_accessor :call_count, :requests - - def initialize response, &block - @response = response - @block = block - @call_count = 0 - @requests = [] - end - - def make_get_request uri:, params: {}, options: {}, method_name: nil - make_http_request :get, uri: uri, body: nil, params: params, options: options, method_name: method_name - end - - def make_delete_request uri:, params: {}, options: {}, method_name: nil - make_http_request :delete, uri: uri, body: nil, params: params, options: options, method_name: method_name - end - - def make_post_request uri:, body: nil, params: {}, options: {}, method_name: nil - make_http_request :post, uri: uri, body: body, params: params, options: options, method_name: method_name - end - - def make_patch_request uri:, body:, params: {}, options: {}, method_name: nil - make_http_request :patch, uri: uri, body: body, params: params, options: options, method_name: method_name - end - - def make_put_request uri:, body:, params: {}, options: {}, method_name: nil - make_http_request :put, uri: uri, body: body, params: params, options: options, method_name: method_name - end - - def make_http_request *args, **kwargs - @call_count += 1 - - @requests << @block&.call(*args, **kwargs) - - @response - end - - def endpoint - "endpoint.example.com" - end - - def universe_domain - "example.com" - end - - def stub_logger - nil - end - - def logger - nil - end - end - - def test_create_control - # Create test objects. - client_result = ::Google::Cloud::Retail::V2::Control.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - control = {} - control_id = "hello world" - - create_control_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::ControlService::Rest::ServiceStub.stub :transcode_create_control_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, create_control_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ControlService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.create_control({ parent: parent, control: control, control_id: control_id }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.create_control parent: parent, control: control, control_id: control_id do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.create_control ::Google::Cloud::Retail::V2::CreateControlRequest.new(parent: parent, control: control, control_id: control_id) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.create_control({ parent: parent, control: control, control_id: control_id }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.create_control(::Google::Cloud::Retail::V2::CreateControlRequest.new(parent: parent, control: control, control_id: control_id), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, create_control_client_stub.call_count - end - end - end - - def test_delete_control - # Create test objects. - client_result = ::Google::Protobuf::Empty.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - delete_control_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::ControlService::Rest::ServiceStub.stub :transcode_delete_control_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, delete_control_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ControlService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.delete_control({ name: name }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.delete_control name: name do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.delete_control ::Google::Cloud::Retail::V2::DeleteControlRequest.new(name: name) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.delete_control({ name: name }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.delete_control(::Google::Cloud::Retail::V2::DeleteControlRequest.new(name: name), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, delete_control_client_stub.call_count - end - end - end - - def test_update_control - # Create test objects. - client_result = ::Google::Cloud::Retail::V2::Control.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - control = {} - update_mask = {} - - update_control_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::ControlService::Rest::ServiceStub.stub :transcode_update_control_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, update_control_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ControlService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.update_control({ control: control, update_mask: update_mask }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.update_control control: control, update_mask: update_mask do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.update_control ::Google::Cloud::Retail::V2::UpdateControlRequest.new(control: control, update_mask: update_mask) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.update_control({ control: control, update_mask: update_mask }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.update_control(::Google::Cloud::Retail::V2::UpdateControlRequest.new(control: control, update_mask: update_mask), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, update_control_client_stub.call_count - end - end - end - - def test_get_control - # Create test objects. - client_result = ::Google::Cloud::Retail::V2::Control.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - get_control_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::ControlService::Rest::ServiceStub.stub :transcode_get_control_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, get_control_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ControlService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.get_control({ name: name }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.get_control name: name do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.get_control ::Google::Cloud::Retail::V2::GetControlRequest.new(name: name) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.get_control({ name: name }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.get_control(::Google::Cloud::Retail::V2::GetControlRequest.new(name: name), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, get_control_client_stub.call_count - end - end - end - - def test_list_controls - # Create test objects. - client_result = ::Google::Cloud::Retail::V2::ListControlsResponse.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - page_size = 42 - page_token = "hello world" - filter = "hello world" - - list_controls_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::ControlService::Rest::ServiceStub.stub :transcode_list_controls_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, list_controls_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ControlService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.list_controls({ parent: parent, page_size: page_size, page_token: page_token, filter: filter }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.list_controls parent: parent, page_size: page_size, page_token: page_token, filter: filter do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.list_controls ::Google::Cloud::Retail::V2::ListControlsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.list_controls({ parent: parent, page_size: page_size, page_token: page_token, filter: filter }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.list_controls(::Google::Cloud::Retail::V2::ListControlsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, list_controls_client_stub.call_count - end - end - end - - def test_configure - credentials_token = :dummy_value - - client = block_config = config = nil - dummy_stub = ClientStub.new nil - Gapic::Rest::ClientStub.stub :new, dummy_stub do - client = ::Google::Cloud::Retail::V2::ControlService::Rest::Client.new do |config| - config.credentials = credentials_token - end - end - - config = client.configure do |c| - block_config = c - end - - assert_same block_config, config - assert_kind_of ::Google::Cloud::Retail::V2::ControlService::Rest::Client::Configuration, config - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/control_service_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/control_service_test.rb deleted file mode 100644 index 91528d0ca0f7..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/control_service_test.rb +++ /dev/null @@ -1,411 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "helper" - -require "gapic/grpc/service_stub" - -require "google/cloud/retail/v2/control_service_pb" -require "google/cloud/retail/v2/control_service" - -class ::Google::Cloud::Retail::V2::ControlService::ClientTest < Minitest::Test - class ClientStub - attr_accessor :call_rpc_count, :requests - - def initialize response, operation, &block - @response = response - @operation = operation - @block = block - @call_rpc_count = 0 - @requests = [] - end - - def call_rpc *args, **kwargs - @call_rpc_count += 1 - - @requests << @block&.call(*args, **kwargs) - - catch :response do - yield @response, @operation if block_given? - @response - end - end - - def endpoint - "endpoint.example.com" - end - - def universe_domain - "example.com" - end - - def stub_logger - nil - end - - def logger - nil - end - end - - def test_create_control - # Create GRPC objects. - grpc_response = ::Google::Cloud::Retail::V2::Control.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - control = {} - control_id = "hello world" - - create_control_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :create_control, name - assert_kind_of ::Google::Cloud::Retail::V2::CreateControlRequest, request - assert_equal "hello world", request["parent"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::Control), request["control"] - assert_equal "hello world", request["control_id"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, create_control_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ControlService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.create_control({ parent: parent, control: control, control_id: control_id }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.create_control parent: parent, control: control, control_id: control_id do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.create_control ::Google::Cloud::Retail::V2::CreateControlRequest.new(parent: parent, control: control, control_id: control_id) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.create_control({ parent: parent, control: control, control_id: control_id }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.create_control(::Google::Cloud::Retail::V2::CreateControlRequest.new(parent: parent, control: control, control_id: control_id), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, create_control_client_stub.call_rpc_count - end - end - - def test_delete_control - # Create GRPC objects. - grpc_response = ::Google::Protobuf::Empty.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - delete_control_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :delete_control, name - assert_kind_of ::Google::Cloud::Retail::V2::DeleteControlRequest, request - assert_equal "hello world", request["name"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, delete_control_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ControlService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.delete_control({ name: name }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.delete_control name: name do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.delete_control ::Google::Cloud::Retail::V2::DeleteControlRequest.new(name: name) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.delete_control({ name: name }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.delete_control(::Google::Cloud::Retail::V2::DeleteControlRequest.new(name: name), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, delete_control_client_stub.call_rpc_count - end - end - - def test_update_control - # Create GRPC objects. - grpc_response = ::Google::Cloud::Retail::V2::Control.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - control = {} - update_mask = {} - - update_control_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :update_control, name - assert_kind_of ::Google::Cloud::Retail::V2::UpdateControlRequest, request - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::Control), request["control"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::FieldMask), request["update_mask"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, update_control_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ControlService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.update_control({ control: control, update_mask: update_mask }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.update_control control: control, update_mask: update_mask do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.update_control ::Google::Cloud::Retail::V2::UpdateControlRequest.new(control: control, update_mask: update_mask) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.update_control({ control: control, update_mask: update_mask }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.update_control(::Google::Cloud::Retail::V2::UpdateControlRequest.new(control: control, update_mask: update_mask), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, update_control_client_stub.call_rpc_count - end - end - - def test_get_control - # Create GRPC objects. - grpc_response = ::Google::Cloud::Retail::V2::Control.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - get_control_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :get_control, name - assert_kind_of ::Google::Cloud::Retail::V2::GetControlRequest, request - assert_equal "hello world", request["name"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, get_control_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ControlService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.get_control({ name: name }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.get_control name: name do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.get_control ::Google::Cloud::Retail::V2::GetControlRequest.new(name: name) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.get_control({ name: name }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.get_control(::Google::Cloud::Retail::V2::GetControlRequest.new(name: name), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, get_control_client_stub.call_rpc_count - end - end - - def test_list_controls - # Create GRPC objects. - grpc_response = ::Google::Cloud::Retail::V2::ListControlsResponse.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - page_size = 42 - page_token = "hello world" - filter = "hello world" - - list_controls_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :list_controls, name - assert_kind_of ::Google::Cloud::Retail::V2::ListControlsRequest, request - assert_equal "hello world", request["parent"] - assert_equal 42, request["page_size"] - assert_equal "hello world", request["page_token"] - assert_equal "hello world", request["filter"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, list_controls_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ControlService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.list_controls({ parent: parent, page_size: page_size, page_token: page_token, filter: filter }) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.list_controls parent: parent, page_size: page_size, page_token: page_token, filter: filter do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.list_controls ::Google::Cloud::Retail::V2::ListControlsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.list_controls({ parent: parent, page_size: page_size, page_token: page_token, filter: filter }, grpc_options) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.list_controls(::Google::Cloud::Retail::V2::ListControlsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter), grpc_options) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, list_controls_client_stub.call_rpc_count - end - end - - def test_configure - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - - client = block_config = config = nil - dummy_stub = ClientStub.new nil, nil - Gapic::ServiceStub.stub :new, dummy_stub do - client = ::Google::Cloud::Retail::V2::ControlService::Client.new do |config| - config.credentials = grpc_channel - end - end - - config = client.configure do |c| - block_config = c - end - - assert_same block_config, config - assert_kind_of ::Google::Cloud::Retail::V2::ControlService::Client::Configuration, config - end - - def test_credentials - key = OpenSSL::PKey::RSA.new 2048 - cred_json = { - "private_key" => key.to_pem, - "client_email" => "app@developer.gserviceaccount.com", - "type" => "service_account" - } - key_file = StringIO.new cred_json.to_json - creds = Google::Auth::ServiceAccountCredentials.make_creds({ json_key_io: key_file }) - - dummy_stub = ClientStub.new nil, nil - Gapic::ServiceStub.stub :new, dummy_stub do - client = ::Google::Cloud::Retail::V2::ControlService::Client.new do |config| - config.credentials = creds - end - assert_kind_of ::Google::Cloud::Retail::V2::ControlService::Client, client - assert_equal creds, client.configure.credentials - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/conversational_search_service_paths_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/conversational_search_service_paths_test.rb deleted file mode 100644 index fdef51260f2e..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/conversational_search_service_paths_test.rb +++ /dev/null @@ -1,55 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "helper" - -require "gapic/grpc/service_stub" - -require "google/cloud/retail/v2/conversational_search_service" - -class ::Google::Cloud::Retail::V2::ConversationalSearchService::ClientPathsTest < Minitest::Test - class DummyStub - def endpoint - "endpoint.example.com" - end - - def universe_domain - "example.com" - end - - def stub_logger - nil - end - - def logger - nil - end - end - - def test_branch_path - grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - ::Gapic::ServiceStub.stub :new, DummyStub.new do - client = ::Google::Cloud::Retail::V2::ConversationalSearchService::Client.new do |config| - config.credentials = grpc_channel - end - - path = client.branch_path project: "value0", location: "value1", catalog: "value2", branch: "value3" - assert_equal "projects/value0/locations/value1/catalogs/value2/branches/value3", path - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/conversational_search_service_rest_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/conversational_search_service_rest_test.rb deleted file mode 100644 index 6c3b9d2307b8..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/conversational_search_service_rest_test.rb +++ /dev/null @@ -1,163 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "helper" -require "gapic/rest" -require "google/cloud/retail/v2/conversational_search_service_pb" -require "google/cloud/retail/v2/conversational_search_service/rest" - - -class ::Google::Cloud::Retail::V2::ConversationalSearchService::Rest::ClientTest < Minitest::Test - class ClientStub - attr_accessor :call_count, :requests - - def initialize response, &block - @response = response - @block = block - @call_count = 0 - @requests = [] - end - - def make_get_request uri:, params: {}, options: {}, method_name: nil - make_http_request :get, uri: uri, body: nil, params: params, options: options, method_name: method_name - end - - def make_delete_request uri:, params: {}, options: {}, method_name: nil - make_http_request :delete, uri: uri, body: nil, params: params, options: options, method_name: method_name - end - - def make_post_request uri:, body: nil, params: {}, options: {}, method_name: nil - make_http_request :post, uri: uri, body: body, params: params, options: options, method_name: method_name - end - - def make_patch_request uri:, body:, params: {}, options: {}, method_name: nil - make_http_request :patch, uri: uri, body: body, params: params, options: options, method_name: method_name - end - - def make_put_request uri:, body:, params: {}, options: {}, method_name: nil - make_http_request :put, uri: uri, body: body, params: params, options: options, method_name: method_name - end - - def make_http_request *args, **kwargs - @call_count += 1 - - @requests << @block&.call(*args, **kwargs) - - @response - end - - def endpoint - "endpoint.example.com" - end - - def universe_domain - "example.com" - end - - def stub_logger - nil - end - - def logger - nil - end - end - - def test_conversational_search - # Create test objects. - client_result = ::Google::Cloud::Retail::V2::ConversationalSearchResponse.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - placement = "hello world" - branch = "hello world" - query = "hello world" - page_categories = ["hello world"] - conversation_id = "hello world" - search_params = {} - visitor_id = "hello world" - user_info = {} - conversational_filtering_spec = {} - user_labels = {} - safety_settings = [{}] - - conversational_search_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, is_server_streaming:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::ConversationalSearchService::Rest::ServiceStub.stub :transcode_conversational_search_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, conversational_search_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ConversationalSearchService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.conversational_search({ placement: placement, branch: branch, query: query, page_categories: page_categories, conversation_id: conversation_id, search_params: search_params, visitor_id: visitor_id, user_info: user_info, conversational_filtering_spec: conversational_filtering_spec, user_labels: user_labels, safety_settings: safety_settings }) do |_result, response| - assert_equal http_response, response.underlying_op - end.first - - # Use named arguments - c.conversational_search placement: placement, branch: branch, query: query, page_categories: page_categories, conversation_id: conversation_id, search_params: search_params, visitor_id: visitor_id, user_info: user_info, conversational_filtering_spec: conversational_filtering_spec, user_labels: user_labels, safety_settings: safety_settings do |_result, response| - assert_equal http_response, response.underlying_op - end.first - - # Use protobuf object - c.conversational_search ::Google::Cloud::Retail::V2::ConversationalSearchRequest.new(placement: placement, branch: branch, query: query, page_categories: page_categories, conversation_id: conversation_id, search_params: search_params, visitor_id: visitor_id, user_info: user_info, conversational_filtering_spec: conversational_filtering_spec, user_labels: user_labels, safety_settings: safety_settings) do |_result, response| - assert_equal http_response, response.underlying_op - end.first - - # Use hash object with options - c.conversational_search({ placement: placement, branch: branch, query: query, page_categories: page_categories, conversation_id: conversation_id, search_params: search_params, visitor_id: visitor_id, user_info: user_info, conversational_filtering_spec: conversational_filtering_spec, user_labels: user_labels, safety_settings: safety_settings }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end.first - - # Use protobuf object with options - c.conversational_search(::Google::Cloud::Retail::V2::ConversationalSearchRequest.new(placement: placement, branch: branch, query: query, page_categories: page_categories, conversation_id: conversation_id, search_params: search_params, visitor_id: visitor_id, user_info: user_info, conversational_filtering_spec: conversational_filtering_spec, user_labels: user_labels, safety_settings: safety_settings), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end.first - - # Verify method calls - assert_equal 5, conversational_search_client_stub.call_count - end - end - end - - def test_configure - credentials_token = :dummy_value - - client = block_config = config = nil - dummy_stub = ClientStub.new nil - Gapic::Rest::ClientStub.stub :new, dummy_stub do - client = ::Google::Cloud::Retail::V2::ConversationalSearchService::Rest::Client.new do |config| - config.credentials = credentials_token - end - end - - config = client.configure do |c| - block_config = c - end - - assert_same block_config, config - assert_kind_of ::Google::Cloud::Retail::V2::ConversationalSearchService::Rest::Client::Configuration, config - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/conversational_search_service_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/conversational_search_service_test.rb deleted file mode 100644 index 01a7bfd250d9..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/conversational_search_service_test.rb +++ /dev/null @@ -1,197 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "helper" - -require "gapic/grpc/service_stub" - -require "google/cloud/retail/v2/conversational_search_service_pb" -require "google/cloud/retail/v2/conversational_search_service" - -class ::Google::Cloud::Retail::V2::ConversationalSearchService::ClientTest < Minitest::Test - class ClientStub - attr_accessor :call_rpc_count, :requests - - def initialize response, operation, &block - @response = response - @operation = operation - @block = block - @call_rpc_count = 0 - @requests = [] - end - - def call_rpc *args, **kwargs - @call_rpc_count += 1 - - @requests << @block&.call(*args, **kwargs) - - catch :response do - yield @response, @operation if block_given? - @response - end - end - - def endpoint - "endpoint.example.com" - end - - def universe_domain - "example.com" - end - - def stub_logger - nil - end - - def logger - nil - end - end - - def test_conversational_search - # Create GRPC objects. - grpc_response = ::Google::Cloud::Retail::V2::ConversationalSearchResponse.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a server streaming method. - placement = "hello world" - branch = "hello world" - query = "hello world" - page_categories = ["hello world"] - conversation_id = "hello world" - search_params = {} - visitor_id = "hello world" - user_info = {} - conversational_filtering_spec = {} - user_labels = {} - safety_settings = [{}] - - conversational_search_client_stub = ClientStub.new [grpc_response].to_enum, grpc_operation do |name, request, options:| - assert_equal :conversational_search, name - assert_kind_of ::Google::Cloud::Retail::V2::ConversationalSearchRequest, request - assert_equal "hello world", request["placement"] - assert_equal "hello world", request["branch"] - assert_equal "hello world", request["query"] - assert_equal ["hello world"], request["page_categories"] - assert_equal "hello world", request["conversation_id"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::ConversationalSearchRequest::SearchParams), request["search_params"] - assert_equal "hello world", request["visitor_id"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::UserInfo), request["user_info"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::ConversationalSearchRequest::ConversationalFilteringSpec), request["conversational_filtering_spec"] - assert_equal({}, request["user_labels"].to_h) - assert_kind_of ::Google::Cloud::Retail::V2::SafetySetting, request["safety_settings"].first - refute_nil options - end - - Gapic::ServiceStub.stub :new, conversational_search_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ConversationalSearchService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.conversational_search({ placement: placement, branch: branch, query: query, page_categories: page_categories, conversation_id: conversation_id, search_params: search_params, visitor_id: visitor_id, user_info: user_info, conversational_filtering_spec: conversational_filtering_spec, user_labels: user_labels, safety_settings: safety_settings }) do |response, operation| - assert_kind_of Enumerable, response - response.to_a.each do |r| - assert_kind_of ::Google::Cloud::Retail::V2::ConversationalSearchResponse, r - end - assert_equal grpc_operation, operation - end - - # Use named arguments - c.conversational_search placement: placement, branch: branch, query: query, page_categories: page_categories, conversation_id: conversation_id, search_params: search_params, visitor_id: visitor_id, user_info: user_info, conversational_filtering_spec: conversational_filtering_spec, user_labels: user_labels, safety_settings: safety_settings do |response, operation| - assert_kind_of Enumerable, response - response.to_a.each do |r| - assert_kind_of ::Google::Cloud::Retail::V2::ConversationalSearchResponse, r - end - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.conversational_search ::Google::Cloud::Retail::V2::ConversationalSearchRequest.new(placement: placement, branch: branch, query: query, page_categories: page_categories, conversation_id: conversation_id, search_params: search_params, visitor_id: visitor_id, user_info: user_info, conversational_filtering_spec: conversational_filtering_spec, user_labels: user_labels, safety_settings: safety_settings) do |response, operation| - assert_kind_of Enumerable, response - response.to_a.each do |r| - assert_kind_of ::Google::Cloud::Retail::V2::ConversationalSearchResponse, r - end - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.conversational_search({ placement: placement, branch: branch, query: query, page_categories: page_categories, conversation_id: conversation_id, search_params: search_params, visitor_id: visitor_id, user_info: user_info, conversational_filtering_spec: conversational_filtering_spec, user_labels: user_labels, safety_settings: safety_settings }, grpc_options) do |response, operation| - assert_kind_of Enumerable, response - response.to_a.each do |r| - assert_kind_of ::Google::Cloud::Retail::V2::ConversationalSearchResponse, r - end - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.conversational_search(::Google::Cloud::Retail::V2::ConversationalSearchRequest.new(placement: placement, branch: branch, query: query, page_categories: page_categories, conversation_id: conversation_id, search_params: search_params, visitor_id: visitor_id, user_info: user_info, conversational_filtering_spec: conversational_filtering_spec, user_labels: user_labels, safety_settings: safety_settings), grpc_options) do |response, operation| - assert_kind_of Enumerable, response - response.to_a.each do |r| - assert_kind_of ::Google::Cloud::Retail::V2::ConversationalSearchResponse, r - end - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, conversational_search_client_stub.call_rpc_count - end - end - - def test_configure - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - - client = block_config = config = nil - dummy_stub = ClientStub.new nil, nil - Gapic::ServiceStub.stub :new, dummy_stub do - client = ::Google::Cloud::Retail::V2::ConversationalSearchService::Client.new do |config| - config.credentials = grpc_channel - end - end - - config = client.configure do |c| - block_config = c - end - - assert_same block_config, config - assert_kind_of ::Google::Cloud::Retail::V2::ConversationalSearchService::Client::Configuration, config - end - - def test_credentials - key = OpenSSL::PKey::RSA.new 2048 - cred_json = { - "private_key" => key.to_pem, - "client_email" => "app@developer.gserviceaccount.com", - "type" => "service_account" - } - key_file = StringIO.new cred_json.to_json - creds = Google::Auth::ServiceAccountCredentials.make_creds({ json_key_io: key_file }) - - dummy_stub = ClientStub.new nil, nil - Gapic::ServiceStub.stub :new, dummy_stub do - client = ::Google::Cloud::Retail::V2::ConversationalSearchService::Client.new do |config| - config.credentials = creds - end - assert_kind_of ::Google::Cloud::Retail::V2::ConversationalSearchService::Client, client - assert_equal creds, client.configure.credentials - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/generative_question_service_paths_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/generative_question_service_paths_test.rb deleted file mode 100644 index 453c3660b939..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/generative_question_service_paths_test.rb +++ /dev/null @@ -1,55 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "helper" - -require "gapic/grpc/service_stub" - -require "google/cloud/retail/v2/generative_question_service" - -class ::Google::Cloud::Retail::V2::GenerativeQuestionService::ClientPathsTest < Minitest::Test - class DummyStub - def endpoint - "endpoint.example.com" - end - - def universe_domain - "example.com" - end - - def stub_logger - nil - end - - def logger - nil - end - end - - def test_catalog_path - grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - ::Gapic::ServiceStub.stub :new, DummyStub.new do - client = ::Google::Cloud::Retail::V2::GenerativeQuestionService::Client.new do |config| - config.credentials = grpc_channel - end - - path = client.catalog_path project: "value0", location: "value1", catalog: "value2" - assert_equal "projects/value0/locations/value1/catalogs/value2", path - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/generative_question_service_rest_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/generative_question_service_rest_test.rb deleted file mode 100644 index 6fd27afd1cd0..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/generative_question_service_rest_test.rb +++ /dev/null @@ -1,372 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "helper" -require "gapic/rest" -require "google/cloud/retail/v2/generative_question_service_pb" -require "google/cloud/retail/v2/generative_question_service/rest" - - -class ::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::ClientTest < Minitest::Test - class ClientStub - attr_accessor :call_count, :requests - - def initialize response, &block - @response = response - @block = block - @call_count = 0 - @requests = [] - end - - def make_get_request uri:, params: {}, options: {}, method_name: nil - make_http_request :get, uri: uri, body: nil, params: params, options: options, method_name: method_name - end - - def make_delete_request uri:, params: {}, options: {}, method_name: nil - make_http_request :delete, uri: uri, body: nil, params: params, options: options, method_name: method_name - end - - def make_post_request uri:, body: nil, params: {}, options: {}, method_name: nil - make_http_request :post, uri: uri, body: body, params: params, options: options, method_name: method_name - end - - def make_patch_request uri:, body:, params: {}, options: {}, method_name: nil - make_http_request :patch, uri: uri, body: body, params: params, options: options, method_name: method_name - end - - def make_put_request uri:, body:, params: {}, options: {}, method_name: nil - make_http_request :put, uri: uri, body: body, params: params, options: options, method_name: method_name - end - - def make_http_request *args, **kwargs - @call_count += 1 - - @requests << @block&.call(*args, **kwargs) - - @response - end - - def endpoint - "endpoint.example.com" - end - - def universe_domain - "example.com" - end - - def stub_logger - nil - end - - def logger - nil - end - end - - def test_update_generative_questions_feature_config - # Create test objects. - client_result = ::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - generative_questions_feature_config = {} - update_mask = {} - - update_generative_questions_feature_config_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::ServiceStub.stub :transcode_update_generative_questions_feature_config_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, update_generative_questions_feature_config_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.update_generative_questions_feature_config({ generative_questions_feature_config: generative_questions_feature_config, update_mask: update_mask }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.update_generative_questions_feature_config generative_questions_feature_config: generative_questions_feature_config, update_mask: update_mask do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.update_generative_questions_feature_config ::Google::Cloud::Retail::V2::UpdateGenerativeQuestionsFeatureConfigRequest.new(generative_questions_feature_config: generative_questions_feature_config, update_mask: update_mask) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.update_generative_questions_feature_config({ generative_questions_feature_config: generative_questions_feature_config, update_mask: update_mask }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.update_generative_questions_feature_config(::Google::Cloud::Retail::V2::UpdateGenerativeQuestionsFeatureConfigRequest.new(generative_questions_feature_config: generative_questions_feature_config, update_mask: update_mask), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, update_generative_questions_feature_config_client_stub.call_count - end - end - end - - def test_get_generative_questions_feature_config - # Create test objects. - client_result = ::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - catalog = "hello world" - - get_generative_questions_feature_config_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::ServiceStub.stub :transcode_get_generative_questions_feature_config_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, get_generative_questions_feature_config_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.get_generative_questions_feature_config({ catalog: catalog }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.get_generative_questions_feature_config catalog: catalog do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.get_generative_questions_feature_config ::Google::Cloud::Retail::V2::GetGenerativeQuestionsFeatureConfigRequest.new(catalog: catalog) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.get_generative_questions_feature_config({ catalog: catalog }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.get_generative_questions_feature_config(::Google::Cloud::Retail::V2::GetGenerativeQuestionsFeatureConfigRequest.new(catalog: catalog), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, get_generative_questions_feature_config_client_stub.call_count - end - end - end - - def test_list_generative_question_configs - # Create test objects. - client_result = ::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsResponse.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - - list_generative_question_configs_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::ServiceStub.stub :transcode_list_generative_question_configs_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, list_generative_question_configs_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.list_generative_question_configs({ parent: parent }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.list_generative_question_configs parent: parent do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.list_generative_question_configs ::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsRequest.new(parent: parent) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.list_generative_question_configs({ parent: parent }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.list_generative_question_configs(::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsRequest.new(parent: parent), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, list_generative_question_configs_client_stub.call_count - end - end - end - - def test_update_generative_question_config - # Create test objects. - client_result = ::Google::Cloud::Retail::V2::GenerativeQuestionConfig.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - generative_question_config = {} - update_mask = {} - - update_generative_question_config_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::ServiceStub.stub :transcode_update_generative_question_config_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, update_generative_question_config_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.update_generative_question_config({ generative_question_config: generative_question_config, update_mask: update_mask }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.update_generative_question_config generative_question_config: generative_question_config, update_mask: update_mask do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.update_generative_question_config ::Google::Cloud::Retail::V2::UpdateGenerativeQuestionConfigRequest.new(generative_question_config: generative_question_config, update_mask: update_mask) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.update_generative_question_config({ generative_question_config: generative_question_config, update_mask: update_mask }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.update_generative_question_config(::Google::Cloud::Retail::V2::UpdateGenerativeQuestionConfigRequest.new(generative_question_config: generative_question_config, update_mask: update_mask), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, update_generative_question_config_client_stub.call_count - end - end - end - - def test_batch_update_generative_question_configs - # Create test objects. - client_result = ::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsResponse.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - requests = [{}] - - batch_update_generative_question_configs_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::ServiceStub.stub :transcode_batch_update_generative_question_configs_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, batch_update_generative_question_configs_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.batch_update_generative_question_configs({ parent: parent, requests: requests }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.batch_update_generative_question_configs parent: parent, requests: requests do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.batch_update_generative_question_configs ::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsRequest.new(parent: parent, requests: requests) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.batch_update_generative_question_configs({ parent: parent, requests: requests }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.batch_update_generative_question_configs(::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsRequest.new(parent: parent, requests: requests), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, batch_update_generative_question_configs_client_stub.call_count - end - end - end - - def test_configure - credentials_token = :dummy_value - - client = block_config = config = nil - dummy_stub = ClientStub.new nil - Gapic::Rest::ClientStub.stub :new, dummy_stub do - client = ::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client.new do |config| - config.credentials = credentials_token - end - end - - config = client.configure do |c| - block_config = c - end - - assert_same block_config, config - assert_kind_of ::Google::Cloud::Retail::V2::GenerativeQuestionService::Rest::Client::Configuration, config - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/generative_question_service_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/generative_question_service_test.rb deleted file mode 100644 index 402c20df7db6..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/generative_question_service_test.rb +++ /dev/null @@ -1,400 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "helper" - -require "gapic/grpc/service_stub" - -require "google/cloud/retail/v2/generative_question_service_pb" -require "google/cloud/retail/v2/generative_question_service" - -class ::Google::Cloud::Retail::V2::GenerativeQuestionService::ClientTest < Minitest::Test - class ClientStub - attr_accessor :call_rpc_count, :requests - - def initialize response, operation, &block - @response = response - @operation = operation - @block = block - @call_rpc_count = 0 - @requests = [] - end - - def call_rpc *args, **kwargs - @call_rpc_count += 1 - - @requests << @block&.call(*args, **kwargs) - - catch :response do - yield @response, @operation if block_given? - @response - end - end - - def endpoint - "endpoint.example.com" - end - - def universe_domain - "example.com" - end - - def stub_logger - nil - end - - def logger - nil - end - end - - def test_update_generative_questions_feature_config - # Create GRPC objects. - grpc_response = ::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - generative_questions_feature_config = {} - update_mask = {} - - update_generative_questions_feature_config_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :update_generative_questions_feature_config, name - assert_kind_of ::Google::Cloud::Retail::V2::UpdateGenerativeQuestionsFeatureConfigRequest, request - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig), request["generative_questions_feature_config"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::FieldMask), request["update_mask"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, update_generative_questions_feature_config_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::GenerativeQuestionService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.update_generative_questions_feature_config({ generative_questions_feature_config: generative_questions_feature_config, update_mask: update_mask }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.update_generative_questions_feature_config generative_questions_feature_config: generative_questions_feature_config, update_mask: update_mask do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.update_generative_questions_feature_config ::Google::Cloud::Retail::V2::UpdateGenerativeQuestionsFeatureConfigRequest.new(generative_questions_feature_config: generative_questions_feature_config, update_mask: update_mask) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.update_generative_questions_feature_config({ generative_questions_feature_config: generative_questions_feature_config, update_mask: update_mask }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.update_generative_questions_feature_config(::Google::Cloud::Retail::V2::UpdateGenerativeQuestionsFeatureConfigRequest.new(generative_questions_feature_config: generative_questions_feature_config, update_mask: update_mask), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, update_generative_questions_feature_config_client_stub.call_rpc_count - end - end - - def test_get_generative_questions_feature_config - # Create GRPC objects. - grpc_response = ::Google::Cloud::Retail::V2::GenerativeQuestionsFeatureConfig.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - catalog = "hello world" - - get_generative_questions_feature_config_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :get_generative_questions_feature_config, name - assert_kind_of ::Google::Cloud::Retail::V2::GetGenerativeQuestionsFeatureConfigRequest, request - assert_equal "hello world", request["catalog"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, get_generative_questions_feature_config_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::GenerativeQuestionService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.get_generative_questions_feature_config({ catalog: catalog }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.get_generative_questions_feature_config catalog: catalog do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.get_generative_questions_feature_config ::Google::Cloud::Retail::V2::GetGenerativeQuestionsFeatureConfigRequest.new(catalog: catalog) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.get_generative_questions_feature_config({ catalog: catalog }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.get_generative_questions_feature_config(::Google::Cloud::Retail::V2::GetGenerativeQuestionsFeatureConfigRequest.new(catalog: catalog), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, get_generative_questions_feature_config_client_stub.call_rpc_count - end - end - - def test_list_generative_question_configs - # Create GRPC objects. - grpc_response = ::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsResponse.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - - list_generative_question_configs_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :list_generative_question_configs, name - assert_kind_of ::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsRequest, request - assert_equal "hello world", request["parent"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, list_generative_question_configs_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::GenerativeQuestionService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.list_generative_question_configs({ parent: parent }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.list_generative_question_configs parent: parent do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.list_generative_question_configs ::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsRequest.new(parent: parent) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.list_generative_question_configs({ parent: parent }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.list_generative_question_configs(::Google::Cloud::Retail::V2::ListGenerativeQuestionConfigsRequest.new(parent: parent), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, list_generative_question_configs_client_stub.call_rpc_count - end - end - - def test_update_generative_question_config - # Create GRPC objects. - grpc_response = ::Google::Cloud::Retail::V2::GenerativeQuestionConfig.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - generative_question_config = {} - update_mask = {} - - update_generative_question_config_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :update_generative_question_config, name - assert_kind_of ::Google::Cloud::Retail::V2::UpdateGenerativeQuestionConfigRequest, request - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::GenerativeQuestionConfig), request["generative_question_config"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::FieldMask), request["update_mask"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, update_generative_question_config_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::GenerativeQuestionService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.update_generative_question_config({ generative_question_config: generative_question_config, update_mask: update_mask }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.update_generative_question_config generative_question_config: generative_question_config, update_mask: update_mask do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.update_generative_question_config ::Google::Cloud::Retail::V2::UpdateGenerativeQuestionConfigRequest.new(generative_question_config: generative_question_config, update_mask: update_mask) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.update_generative_question_config({ generative_question_config: generative_question_config, update_mask: update_mask }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.update_generative_question_config(::Google::Cloud::Retail::V2::UpdateGenerativeQuestionConfigRequest.new(generative_question_config: generative_question_config, update_mask: update_mask), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, update_generative_question_config_client_stub.call_rpc_count - end - end - - def test_batch_update_generative_question_configs - # Create GRPC objects. - grpc_response = ::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsResponse.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - requests = [{}] - - batch_update_generative_question_configs_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :batch_update_generative_question_configs, name - assert_kind_of ::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsRequest, request - assert_equal "hello world", request["parent"] - assert_kind_of ::Google::Cloud::Retail::V2::UpdateGenerativeQuestionConfigRequest, request["requests"].first - refute_nil options - end - - Gapic::ServiceStub.stub :new, batch_update_generative_question_configs_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::GenerativeQuestionService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.batch_update_generative_question_configs({ parent: parent, requests: requests }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.batch_update_generative_question_configs parent: parent, requests: requests do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.batch_update_generative_question_configs ::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsRequest.new(parent: parent, requests: requests) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.batch_update_generative_question_configs({ parent: parent, requests: requests }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.batch_update_generative_question_configs(::Google::Cloud::Retail::V2::BatchUpdateGenerativeQuestionConfigsRequest.new(parent: parent, requests: requests), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, batch_update_generative_question_configs_client_stub.call_rpc_count - end - end - - def test_configure - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - - client = block_config = config = nil - dummy_stub = ClientStub.new nil, nil - Gapic::ServiceStub.stub :new, dummy_stub do - client = ::Google::Cloud::Retail::V2::GenerativeQuestionService::Client.new do |config| - config.credentials = grpc_channel - end - end - - config = client.configure do |c| - block_config = c - end - - assert_same block_config, config - assert_kind_of ::Google::Cloud::Retail::V2::GenerativeQuestionService::Client::Configuration, config - end - - def test_credentials - key = OpenSSL::PKey::RSA.new 2048 - cred_json = { - "private_key" => key.to_pem, - "client_email" => "app@developer.gserviceaccount.com", - "type" => "service_account" - } - key_file = StringIO.new cred_json.to_json - creds = Google::Auth::ServiceAccountCredentials.make_creds({ json_key_io: key_file }) - - dummy_stub = ClientStub.new nil, nil - Gapic::ServiceStub.stub :new, dummy_stub do - client = ::Google::Cloud::Retail::V2::GenerativeQuestionService::Client.new do |config| - config.credentials = creds - end - assert_kind_of ::Google::Cloud::Retail::V2::GenerativeQuestionService::Client, client - assert_equal creds, client.configure.credentials - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/model_service_operations_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/model_service_operations_test.rb deleted file mode 100644 index a570cdc85e06..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/model_service_operations_test.rb +++ /dev/null @@ -1,400 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "helper" - -require "gapic/grpc/service_stub" - -require "google/cloud/retail/v2/model_service_pb" -require "google/cloud/retail/v2/model_service_services_pb" -require "google/cloud/retail/v2/model_service" - -class ::Google::Cloud::Retail::V2::ModelService::OperationsTest < Minitest::Test - class ClientStub - attr_accessor :call_rpc_count, :requests - - def initialize response, operation, &block - @response = response - @operation = operation - @block = block - @call_rpc_count = 0 - @requests = [] - end - - def call_rpc *args, **kwargs - @call_rpc_count += 1 - - @requests << @block&.call(*args, **kwargs) - - catch :response do - yield @response, @operation if block_given? - @response - end - end - - def endpoint - "endpoint.example.com" - end - - def universe_domain - "example.com" - end - - def stub_logger - nil - end - - def logger - nil - end - end - - def test_list_operations - # Create GRPC objects. - grpc_response = ::Google::Longrunning::ListOperationsResponse.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - filter = "hello world" - page_size = 42 - page_token = "hello world" - return_partial_success = true - - list_operations_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :list_operations, name - assert_kind_of ::Google::Longrunning::ListOperationsRequest, request - assert_equal "hello world", request["name"] - assert_equal "hello world", request["filter"] - assert_equal 42, request["page_size"] - assert_equal "hello world", request["page_token"] - assert_equal true, request["return_partial_success"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, list_operations_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ModelService::Operations.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.list_operations({ name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success }) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.list_operations name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.list_operations ::Google::Longrunning::ListOperationsRequest.new(name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.list_operations({ name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success }, grpc_options) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.list_operations(::Google::Longrunning::ListOperationsRequest.new(name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success), grpc_options) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, list_operations_client_stub.call_rpc_count - end - end - - def test_get_operation - # Create GRPC objects. - grpc_response = ::Google::Longrunning::Operation.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - get_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :get_operation, name - assert_kind_of ::Google::Longrunning::GetOperationRequest, request - assert_equal "hello world", request["name"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, get_operation_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ModelService::Operations.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.get_operation({ name: name }) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use named arguments - c.get_operation name: name do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.get_operation ::Google::Longrunning::GetOperationRequest.new(name: name) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.get_operation({ name: name }, grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.get_operation(::Google::Longrunning::GetOperationRequest.new(name: name), grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, get_operation_client_stub.call_rpc_count - end - end - - def test_delete_operation - # Create GRPC objects. - grpc_response = ::Google::Protobuf::Empty.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - delete_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :delete_operation, name - assert_kind_of ::Google::Longrunning::DeleteOperationRequest, request - assert_equal "hello world", request["name"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, delete_operation_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ModelService::Operations.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.delete_operation({ name: name }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.delete_operation name: name do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.delete_operation ::Google::Longrunning::DeleteOperationRequest.new(name: name) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.delete_operation({ name: name }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.delete_operation(::Google::Longrunning::DeleteOperationRequest.new(name: name), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, delete_operation_client_stub.call_rpc_count - end - end - - def test_cancel_operation - # Create GRPC objects. - grpc_response = ::Google::Protobuf::Empty.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - cancel_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :cancel_operation, name - assert_kind_of ::Google::Longrunning::CancelOperationRequest, request - assert_equal "hello world", request["name"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, cancel_operation_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ModelService::Operations.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.cancel_operation({ name: name }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.cancel_operation name: name do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.cancel_operation ::Google::Longrunning::CancelOperationRequest.new(name: name) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.cancel_operation({ name: name }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.cancel_operation(::Google::Longrunning::CancelOperationRequest.new(name: name), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, cancel_operation_client_stub.call_rpc_count - end - end - - def test_wait_operation - # Create GRPC objects. - grpc_response = ::Google::Longrunning::Operation.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - timeout = {} - - wait_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :wait_operation, name - assert_kind_of ::Google::Longrunning::WaitOperationRequest, request - assert_equal "hello world", request["name"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::Duration), request["timeout"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, wait_operation_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ModelService::Operations.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.wait_operation({ name: name, timeout: timeout }) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use named arguments - c.wait_operation name: name, timeout: timeout do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.wait_operation ::Google::Longrunning::WaitOperationRequest.new(name: name, timeout: timeout) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.wait_operation({ name: name, timeout: timeout }, grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.wait_operation(::Google::Longrunning::WaitOperationRequest.new(name: name, timeout: timeout), grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, wait_operation_client_stub.call_rpc_count - end - end - - def test_configure - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - - client = block_config = config = nil - dummy_stub = ClientStub.new nil, nil - Gapic::ServiceStub.stub :new, dummy_stub do - client = ::Google::Cloud::Retail::V2::ModelService::Operations.new do |config| - config.credentials = grpc_channel - end - end - - config = client.configure do |c| - block_config = c - end - - assert_same block_config, config - assert_kind_of ::Google::Cloud::Retail::V2::ModelService::Operations::Configuration, config - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/model_service_paths_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/model_service_paths_test.rb deleted file mode 100644 index f077beeed1ed..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/model_service_paths_test.rb +++ /dev/null @@ -1,67 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "helper" - -require "gapic/grpc/service_stub" - -require "google/cloud/retail/v2/model_service" - -class ::Google::Cloud::Retail::V2::ModelService::ClientPathsTest < Minitest::Test - class DummyStub - def endpoint - "endpoint.example.com" - end - - def universe_domain - "example.com" - end - - def stub_logger - nil - end - - def logger - nil - end - end - - def test_catalog_path - grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - ::Gapic::ServiceStub.stub :new, DummyStub.new do - client = ::Google::Cloud::Retail::V2::ModelService::Client.new do |config| - config.credentials = grpc_channel - end - - path = client.catalog_path project: "value0", location: "value1", catalog: "value2" - assert_equal "projects/value0/locations/value1/catalogs/value2", path - end - end - - def test_model_path - grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - ::Gapic::ServiceStub.stub :new, DummyStub.new do - client = ::Google::Cloud::Retail::V2::ModelService::Client.new do |config| - config.credentials = grpc_channel - end - - path = client.model_path project: "value0", location: "value1", catalog: "value2", model: "value3" - assert_equal "projects/value0/locations/value1/catalogs/value2/models/value3", path - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/model_service_rest_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/model_service_rest_test.rb deleted file mode 100644 index 05afd9235f1a..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/model_service_rest_test.rb +++ /dev/null @@ -1,536 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "helper" -require "gapic/rest" -require "google/cloud/retail/v2/model_service_pb" -require "google/cloud/retail/v2/model_service/rest" - - -class ::Google::Cloud::Retail::V2::ModelService::Rest::ClientTest < Minitest::Test - class ClientStub - attr_accessor :call_count, :requests - - def initialize response, &block - @response = response - @block = block - @call_count = 0 - @requests = [] - end - - def make_get_request uri:, params: {}, options: {}, method_name: nil - make_http_request :get, uri: uri, body: nil, params: params, options: options, method_name: method_name - end - - def make_delete_request uri:, params: {}, options: {}, method_name: nil - make_http_request :delete, uri: uri, body: nil, params: params, options: options, method_name: method_name - end - - def make_post_request uri:, body: nil, params: {}, options: {}, method_name: nil - make_http_request :post, uri: uri, body: body, params: params, options: options, method_name: method_name - end - - def make_patch_request uri:, body:, params: {}, options: {}, method_name: nil - make_http_request :patch, uri: uri, body: body, params: params, options: options, method_name: method_name - end - - def make_put_request uri:, body:, params: {}, options: {}, method_name: nil - make_http_request :put, uri: uri, body: body, params: params, options: options, method_name: method_name - end - - def make_http_request *args, **kwargs - @call_count += 1 - - @requests << @block&.call(*args, **kwargs) - - @response - end - - def endpoint - "endpoint.example.com" - end - - def universe_domain - "example.com" - end - - def stub_logger - nil - end - - def logger - nil - end - end - - def test_create_model - # Create test objects. - client_result = ::Google::Longrunning::Operation.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - model = {} - dry_run = true - - create_model_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::ModelService::Rest::ServiceStub.stub :transcode_create_model_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, create_model_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ModelService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.create_model({ parent: parent, model: model, dry_run: dry_run }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.create_model parent: parent, model: model, dry_run: dry_run do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.create_model ::Google::Cloud::Retail::V2::CreateModelRequest.new(parent: parent, model: model, dry_run: dry_run) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.create_model({ parent: parent, model: model, dry_run: dry_run }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.create_model(::Google::Cloud::Retail::V2::CreateModelRequest.new(parent: parent, model: model, dry_run: dry_run), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, create_model_client_stub.call_count - end - end - end - - def test_get_model - # Create test objects. - client_result = ::Google::Cloud::Retail::V2::Model.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - get_model_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::ModelService::Rest::ServiceStub.stub :transcode_get_model_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, get_model_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ModelService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.get_model({ name: name }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.get_model name: name do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.get_model ::Google::Cloud::Retail::V2::GetModelRequest.new(name: name) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.get_model({ name: name }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.get_model(::Google::Cloud::Retail::V2::GetModelRequest.new(name: name), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, get_model_client_stub.call_count - end - end - end - - def test_pause_model - # Create test objects. - client_result = ::Google::Cloud::Retail::V2::Model.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - pause_model_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::ModelService::Rest::ServiceStub.stub :transcode_pause_model_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, pause_model_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ModelService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.pause_model({ name: name }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.pause_model name: name do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.pause_model ::Google::Cloud::Retail::V2::PauseModelRequest.new(name: name) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.pause_model({ name: name }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.pause_model(::Google::Cloud::Retail::V2::PauseModelRequest.new(name: name), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, pause_model_client_stub.call_count - end - end - end - - def test_resume_model - # Create test objects. - client_result = ::Google::Cloud::Retail::V2::Model.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - resume_model_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::ModelService::Rest::ServiceStub.stub :transcode_resume_model_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, resume_model_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ModelService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.resume_model({ name: name }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.resume_model name: name do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.resume_model ::Google::Cloud::Retail::V2::ResumeModelRequest.new(name: name) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.resume_model({ name: name }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.resume_model(::Google::Cloud::Retail::V2::ResumeModelRequest.new(name: name), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, resume_model_client_stub.call_count - end - end - end - - def test_delete_model - # Create test objects. - client_result = ::Google::Protobuf::Empty.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - delete_model_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::ModelService::Rest::ServiceStub.stub :transcode_delete_model_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, delete_model_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ModelService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.delete_model({ name: name }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.delete_model name: name do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.delete_model ::Google::Cloud::Retail::V2::DeleteModelRequest.new(name: name) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.delete_model({ name: name }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.delete_model(::Google::Cloud::Retail::V2::DeleteModelRequest.new(name: name), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, delete_model_client_stub.call_count - end - end - end - - def test_list_models - # Create test objects. - client_result = ::Google::Cloud::Retail::V2::ListModelsResponse.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - page_size = 42 - page_token = "hello world" - - list_models_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::ModelService::Rest::ServiceStub.stub :transcode_list_models_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, list_models_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ModelService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.list_models({ parent: parent, page_size: page_size, page_token: page_token }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.list_models parent: parent, page_size: page_size, page_token: page_token do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.list_models ::Google::Cloud::Retail::V2::ListModelsRequest.new(parent: parent, page_size: page_size, page_token: page_token) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.list_models({ parent: parent, page_size: page_size, page_token: page_token }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.list_models(::Google::Cloud::Retail::V2::ListModelsRequest.new(parent: parent, page_size: page_size, page_token: page_token), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, list_models_client_stub.call_count - end - end - end - - def test_update_model - # Create test objects. - client_result = ::Google::Cloud::Retail::V2::Model.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - model = {} - update_mask = {} - - update_model_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::ModelService::Rest::ServiceStub.stub :transcode_update_model_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, update_model_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ModelService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.update_model({ model: model, update_mask: update_mask }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.update_model model: model, update_mask: update_mask do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.update_model ::Google::Cloud::Retail::V2::UpdateModelRequest.new(model: model, update_mask: update_mask) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.update_model({ model: model, update_mask: update_mask }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.update_model(::Google::Cloud::Retail::V2::UpdateModelRequest.new(model: model, update_mask: update_mask), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, update_model_client_stub.call_count - end - end - end - - def test_tune_model - # Create test objects. - client_result = ::Google::Longrunning::Operation.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - tune_model_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::ModelService::Rest::ServiceStub.stub :transcode_tune_model_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, tune_model_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ModelService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.tune_model({ name: name }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.tune_model name: name do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.tune_model ::Google::Cloud::Retail::V2::TuneModelRequest.new(name: name) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.tune_model({ name: name }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.tune_model(::Google::Cloud::Retail::V2::TuneModelRequest.new(name: name), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, tune_model_client_stub.call_count - end - end - end - - def test_configure - credentials_token = :dummy_value - - client = block_config = config = nil - dummy_stub = ClientStub.new nil - Gapic::Rest::ClientStub.stub :new, dummy_stub do - client = ::Google::Cloud::Retail::V2::ModelService::Rest::Client.new do |config| - config.credentials = credentials_token - end - end - - config = client.configure do |c| - block_config = c - end - - assert_same block_config, config - assert_kind_of ::Google::Cloud::Retail::V2::ModelService::Rest::Client::Configuration, config - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/model_service_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/model_service_test.rb deleted file mode 100644 index c512995eb660..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/model_service_test.rb +++ /dev/null @@ -1,607 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "helper" - -require "gapic/grpc/service_stub" - -require "google/cloud/retail/v2/model_service_pb" -require "google/cloud/retail/v2/model_service" - -class ::Google::Cloud::Retail::V2::ModelService::ClientTest < Minitest::Test - class ClientStub - attr_accessor :call_rpc_count, :requests - - def initialize response, operation, &block - @response = response - @operation = operation - @block = block - @call_rpc_count = 0 - @requests = [] - end - - def call_rpc *args, **kwargs - @call_rpc_count += 1 - - @requests << @block&.call(*args, **kwargs) - - catch :response do - yield @response, @operation if block_given? - @response - end - end - - def endpoint - "endpoint.example.com" - end - - def universe_domain - "example.com" - end - - def stub_logger - nil - end - - def logger - nil - end - end - - def test_create_model - # Create GRPC objects. - grpc_response = ::Google::Longrunning::Operation.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - model = {} - dry_run = true - - create_model_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :create_model, name - assert_kind_of ::Google::Cloud::Retail::V2::CreateModelRequest, request - assert_equal "hello world", request["parent"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::Model), request["model"] - assert_equal true, request["dry_run"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, create_model_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ModelService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.create_model({ parent: parent, model: model, dry_run: dry_run }) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use named arguments - c.create_model parent: parent, model: model, dry_run: dry_run do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.create_model ::Google::Cloud::Retail::V2::CreateModelRequest.new(parent: parent, model: model, dry_run: dry_run) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.create_model({ parent: parent, model: model, dry_run: dry_run }, grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.create_model(::Google::Cloud::Retail::V2::CreateModelRequest.new(parent: parent, model: model, dry_run: dry_run), grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, create_model_client_stub.call_rpc_count - end - end - - def test_get_model - # Create GRPC objects. - grpc_response = ::Google::Cloud::Retail::V2::Model.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - get_model_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :get_model, name - assert_kind_of ::Google::Cloud::Retail::V2::GetModelRequest, request - assert_equal "hello world", request["name"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, get_model_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ModelService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.get_model({ name: name }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.get_model name: name do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.get_model ::Google::Cloud::Retail::V2::GetModelRequest.new(name: name) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.get_model({ name: name }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.get_model(::Google::Cloud::Retail::V2::GetModelRequest.new(name: name), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, get_model_client_stub.call_rpc_count - end - end - - def test_pause_model - # Create GRPC objects. - grpc_response = ::Google::Cloud::Retail::V2::Model.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - pause_model_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :pause_model, name - assert_kind_of ::Google::Cloud::Retail::V2::PauseModelRequest, request - assert_equal "hello world", request["name"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, pause_model_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ModelService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.pause_model({ name: name }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.pause_model name: name do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.pause_model ::Google::Cloud::Retail::V2::PauseModelRequest.new(name: name) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.pause_model({ name: name }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.pause_model(::Google::Cloud::Retail::V2::PauseModelRequest.new(name: name), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, pause_model_client_stub.call_rpc_count - end - end - - def test_resume_model - # Create GRPC objects. - grpc_response = ::Google::Cloud::Retail::V2::Model.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - resume_model_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :resume_model, name - assert_kind_of ::Google::Cloud::Retail::V2::ResumeModelRequest, request - assert_equal "hello world", request["name"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, resume_model_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ModelService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.resume_model({ name: name }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.resume_model name: name do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.resume_model ::Google::Cloud::Retail::V2::ResumeModelRequest.new(name: name) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.resume_model({ name: name }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.resume_model(::Google::Cloud::Retail::V2::ResumeModelRequest.new(name: name), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, resume_model_client_stub.call_rpc_count - end - end - - def test_delete_model - # Create GRPC objects. - grpc_response = ::Google::Protobuf::Empty.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - delete_model_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :delete_model, name - assert_kind_of ::Google::Cloud::Retail::V2::DeleteModelRequest, request - assert_equal "hello world", request["name"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, delete_model_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ModelService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.delete_model({ name: name }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.delete_model name: name do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.delete_model ::Google::Cloud::Retail::V2::DeleteModelRequest.new(name: name) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.delete_model({ name: name }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.delete_model(::Google::Cloud::Retail::V2::DeleteModelRequest.new(name: name), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, delete_model_client_stub.call_rpc_count - end - end - - def test_list_models - # Create GRPC objects. - grpc_response = ::Google::Cloud::Retail::V2::ListModelsResponse.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - page_size = 42 - page_token = "hello world" - - list_models_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :list_models, name - assert_kind_of ::Google::Cloud::Retail::V2::ListModelsRequest, request - assert_equal "hello world", request["parent"] - assert_equal 42, request["page_size"] - assert_equal "hello world", request["page_token"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, list_models_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ModelService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.list_models({ parent: parent, page_size: page_size, page_token: page_token }) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.list_models parent: parent, page_size: page_size, page_token: page_token do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.list_models ::Google::Cloud::Retail::V2::ListModelsRequest.new(parent: parent, page_size: page_size, page_token: page_token) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.list_models({ parent: parent, page_size: page_size, page_token: page_token }, grpc_options) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.list_models(::Google::Cloud::Retail::V2::ListModelsRequest.new(parent: parent, page_size: page_size, page_token: page_token), grpc_options) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, list_models_client_stub.call_rpc_count - end - end - - def test_update_model - # Create GRPC objects. - grpc_response = ::Google::Cloud::Retail::V2::Model.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - model = {} - update_mask = {} - - update_model_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :update_model, name - assert_kind_of ::Google::Cloud::Retail::V2::UpdateModelRequest, request - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::Model), request["model"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::FieldMask), request["update_mask"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, update_model_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ModelService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.update_model({ model: model, update_mask: update_mask }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.update_model model: model, update_mask: update_mask do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.update_model ::Google::Cloud::Retail::V2::UpdateModelRequest.new(model: model, update_mask: update_mask) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.update_model({ model: model, update_mask: update_mask }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.update_model(::Google::Cloud::Retail::V2::UpdateModelRequest.new(model: model, update_mask: update_mask), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, update_model_client_stub.call_rpc_count - end - end - - def test_tune_model - # Create GRPC objects. - grpc_response = ::Google::Longrunning::Operation.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - tune_model_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :tune_model, name - assert_kind_of ::Google::Cloud::Retail::V2::TuneModelRequest, request - assert_equal "hello world", request["name"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, tune_model_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ModelService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.tune_model({ name: name }) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use named arguments - c.tune_model name: name do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.tune_model ::Google::Cloud::Retail::V2::TuneModelRequest.new(name: name) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.tune_model({ name: name }, grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.tune_model(::Google::Cloud::Retail::V2::TuneModelRequest.new(name: name), grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, tune_model_client_stub.call_rpc_count - end - end - - def test_configure - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - - client = block_config = config = nil - dummy_stub = ClientStub.new nil, nil - Gapic::ServiceStub.stub :new, dummy_stub do - client = ::Google::Cloud::Retail::V2::ModelService::Client.new do |config| - config.credentials = grpc_channel - end - end - - config = client.configure do |c| - block_config = c - end - - assert_same block_config, config - assert_kind_of ::Google::Cloud::Retail::V2::ModelService::Client::Configuration, config - end - - def test_credentials - key = OpenSSL::PKey::RSA.new 2048 - cred_json = { - "private_key" => key.to_pem, - "client_email" => "app@developer.gserviceaccount.com", - "type" => "service_account" - } - key_file = StringIO.new cred_json.to_json - creds = Google::Auth::ServiceAccountCredentials.make_creds({ json_key_io: key_file }) - - dummy_stub = ClientStub.new nil, nil - Gapic::ServiceStub.stub :new, dummy_stub do - client = ::Google::Cloud::Retail::V2::ModelService::Client.new do |config| - config.credentials = creds - end - assert_kind_of ::Google::Cloud::Retail::V2::ModelService::Client, client - assert_equal creds, client.configure.credentials - end - end - - def test_operations_client - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - - client = nil - dummy_stub = ClientStub.new nil, nil - Gapic::ServiceStub.stub :new, dummy_stub do - client = ::Google::Cloud::Retail::V2::ModelService::Client.new do |config| - config.credentials = grpc_channel - end - end - - assert_kind_of ::Google::Cloud::Retail::V2::ModelService::Operations, client.operations_client - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/prediction_service_paths_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/prediction_service_paths_test.rb deleted file mode 100644 index 531290668702..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/prediction_service_paths_test.rb +++ /dev/null @@ -1,55 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "helper" - -require "gapic/grpc/service_stub" - -require "google/cloud/retail/v2/prediction_service" - -class ::Google::Cloud::Retail::V2::PredictionService::ClientPathsTest < Minitest::Test - class DummyStub - def endpoint - "endpoint.example.com" - end - - def universe_domain - "example.com" - end - - def stub_logger - nil - end - - def logger - nil - end - end - - def test_product_path - grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - ::Gapic::ServiceStub.stub :new, DummyStub.new do - client = ::Google::Cloud::Retail::V2::PredictionService::Client.new do |config| - config.credentials = grpc_channel - end - - path = client.product_path project: "value0", location: "value1", catalog: "value2", branch: "value3", product: "value4" - assert_equal "projects/value0/locations/value1/catalogs/value2/branches/value3/products/value4", path - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/prediction_service_rest_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/prediction_service_rest_test.rb deleted file mode 100644 index 6f32476ef660..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/prediction_service_rest_test.rb +++ /dev/null @@ -1,160 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "helper" -require "gapic/rest" -require "google/cloud/retail/v2/prediction_service_pb" -require "google/cloud/retail/v2/prediction_service/rest" - - -class ::Google::Cloud::Retail::V2::PredictionService::Rest::ClientTest < Minitest::Test - class ClientStub - attr_accessor :call_count, :requests - - def initialize response, &block - @response = response - @block = block - @call_count = 0 - @requests = [] - end - - def make_get_request uri:, params: {}, options: {}, method_name: nil - make_http_request :get, uri: uri, body: nil, params: params, options: options, method_name: method_name - end - - def make_delete_request uri:, params: {}, options: {}, method_name: nil - make_http_request :delete, uri: uri, body: nil, params: params, options: options, method_name: method_name - end - - def make_post_request uri:, body: nil, params: {}, options: {}, method_name: nil - make_http_request :post, uri: uri, body: body, params: params, options: options, method_name: method_name - end - - def make_patch_request uri:, body:, params: {}, options: {}, method_name: nil - make_http_request :patch, uri: uri, body: body, params: params, options: options, method_name: method_name - end - - def make_put_request uri:, body:, params: {}, options: {}, method_name: nil - make_http_request :put, uri: uri, body: body, params: params, options: options, method_name: method_name - end - - def make_http_request *args, **kwargs - @call_count += 1 - - @requests << @block&.call(*args, **kwargs) - - @response - end - - def endpoint - "endpoint.example.com" - end - - def universe_domain - "example.com" - end - - def stub_logger - nil - end - - def logger - nil - end - end - - def test_predict - # Create test objects. - client_result = ::Google::Cloud::Retail::V2::PredictResponse.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - placement = "hello world" - user_event = {} - page_size = 42 - page_token = "hello world" - filter = "hello world" - validate_only = true - params = {} - labels = {} - - predict_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::PredictionService::Rest::ServiceStub.stub :transcode_predict_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, predict_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::PredictionService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.predict({ placement: placement, user_event: user_event, page_size: page_size, page_token: page_token, filter: filter, validate_only: validate_only, params: params, labels: labels }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.predict placement: placement, user_event: user_event, page_size: page_size, page_token: page_token, filter: filter, validate_only: validate_only, params: params, labels: labels do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.predict ::Google::Cloud::Retail::V2::PredictRequest.new(placement: placement, user_event: user_event, page_size: page_size, page_token: page_token, filter: filter, validate_only: validate_only, params: params, labels: labels) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.predict({ placement: placement, user_event: user_event, page_size: page_size, page_token: page_token, filter: filter, validate_only: validate_only, params: params, labels: labels }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.predict(::Google::Cloud::Retail::V2::PredictRequest.new(placement: placement, user_event: user_event, page_size: page_size, page_token: page_token, filter: filter, validate_only: validate_only, params: params, labels: labels), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, predict_client_stub.call_count - end - end - end - - def test_configure - credentials_token = :dummy_value - - client = block_config = config = nil - dummy_stub = ClientStub.new nil - Gapic::Rest::ClientStub.stub :new, dummy_stub do - client = ::Google::Cloud::Retail::V2::PredictionService::Rest::Client.new do |config| - config.credentials = credentials_token - end - end - - config = client.configure do |c| - block_config = c - end - - assert_same block_config, config - assert_kind_of ::Google::Cloud::Retail::V2::PredictionService::Rest::Client::Configuration, config - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/prediction_service_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/prediction_service_test.rb deleted file mode 100644 index 3d5ed0aafaaa..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/prediction_service_test.rb +++ /dev/null @@ -1,176 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "helper" - -require "gapic/grpc/service_stub" - -require "google/cloud/retail/v2/prediction_service_pb" -require "google/cloud/retail/v2/prediction_service" - -class ::Google::Cloud::Retail::V2::PredictionService::ClientTest < Minitest::Test - class ClientStub - attr_accessor :call_rpc_count, :requests - - def initialize response, operation, &block - @response = response - @operation = operation - @block = block - @call_rpc_count = 0 - @requests = [] - end - - def call_rpc *args, **kwargs - @call_rpc_count += 1 - - @requests << @block&.call(*args, **kwargs) - - catch :response do - yield @response, @operation if block_given? - @response - end - end - - def endpoint - "endpoint.example.com" - end - - def universe_domain - "example.com" - end - - def stub_logger - nil - end - - def logger - nil - end - end - - def test_predict - # Create GRPC objects. - grpc_response = ::Google::Cloud::Retail::V2::PredictResponse.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - placement = "hello world" - user_event = {} - page_size = 42 - page_token = "hello world" - filter = "hello world" - validate_only = true - params = {} - labels = {} - - predict_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :predict, name - assert_kind_of ::Google::Cloud::Retail::V2::PredictRequest, request - assert_equal "hello world", request["placement"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::UserEvent), request["user_event"] - assert_equal 42, request["page_size"] - assert_equal "hello world", request["page_token"] - assert_equal "hello world", request["filter"] - assert_equal true, request["validate_only"] - assert_equal({}, request["params"].to_h) - assert_equal({}, request["labels"].to_h) - refute_nil options - end - - Gapic::ServiceStub.stub :new, predict_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::PredictionService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.predict({ placement: placement, user_event: user_event, page_size: page_size, page_token: page_token, filter: filter, validate_only: validate_only, params: params, labels: labels }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.predict placement: placement, user_event: user_event, page_size: page_size, page_token: page_token, filter: filter, validate_only: validate_only, params: params, labels: labels do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.predict ::Google::Cloud::Retail::V2::PredictRequest.new(placement: placement, user_event: user_event, page_size: page_size, page_token: page_token, filter: filter, validate_only: validate_only, params: params, labels: labels) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.predict({ placement: placement, user_event: user_event, page_size: page_size, page_token: page_token, filter: filter, validate_only: validate_only, params: params, labels: labels }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.predict(::Google::Cloud::Retail::V2::PredictRequest.new(placement: placement, user_event: user_event, page_size: page_size, page_token: page_token, filter: filter, validate_only: validate_only, params: params, labels: labels), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, predict_client_stub.call_rpc_count - end - end - - def test_configure - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - - client = block_config = config = nil - dummy_stub = ClientStub.new nil, nil - Gapic::ServiceStub.stub :new, dummy_stub do - client = ::Google::Cloud::Retail::V2::PredictionService::Client.new do |config| - config.credentials = grpc_channel - end - end - - config = client.configure do |c| - block_config = c - end - - assert_same block_config, config - assert_kind_of ::Google::Cloud::Retail::V2::PredictionService::Client::Configuration, config - end - - def test_credentials - key = OpenSSL::PKey::RSA.new 2048 - cred_json = { - "private_key" => key.to_pem, - "client_email" => "app@developer.gserviceaccount.com", - "type" => "service_account" - } - key_file = StringIO.new cred_json.to_json - creds = Google::Auth::ServiceAccountCredentials.make_creds({ json_key_io: key_file }) - - dummy_stub = ClientStub.new nil, nil - Gapic::ServiceStub.stub :new, dummy_stub do - client = ::Google::Cloud::Retail::V2::PredictionService::Client.new do |config| - config.credentials = creds - end - assert_kind_of ::Google::Cloud::Retail::V2::PredictionService::Client, client - assert_equal creds, client.configure.credentials - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/product_service_operations_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/product_service_operations_test.rb deleted file mode 100644 index 6aaed25a5816..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/product_service_operations_test.rb +++ /dev/null @@ -1,400 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "helper" - -require "gapic/grpc/service_stub" - -require "google/cloud/retail/v2/product_service_pb" -require "google/cloud/retail/v2/product_service_services_pb" -require "google/cloud/retail/v2/product_service" - -class ::Google::Cloud::Retail::V2::ProductService::OperationsTest < Minitest::Test - class ClientStub - attr_accessor :call_rpc_count, :requests - - def initialize response, operation, &block - @response = response - @operation = operation - @block = block - @call_rpc_count = 0 - @requests = [] - end - - def call_rpc *args, **kwargs - @call_rpc_count += 1 - - @requests << @block&.call(*args, **kwargs) - - catch :response do - yield @response, @operation if block_given? - @response - end - end - - def endpoint - "endpoint.example.com" - end - - def universe_domain - "example.com" - end - - def stub_logger - nil - end - - def logger - nil - end - end - - def test_list_operations - # Create GRPC objects. - grpc_response = ::Google::Longrunning::ListOperationsResponse.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - filter = "hello world" - page_size = 42 - page_token = "hello world" - return_partial_success = true - - list_operations_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :list_operations, name - assert_kind_of ::Google::Longrunning::ListOperationsRequest, request - assert_equal "hello world", request["name"] - assert_equal "hello world", request["filter"] - assert_equal 42, request["page_size"] - assert_equal "hello world", request["page_token"] - assert_equal true, request["return_partial_success"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, list_operations_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ProductService::Operations.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.list_operations({ name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success }) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.list_operations name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.list_operations ::Google::Longrunning::ListOperationsRequest.new(name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.list_operations({ name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success }, grpc_options) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.list_operations(::Google::Longrunning::ListOperationsRequest.new(name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success), grpc_options) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, list_operations_client_stub.call_rpc_count - end - end - - def test_get_operation - # Create GRPC objects. - grpc_response = ::Google::Longrunning::Operation.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - get_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :get_operation, name - assert_kind_of ::Google::Longrunning::GetOperationRequest, request - assert_equal "hello world", request["name"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, get_operation_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ProductService::Operations.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.get_operation({ name: name }) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use named arguments - c.get_operation name: name do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.get_operation ::Google::Longrunning::GetOperationRequest.new(name: name) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.get_operation({ name: name }, grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.get_operation(::Google::Longrunning::GetOperationRequest.new(name: name), grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, get_operation_client_stub.call_rpc_count - end - end - - def test_delete_operation - # Create GRPC objects. - grpc_response = ::Google::Protobuf::Empty.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - delete_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :delete_operation, name - assert_kind_of ::Google::Longrunning::DeleteOperationRequest, request - assert_equal "hello world", request["name"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, delete_operation_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ProductService::Operations.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.delete_operation({ name: name }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.delete_operation name: name do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.delete_operation ::Google::Longrunning::DeleteOperationRequest.new(name: name) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.delete_operation({ name: name }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.delete_operation(::Google::Longrunning::DeleteOperationRequest.new(name: name), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, delete_operation_client_stub.call_rpc_count - end - end - - def test_cancel_operation - # Create GRPC objects. - grpc_response = ::Google::Protobuf::Empty.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - cancel_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :cancel_operation, name - assert_kind_of ::Google::Longrunning::CancelOperationRequest, request - assert_equal "hello world", request["name"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, cancel_operation_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ProductService::Operations.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.cancel_operation({ name: name }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.cancel_operation name: name do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.cancel_operation ::Google::Longrunning::CancelOperationRequest.new(name: name) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.cancel_operation({ name: name }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.cancel_operation(::Google::Longrunning::CancelOperationRequest.new(name: name), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, cancel_operation_client_stub.call_rpc_count - end - end - - def test_wait_operation - # Create GRPC objects. - grpc_response = ::Google::Longrunning::Operation.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - timeout = {} - - wait_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :wait_operation, name - assert_kind_of ::Google::Longrunning::WaitOperationRequest, request - assert_equal "hello world", request["name"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::Duration), request["timeout"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, wait_operation_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ProductService::Operations.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.wait_operation({ name: name, timeout: timeout }) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use named arguments - c.wait_operation name: name, timeout: timeout do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.wait_operation ::Google::Longrunning::WaitOperationRequest.new(name: name, timeout: timeout) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.wait_operation({ name: name, timeout: timeout }, grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.wait_operation(::Google::Longrunning::WaitOperationRequest.new(name: name, timeout: timeout), grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, wait_operation_client_stub.call_rpc_count - end - end - - def test_configure - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - - client = block_config = config = nil - dummy_stub = ClientStub.new nil, nil - Gapic::ServiceStub.stub :new, dummy_stub do - client = ::Google::Cloud::Retail::V2::ProductService::Operations.new do |config| - config.credentials = grpc_channel - end - end - - config = client.configure do |c| - block_config = c - end - - assert_same block_config, config - assert_kind_of ::Google::Cloud::Retail::V2::ProductService::Operations::Configuration, config - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/product_service_paths_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/product_service_paths_test.rb deleted file mode 100644 index b58df28b3831..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/product_service_paths_test.rb +++ /dev/null @@ -1,67 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "helper" - -require "gapic/grpc/service_stub" - -require "google/cloud/retail/v2/product_service" - -class ::Google::Cloud::Retail::V2::ProductService::ClientPathsTest < Minitest::Test - class DummyStub - def endpoint - "endpoint.example.com" - end - - def universe_domain - "example.com" - end - - def stub_logger - nil - end - - def logger - nil - end - end - - def test_branch_path - grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - ::Gapic::ServiceStub.stub :new, DummyStub.new do - client = ::Google::Cloud::Retail::V2::ProductService::Client.new do |config| - config.credentials = grpc_channel - end - - path = client.branch_path project: "value0", location: "value1", catalog: "value2", branch: "value3" - assert_equal "projects/value0/locations/value1/catalogs/value2/branches/value3", path - end - end - - def test_product_path - grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - ::Gapic::ServiceStub.stub :new, DummyStub.new do - client = ::Google::Cloud::Retail::V2::ProductService::Client.new do |config| - config.credentials = grpc_channel - end - - path = client.product_path project: "value0", location: "value1", catalog: "value2", branch: "value3", product: "value4" - assert_equal "projects/value0/locations/value1/catalogs/value2/branches/value3/products/value4", path - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/product_service_rest_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/product_service_rest_test.rb deleted file mode 100644 index b362952cd6c4..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/product_service_rest_test.rb +++ /dev/null @@ -1,781 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "helper" -require "gapic/rest" -require "google/cloud/retail/v2/product_service_pb" -require "google/cloud/retail/v2/product_service/rest" - - -class ::Google::Cloud::Retail::V2::ProductService::Rest::ClientTest < Minitest::Test - class ClientStub - attr_accessor :call_count, :requests - - def initialize response, &block - @response = response - @block = block - @call_count = 0 - @requests = [] - end - - def make_get_request uri:, params: {}, options: {}, method_name: nil - make_http_request :get, uri: uri, body: nil, params: params, options: options, method_name: method_name - end - - def make_delete_request uri:, params: {}, options: {}, method_name: nil - make_http_request :delete, uri: uri, body: nil, params: params, options: options, method_name: method_name - end - - def make_post_request uri:, body: nil, params: {}, options: {}, method_name: nil - make_http_request :post, uri: uri, body: body, params: params, options: options, method_name: method_name - end - - def make_patch_request uri:, body:, params: {}, options: {}, method_name: nil - make_http_request :patch, uri: uri, body: body, params: params, options: options, method_name: method_name - end - - def make_put_request uri:, body:, params: {}, options: {}, method_name: nil - make_http_request :put, uri: uri, body: body, params: params, options: options, method_name: method_name - end - - def make_http_request *args, **kwargs - @call_count += 1 - - @requests << @block&.call(*args, **kwargs) - - @response - end - - def endpoint - "endpoint.example.com" - end - - def universe_domain - "example.com" - end - - def stub_logger - nil - end - - def logger - nil - end - end - - def test_create_product - # Create test objects. - client_result = ::Google::Cloud::Retail::V2::Product.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - product = {} - product_id = "hello world" - - create_product_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::ProductService::Rest::ServiceStub.stub :transcode_create_product_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, create_product_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ProductService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.create_product({ parent: parent, product: product, product_id: product_id }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.create_product parent: parent, product: product, product_id: product_id do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.create_product ::Google::Cloud::Retail::V2::CreateProductRequest.new(parent: parent, product: product, product_id: product_id) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.create_product({ parent: parent, product: product, product_id: product_id }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.create_product(::Google::Cloud::Retail::V2::CreateProductRequest.new(parent: parent, product: product, product_id: product_id), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, create_product_client_stub.call_count - end - end - end - - def test_get_product - # Create test objects. - client_result = ::Google::Cloud::Retail::V2::Product.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - get_product_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::ProductService::Rest::ServiceStub.stub :transcode_get_product_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, get_product_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ProductService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.get_product({ name: name }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.get_product name: name do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.get_product ::Google::Cloud::Retail::V2::GetProductRequest.new(name: name) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.get_product({ name: name }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.get_product(::Google::Cloud::Retail::V2::GetProductRequest.new(name: name), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, get_product_client_stub.call_count - end - end - end - - def test_list_products - # Create test objects. - client_result = ::Google::Cloud::Retail::V2::ListProductsResponse.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - page_size = 42 - page_token = "hello world" - filter = "hello world" - read_mask = {} - - list_products_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::ProductService::Rest::ServiceStub.stub :transcode_list_products_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, list_products_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ProductService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.list_products({ parent: parent, page_size: page_size, page_token: page_token, filter: filter, read_mask: read_mask }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.list_products parent: parent, page_size: page_size, page_token: page_token, filter: filter, read_mask: read_mask do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.list_products ::Google::Cloud::Retail::V2::ListProductsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter, read_mask: read_mask) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.list_products({ parent: parent, page_size: page_size, page_token: page_token, filter: filter, read_mask: read_mask }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.list_products(::Google::Cloud::Retail::V2::ListProductsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter, read_mask: read_mask), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, list_products_client_stub.call_count - end - end - end - - def test_update_product - # Create test objects. - client_result = ::Google::Cloud::Retail::V2::Product.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - product = {} - update_mask = {} - allow_missing = true - - update_product_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::ProductService::Rest::ServiceStub.stub :transcode_update_product_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, update_product_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ProductService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.update_product({ product: product, update_mask: update_mask, allow_missing: allow_missing }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.update_product product: product, update_mask: update_mask, allow_missing: allow_missing do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.update_product ::Google::Cloud::Retail::V2::UpdateProductRequest.new(product: product, update_mask: update_mask, allow_missing: allow_missing) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.update_product({ product: product, update_mask: update_mask, allow_missing: allow_missing }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.update_product(::Google::Cloud::Retail::V2::UpdateProductRequest.new(product: product, update_mask: update_mask, allow_missing: allow_missing), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, update_product_client_stub.call_count - end - end - end - - def test_delete_product - # Create test objects. - client_result = ::Google::Protobuf::Empty.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - delete_product_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::ProductService::Rest::ServiceStub.stub :transcode_delete_product_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, delete_product_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ProductService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.delete_product({ name: name }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.delete_product name: name do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.delete_product ::Google::Cloud::Retail::V2::DeleteProductRequest.new(name: name) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.delete_product({ name: name }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.delete_product(::Google::Cloud::Retail::V2::DeleteProductRequest.new(name: name), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, delete_product_client_stub.call_count - end - end - end - - def test_purge_products - # Create test objects. - client_result = ::Google::Longrunning::Operation.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - filter = "hello world" - force = true - - purge_products_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::ProductService::Rest::ServiceStub.stub :transcode_purge_products_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, purge_products_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ProductService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.purge_products({ parent: parent, filter: filter, force: force }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.purge_products parent: parent, filter: filter, force: force do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.purge_products ::Google::Cloud::Retail::V2::PurgeProductsRequest.new(parent: parent, filter: filter, force: force) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.purge_products({ parent: parent, filter: filter, force: force }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.purge_products(::Google::Cloud::Retail::V2::PurgeProductsRequest.new(parent: parent, filter: filter, force: force), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, purge_products_client_stub.call_count - end - end - end - - def test_import_products - # Create test objects. - client_result = ::Google::Longrunning::Operation.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - request_id = "hello world" - input_config = {} - errors_config = {} - update_mask = {} - reconciliation_mode = :RECONCILIATION_MODE_UNSPECIFIED - notification_pubsub_topic = "hello world" - - import_products_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::ProductService::Rest::ServiceStub.stub :transcode_import_products_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, import_products_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ProductService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.import_products({ parent: parent, request_id: request_id, input_config: input_config, errors_config: errors_config, update_mask: update_mask, reconciliation_mode: reconciliation_mode, notification_pubsub_topic: notification_pubsub_topic }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.import_products parent: parent, request_id: request_id, input_config: input_config, errors_config: errors_config, update_mask: update_mask, reconciliation_mode: reconciliation_mode, notification_pubsub_topic: notification_pubsub_topic do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.import_products ::Google::Cloud::Retail::V2::ImportProductsRequest.new(parent: parent, request_id: request_id, input_config: input_config, errors_config: errors_config, update_mask: update_mask, reconciliation_mode: reconciliation_mode, notification_pubsub_topic: notification_pubsub_topic) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.import_products({ parent: parent, request_id: request_id, input_config: input_config, errors_config: errors_config, update_mask: update_mask, reconciliation_mode: reconciliation_mode, notification_pubsub_topic: notification_pubsub_topic }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.import_products(::Google::Cloud::Retail::V2::ImportProductsRequest.new(parent: parent, request_id: request_id, input_config: input_config, errors_config: errors_config, update_mask: update_mask, reconciliation_mode: reconciliation_mode, notification_pubsub_topic: notification_pubsub_topic), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, import_products_client_stub.call_count - end - end - end - - def test_set_inventory - # Create test objects. - client_result = ::Google::Longrunning::Operation.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - inventory = {} - set_mask = {} - set_time = {} - allow_missing = true - - set_inventory_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::ProductService::Rest::ServiceStub.stub :transcode_set_inventory_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, set_inventory_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ProductService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.set_inventory({ inventory: inventory, set_mask: set_mask, set_time: set_time, allow_missing: allow_missing }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.set_inventory inventory: inventory, set_mask: set_mask, set_time: set_time, allow_missing: allow_missing do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.set_inventory ::Google::Cloud::Retail::V2::SetInventoryRequest.new(inventory: inventory, set_mask: set_mask, set_time: set_time, allow_missing: allow_missing) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.set_inventory({ inventory: inventory, set_mask: set_mask, set_time: set_time, allow_missing: allow_missing }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.set_inventory(::Google::Cloud::Retail::V2::SetInventoryRequest.new(inventory: inventory, set_mask: set_mask, set_time: set_time, allow_missing: allow_missing), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, set_inventory_client_stub.call_count - end - end - end - - def test_add_fulfillment_places - # Create test objects. - client_result = ::Google::Longrunning::Operation.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - product = "hello world" - type = "hello world" - place_ids = ["hello world"] - add_time = {} - allow_missing = true - - add_fulfillment_places_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::ProductService::Rest::ServiceStub.stub :transcode_add_fulfillment_places_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, add_fulfillment_places_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ProductService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.add_fulfillment_places({ product: product, type: type, place_ids: place_ids, add_time: add_time, allow_missing: allow_missing }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.add_fulfillment_places product: product, type: type, place_ids: place_ids, add_time: add_time, allow_missing: allow_missing do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.add_fulfillment_places ::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest.new(product: product, type: type, place_ids: place_ids, add_time: add_time, allow_missing: allow_missing) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.add_fulfillment_places({ product: product, type: type, place_ids: place_ids, add_time: add_time, allow_missing: allow_missing }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.add_fulfillment_places(::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest.new(product: product, type: type, place_ids: place_ids, add_time: add_time, allow_missing: allow_missing), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, add_fulfillment_places_client_stub.call_count - end - end - end - - def test_remove_fulfillment_places - # Create test objects. - client_result = ::Google::Longrunning::Operation.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - product = "hello world" - type = "hello world" - place_ids = ["hello world"] - remove_time = {} - allow_missing = true - - remove_fulfillment_places_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::ProductService::Rest::ServiceStub.stub :transcode_remove_fulfillment_places_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, remove_fulfillment_places_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ProductService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.remove_fulfillment_places({ product: product, type: type, place_ids: place_ids, remove_time: remove_time, allow_missing: allow_missing }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.remove_fulfillment_places product: product, type: type, place_ids: place_ids, remove_time: remove_time, allow_missing: allow_missing do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.remove_fulfillment_places ::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest.new(product: product, type: type, place_ids: place_ids, remove_time: remove_time, allow_missing: allow_missing) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.remove_fulfillment_places({ product: product, type: type, place_ids: place_ids, remove_time: remove_time, allow_missing: allow_missing }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.remove_fulfillment_places(::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest.new(product: product, type: type, place_ids: place_ids, remove_time: remove_time, allow_missing: allow_missing), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, remove_fulfillment_places_client_stub.call_count - end - end - end - - def test_add_local_inventories - # Create test objects. - client_result = ::Google::Longrunning::Operation.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - product = "hello world" - local_inventories = [{}] - add_mask = {} - add_time = {} - allow_missing = true - - add_local_inventories_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::ProductService::Rest::ServiceStub.stub :transcode_add_local_inventories_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, add_local_inventories_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ProductService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.add_local_inventories({ product: product, local_inventories: local_inventories, add_mask: add_mask, add_time: add_time, allow_missing: allow_missing }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.add_local_inventories product: product, local_inventories: local_inventories, add_mask: add_mask, add_time: add_time, allow_missing: allow_missing do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.add_local_inventories ::Google::Cloud::Retail::V2::AddLocalInventoriesRequest.new(product: product, local_inventories: local_inventories, add_mask: add_mask, add_time: add_time, allow_missing: allow_missing) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.add_local_inventories({ product: product, local_inventories: local_inventories, add_mask: add_mask, add_time: add_time, allow_missing: allow_missing }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.add_local_inventories(::Google::Cloud::Retail::V2::AddLocalInventoriesRequest.new(product: product, local_inventories: local_inventories, add_mask: add_mask, add_time: add_time, allow_missing: allow_missing), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, add_local_inventories_client_stub.call_count - end - end - end - - def test_remove_local_inventories - # Create test objects. - client_result = ::Google::Longrunning::Operation.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - product = "hello world" - place_ids = ["hello world"] - remove_time = {} - allow_missing = true - - remove_local_inventories_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::ProductService::Rest::ServiceStub.stub :transcode_remove_local_inventories_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, remove_local_inventories_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ProductService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.remove_local_inventories({ product: product, place_ids: place_ids, remove_time: remove_time, allow_missing: allow_missing }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.remove_local_inventories product: product, place_ids: place_ids, remove_time: remove_time, allow_missing: allow_missing do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.remove_local_inventories ::Google::Cloud::Retail::V2::RemoveLocalInventoriesRequest.new(product: product, place_ids: place_ids, remove_time: remove_time, allow_missing: allow_missing) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.remove_local_inventories({ product: product, place_ids: place_ids, remove_time: remove_time, allow_missing: allow_missing }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.remove_local_inventories(::Google::Cloud::Retail::V2::RemoveLocalInventoriesRequest.new(product: product, place_ids: place_ids, remove_time: remove_time, allow_missing: allow_missing), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, remove_local_inventories_client_stub.call_count - end - end - end - - def test_configure - credentials_token = :dummy_value - - client = block_config = config = nil - dummy_stub = ClientStub.new nil - Gapic::Rest::ClientStub.stub :new, dummy_stub do - client = ::Google::Cloud::Retail::V2::ProductService::Rest::Client.new do |config| - config.credentials = credentials_token - end - end - - config = client.configure do |c| - block_config = c - end - - assert_same block_config, config - assert_kind_of ::Google::Cloud::Retail::V2::ProductService::Rest::Client::Configuration, config - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/product_service_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/product_service_test.rb deleted file mode 100644 index c4620093e075..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/product_service_test.rb +++ /dev/null @@ -1,922 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "helper" - -require "gapic/grpc/service_stub" - -require "google/cloud/retail/v2/product_service_pb" -require "google/cloud/retail/v2/product_service" - -class ::Google::Cloud::Retail::V2::ProductService::ClientTest < Minitest::Test - class ClientStub - attr_accessor :call_rpc_count, :requests - - def initialize response, operation, &block - @response = response - @operation = operation - @block = block - @call_rpc_count = 0 - @requests = [] - end - - def call_rpc *args, **kwargs - @call_rpc_count += 1 - - @requests << @block&.call(*args, **kwargs) - - catch :response do - yield @response, @operation if block_given? - @response - end - end - - def endpoint - "endpoint.example.com" - end - - def universe_domain - "example.com" - end - - def stub_logger - nil - end - - def logger - nil - end - end - - def test_create_product - # Create GRPC objects. - grpc_response = ::Google::Cloud::Retail::V2::Product.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - product = {} - product_id = "hello world" - - create_product_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :create_product, name - assert_kind_of ::Google::Cloud::Retail::V2::CreateProductRequest, request - assert_equal "hello world", request["parent"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::Product), request["product"] - assert_equal "hello world", request["product_id"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, create_product_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ProductService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.create_product({ parent: parent, product: product, product_id: product_id }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.create_product parent: parent, product: product, product_id: product_id do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.create_product ::Google::Cloud::Retail::V2::CreateProductRequest.new(parent: parent, product: product, product_id: product_id) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.create_product({ parent: parent, product: product, product_id: product_id }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.create_product(::Google::Cloud::Retail::V2::CreateProductRequest.new(parent: parent, product: product, product_id: product_id), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, create_product_client_stub.call_rpc_count - end - end - - def test_get_product - # Create GRPC objects. - grpc_response = ::Google::Cloud::Retail::V2::Product.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - get_product_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :get_product, name - assert_kind_of ::Google::Cloud::Retail::V2::GetProductRequest, request - assert_equal "hello world", request["name"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, get_product_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ProductService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.get_product({ name: name }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.get_product name: name do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.get_product ::Google::Cloud::Retail::V2::GetProductRequest.new(name: name) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.get_product({ name: name }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.get_product(::Google::Cloud::Retail::V2::GetProductRequest.new(name: name), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, get_product_client_stub.call_rpc_count - end - end - - def test_list_products - # Create GRPC objects. - grpc_response = ::Google::Cloud::Retail::V2::ListProductsResponse.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - page_size = 42 - page_token = "hello world" - filter = "hello world" - read_mask = {} - - list_products_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :list_products, name - assert_kind_of ::Google::Cloud::Retail::V2::ListProductsRequest, request - assert_equal "hello world", request["parent"] - assert_equal 42, request["page_size"] - assert_equal "hello world", request["page_token"] - assert_equal "hello world", request["filter"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::FieldMask), request["read_mask"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, list_products_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ProductService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.list_products({ parent: parent, page_size: page_size, page_token: page_token, filter: filter, read_mask: read_mask }) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.list_products parent: parent, page_size: page_size, page_token: page_token, filter: filter, read_mask: read_mask do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.list_products ::Google::Cloud::Retail::V2::ListProductsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter, read_mask: read_mask) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.list_products({ parent: parent, page_size: page_size, page_token: page_token, filter: filter, read_mask: read_mask }, grpc_options) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.list_products(::Google::Cloud::Retail::V2::ListProductsRequest.new(parent: parent, page_size: page_size, page_token: page_token, filter: filter, read_mask: read_mask), grpc_options) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, list_products_client_stub.call_rpc_count - end - end - - def test_update_product - # Create GRPC objects. - grpc_response = ::Google::Cloud::Retail::V2::Product.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - product = {} - update_mask = {} - allow_missing = true - - update_product_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :update_product, name - assert_kind_of ::Google::Cloud::Retail::V2::UpdateProductRequest, request - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::Product), request["product"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::FieldMask), request["update_mask"] - assert_equal true, request["allow_missing"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, update_product_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ProductService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.update_product({ product: product, update_mask: update_mask, allow_missing: allow_missing }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.update_product product: product, update_mask: update_mask, allow_missing: allow_missing do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.update_product ::Google::Cloud::Retail::V2::UpdateProductRequest.new(product: product, update_mask: update_mask, allow_missing: allow_missing) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.update_product({ product: product, update_mask: update_mask, allow_missing: allow_missing }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.update_product(::Google::Cloud::Retail::V2::UpdateProductRequest.new(product: product, update_mask: update_mask, allow_missing: allow_missing), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, update_product_client_stub.call_rpc_count - end - end - - def test_delete_product - # Create GRPC objects. - grpc_response = ::Google::Protobuf::Empty.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - delete_product_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :delete_product, name - assert_kind_of ::Google::Cloud::Retail::V2::DeleteProductRequest, request - assert_equal "hello world", request["name"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, delete_product_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ProductService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.delete_product({ name: name }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.delete_product name: name do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.delete_product ::Google::Cloud::Retail::V2::DeleteProductRequest.new(name: name) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.delete_product({ name: name }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.delete_product(::Google::Cloud::Retail::V2::DeleteProductRequest.new(name: name), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, delete_product_client_stub.call_rpc_count - end - end - - def test_purge_products - # Create GRPC objects. - grpc_response = ::Google::Longrunning::Operation.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - filter = "hello world" - force = true - - purge_products_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :purge_products, name - assert_kind_of ::Google::Cloud::Retail::V2::PurgeProductsRequest, request - assert_equal "hello world", request["parent"] - assert_equal "hello world", request["filter"] - assert_equal true, request["force"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, purge_products_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ProductService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.purge_products({ parent: parent, filter: filter, force: force }) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use named arguments - c.purge_products parent: parent, filter: filter, force: force do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.purge_products ::Google::Cloud::Retail::V2::PurgeProductsRequest.new(parent: parent, filter: filter, force: force) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.purge_products({ parent: parent, filter: filter, force: force }, grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.purge_products(::Google::Cloud::Retail::V2::PurgeProductsRequest.new(parent: parent, filter: filter, force: force), grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, purge_products_client_stub.call_rpc_count - end - end - - def test_import_products - # Create GRPC objects. - grpc_response = ::Google::Longrunning::Operation.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - request_id = "hello world" - input_config = {} - errors_config = {} - update_mask = {} - reconciliation_mode = :RECONCILIATION_MODE_UNSPECIFIED - notification_pubsub_topic = "hello world" - - import_products_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :import_products, name - assert_kind_of ::Google::Cloud::Retail::V2::ImportProductsRequest, request - assert_equal "hello world", request["parent"] - assert_equal "hello world", request["request_id"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::ProductInputConfig), request["input_config"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::ImportErrorsConfig), request["errors_config"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::FieldMask), request["update_mask"] - assert_equal :RECONCILIATION_MODE_UNSPECIFIED, request["reconciliation_mode"] - assert_equal "hello world", request["notification_pubsub_topic"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, import_products_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ProductService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.import_products({ parent: parent, request_id: request_id, input_config: input_config, errors_config: errors_config, update_mask: update_mask, reconciliation_mode: reconciliation_mode, notification_pubsub_topic: notification_pubsub_topic }) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use named arguments - c.import_products parent: parent, request_id: request_id, input_config: input_config, errors_config: errors_config, update_mask: update_mask, reconciliation_mode: reconciliation_mode, notification_pubsub_topic: notification_pubsub_topic do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.import_products ::Google::Cloud::Retail::V2::ImportProductsRequest.new(parent: parent, request_id: request_id, input_config: input_config, errors_config: errors_config, update_mask: update_mask, reconciliation_mode: reconciliation_mode, notification_pubsub_topic: notification_pubsub_topic) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.import_products({ parent: parent, request_id: request_id, input_config: input_config, errors_config: errors_config, update_mask: update_mask, reconciliation_mode: reconciliation_mode, notification_pubsub_topic: notification_pubsub_topic }, grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.import_products(::Google::Cloud::Retail::V2::ImportProductsRequest.new(parent: parent, request_id: request_id, input_config: input_config, errors_config: errors_config, update_mask: update_mask, reconciliation_mode: reconciliation_mode, notification_pubsub_topic: notification_pubsub_topic), grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, import_products_client_stub.call_rpc_count - end - end - - def test_set_inventory - # Create GRPC objects. - grpc_response = ::Google::Longrunning::Operation.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - inventory = {} - set_mask = {} - set_time = {} - allow_missing = true - - set_inventory_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :set_inventory, name - assert_kind_of ::Google::Cloud::Retail::V2::SetInventoryRequest, request - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::Product), request["inventory"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::FieldMask), request["set_mask"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::Timestamp), request["set_time"] - assert_equal true, request["allow_missing"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, set_inventory_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ProductService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.set_inventory({ inventory: inventory, set_mask: set_mask, set_time: set_time, allow_missing: allow_missing }) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use named arguments - c.set_inventory inventory: inventory, set_mask: set_mask, set_time: set_time, allow_missing: allow_missing do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.set_inventory ::Google::Cloud::Retail::V2::SetInventoryRequest.new(inventory: inventory, set_mask: set_mask, set_time: set_time, allow_missing: allow_missing) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.set_inventory({ inventory: inventory, set_mask: set_mask, set_time: set_time, allow_missing: allow_missing }, grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.set_inventory(::Google::Cloud::Retail::V2::SetInventoryRequest.new(inventory: inventory, set_mask: set_mask, set_time: set_time, allow_missing: allow_missing), grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, set_inventory_client_stub.call_rpc_count - end - end - - def test_add_fulfillment_places - # Create GRPC objects. - grpc_response = ::Google::Longrunning::Operation.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - product = "hello world" - type = "hello world" - place_ids = ["hello world"] - add_time = {} - allow_missing = true - - add_fulfillment_places_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :add_fulfillment_places, name - assert_kind_of ::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest, request - assert_equal "hello world", request["product"] - assert_equal "hello world", request["type"] - assert_equal ["hello world"], request["place_ids"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::Timestamp), request["add_time"] - assert_equal true, request["allow_missing"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, add_fulfillment_places_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ProductService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.add_fulfillment_places({ product: product, type: type, place_ids: place_ids, add_time: add_time, allow_missing: allow_missing }) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use named arguments - c.add_fulfillment_places product: product, type: type, place_ids: place_ids, add_time: add_time, allow_missing: allow_missing do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.add_fulfillment_places ::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest.new(product: product, type: type, place_ids: place_ids, add_time: add_time, allow_missing: allow_missing) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.add_fulfillment_places({ product: product, type: type, place_ids: place_ids, add_time: add_time, allow_missing: allow_missing }, grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.add_fulfillment_places(::Google::Cloud::Retail::V2::AddFulfillmentPlacesRequest.new(product: product, type: type, place_ids: place_ids, add_time: add_time, allow_missing: allow_missing), grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, add_fulfillment_places_client_stub.call_rpc_count - end - end - - def test_remove_fulfillment_places - # Create GRPC objects. - grpc_response = ::Google::Longrunning::Operation.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - product = "hello world" - type = "hello world" - place_ids = ["hello world"] - remove_time = {} - allow_missing = true - - remove_fulfillment_places_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :remove_fulfillment_places, name - assert_kind_of ::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest, request - assert_equal "hello world", request["product"] - assert_equal "hello world", request["type"] - assert_equal ["hello world"], request["place_ids"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::Timestamp), request["remove_time"] - assert_equal true, request["allow_missing"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, remove_fulfillment_places_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ProductService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.remove_fulfillment_places({ product: product, type: type, place_ids: place_ids, remove_time: remove_time, allow_missing: allow_missing }) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use named arguments - c.remove_fulfillment_places product: product, type: type, place_ids: place_ids, remove_time: remove_time, allow_missing: allow_missing do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.remove_fulfillment_places ::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest.new(product: product, type: type, place_ids: place_ids, remove_time: remove_time, allow_missing: allow_missing) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.remove_fulfillment_places({ product: product, type: type, place_ids: place_ids, remove_time: remove_time, allow_missing: allow_missing }, grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.remove_fulfillment_places(::Google::Cloud::Retail::V2::RemoveFulfillmentPlacesRequest.new(product: product, type: type, place_ids: place_ids, remove_time: remove_time, allow_missing: allow_missing), grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, remove_fulfillment_places_client_stub.call_rpc_count - end - end - - def test_add_local_inventories - # Create GRPC objects. - grpc_response = ::Google::Longrunning::Operation.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - product = "hello world" - local_inventories = [{}] - add_mask = {} - add_time = {} - allow_missing = true - - add_local_inventories_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :add_local_inventories, name - assert_kind_of ::Google::Cloud::Retail::V2::AddLocalInventoriesRequest, request - assert_equal "hello world", request["product"] - assert_kind_of ::Google::Cloud::Retail::V2::LocalInventory, request["local_inventories"].first - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::FieldMask), request["add_mask"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::Timestamp), request["add_time"] - assert_equal true, request["allow_missing"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, add_local_inventories_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ProductService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.add_local_inventories({ product: product, local_inventories: local_inventories, add_mask: add_mask, add_time: add_time, allow_missing: allow_missing }) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use named arguments - c.add_local_inventories product: product, local_inventories: local_inventories, add_mask: add_mask, add_time: add_time, allow_missing: allow_missing do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.add_local_inventories ::Google::Cloud::Retail::V2::AddLocalInventoriesRequest.new(product: product, local_inventories: local_inventories, add_mask: add_mask, add_time: add_time, allow_missing: allow_missing) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.add_local_inventories({ product: product, local_inventories: local_inventories, add_mask: add_mask, add_time: add_time, allow_missing: allow_missing }, grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.add_local_inventories(::Google::Cloud::Retail::V2::AddLocalInventoriesRequest.new(product: product, local_inventories: local_inventories, add_mask: add_mask, add_time: add_time, allow_missing: allow_missing), grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, add_local_inventories_client_stub.call_rpc_count - end - end - - def test_remove_local_inventories - # Create GRPC objects. - grpc_response = ::Google::Longrunning::Operation.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - product = "hello world" - place_ids = ["hello world"] - remove_time = {} - allow_missing = true - - remove_local_inventories_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :remove_local_inventories, name - assert_kind_of ::Google::Cloud::Retail::V2::RemoveLocalInventoriesRequest, request - assert_equal "hello world", request["product"] - assert_equal ["hello world"], request["place_ids"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::Timestamp), request["remove_time"] - assert_equal true, request["allow_missing"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, remove_local_inventories_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ProductService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.remove_local_inventories({ product: product, place_ids: place_ids, remove_time: remove_time, allow_missing: allow_missing }) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use named arguments - c.remove_local_inventories product: product, place_ids: place_ids, remove_time: remove_time, allow_missing: allow_missing do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.remove_local_inventories ::Google::Cloud::Retail::V2::RemoveLocalInventoriesRequest.new(product: product, place_ids: place_ids, remove_time: remove_time, allow_missing: allow_missing) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.remove_local_inventories({ product: product, place_ids: place_ids, remove_time: remove_time, allow_missing: allow_missing }, grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.remove_local_inventories(::Google::Cloud::Retail::V2::RemoveLocalInventoriesRequest.new(product: product, place_ids: place_ids, remove_time: remove_time, allow_missing: allow_missing), grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, remove_local_inventories_client_stub.call_rpc_count - end - end - - def test_configure - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - - client = block_config = config = nil - dummy_stub = ClientStub.new nil, nil - Gapic::ServiceStub.stub :new, dummy_stub do - client = ::Google::Cloud::Retail::V2::ProductService::Client.new do |config| - config.credentials = grpc_channel - end - end - - config = client.configure do |c| - block_config = c - end - - assert_same block_config, config - assert_kind_of ::Google::Cloud::Retail::V2::ProductService::Client::Configuration, config - end - - def test_credentials - key = OpenSSL::PKey::RSA.new 2048 - cred_json = { - "private_key" => key.to_pem, - "client_email" => "app@developer.gserviceaccount.com", - "type" => "service_account" - } - key_file = StringIO.new cred_json.to_json - creds = Google::Auth::ServiceAccountCredentials.make_creds({ json_key_io: key_file }) - - dummy_stub = ClientStub.new nil, nil - Gapic::ServiceStub.stub :new, dummy_stub do - client = ::Google::Cloud::Retail::V2::ProductService::Client.new do |config| - config.credentials = creds - end - assert_kind_of ::Google::Cloud::Retail::V2::ProductService::Client, client - assert_equal creds, client.configure.credentials - end - end - - def test_operations_client - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - - client = nil - dummy_stub = ClientStub.new nil, nil - Gapic::ServiceStub.stub :new, dummy_stub do - client = ::Google::Cloud::Retail::V2::ProductService::Client.new do |config| - config.credentials = grpc_channel - end - end - - assert_kind_of ::Google::Cloud::Retail::V2::ProductService::Operations, client.operations_client - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/search_service_paths_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/search_service_paths_test.rb deleted file mode 100644 index 666f380e368d..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/search_service_paths_test.rb +++ /dev/null @@ -1,55 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "helper" - -require "gapic/grpc/service_stub" - -require "google/cloud/retail/v2/search_service" - -class ::Google::Cloud::Retail::V2::SearchService::ClientPathsTest < Minitest::Test - class DummyStub - def endpoint - "endpoint.example.com" - end - - def universe_domain - "example.com" - end - - def stub_logger - nil - end - - def logger - nil - end - end - - def test_branch_path - grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - ::Gapic::ServiceStub.stub :new, DummyStub.new do - client = ::Google::Cloud::Retail::V2::SearchService::Client.new do |config| - config.credentials = grpc_channel - end - - path = client.branch_path project: "value0", location: "value1", catalog: "value2", branch: "value3" - assert_equal "projects/value0/locations/value1/catalogs/value2/branches/value3", path - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/search_service_rest_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/search_service_rest_test.rb deleted file mode 100644 index a800cefe2ac7..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/search_service_rest_test.rb +++ /dev/null @@ -1,180 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "helper" -require "gapic/rest" -require "google/cloud/retail/v2/search_service_pb" -require "google/cloud/retail/v2/search_service/rest" - - -class ::Google::Cloud::Retail::V2::SearchService::Rest::ClientTest < Minitest::Test - class ClientStub - attr_accessor :call_count, :requests - - def initialize response, &block - @response = response - @block = block - @call_count = 0 - @requests = [] - end - - def make_get_request uri:, params: {}, options: {}, method_name: nil - make_http_request :get, uri: uri, body: nil, params: params, options: options, method_name: method_name - end - - def make_delete_request uri:, params: {}, options: {}, method_name: nil - make_http_request :delete, uri: uri, body: nil, params: params, options: options, method_name: method_name - end - - def make_post_request uri:, body: nil, params: {}, options: {}, method_name: nil - make_http_request :post, uri: uri, body: body, params: params, options: options, method_name: method_name - end - - def make_patch_request uri:, body:, params: {}, options: {}, method_name: nil - make_http_request :patch, uri: uri, body: body, params: params, options: options, method_name: method_name - end - - def make_put_request uri:, body:, params: {}, options: {}, method_name: nil - make_http_request :put, uri: uri, body: body, params: params, options: options, method_name: method_name - end - - def make_http_request *args, **kwargs - @call_count += 1 - - @requests << @block&.call(*args, **kwargs) - - @response - end - - def endpoint - "endpoint.example.com" - end - - def universe_domain - "example.com" - end - - def stub_logger - nil - end - - def logger - nil - end - end - - def test_search - # Create test objects. - client_result = ::Google::Cloud::Retail::V2::SearchResponse.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - placement = "hello world" - branch = "hello world" - query = "hello world" - visitor_id = "hello world" - user_info = {} - page_size = 42 - page_token = "hello world" - offset = 42 - filter = "hello world" - canonical_filter = "hello world" - order_by = "hello world" - facet_specs = [{}] - dynamic_facet_spec = {} - boost_spec = {} - query_expansion_spec = {} - variant_rollup_keys = ["hello world"] - page_categories = ["hello world"] - search_mode = :SEARCH_MODE_UNSPECIFIED - personalization_spec = {} - labels = {} - spell_correction_spec = {} - entity = "hello world" - conversational_search_spec = {} - tile_navigation_spec = {} - language_code = "hello world" - region_code = "hello world" - place_id = "hello world" - user_attributes = {} - - search_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::SearchService::Rest::ServiceStub.stub :transcode_search_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, search_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::SearchService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.search({ placement: placement, branch: branch, query: query, visitor_id: visitor_id, user_info: user_info, page_size: page_size, page_token: page_token, offset: offset, filter: filter, canonical_filter: canonical_filter, order_by: order_by, facet_specs: facet_specs, dynamic_facet_spec: dynamic_facet_spec, boost_spec: boost_spec, query_expansion_spec: query_expansion_spec, variant_rollup_keys: variant_rollup_keys, page_categories: page_categories, search_mode: search_mode, personalization_spec: personalization_spec, labels: labels, spell_correction_spec: spell_correction_spec, entity: entity, conversational_search_spec: conversational_search_spec, tile_navigation_spec: tile_navigation_spec, language_code: language_code, region_code: region_code, place_id: place_id, user_attributes: user_attributes }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.search placement: placement, branch: branch, query: query, visitor_id: visitor_id, user_info: user_info, page_size: page_size, page_token: page_token, offset: offset, filter: filter, canonical_filter: canonical_filter, order_by: order_by, facet_specs: facet_specs, dynamic_facet_spec: dynamic_facet_spec, boost_spec: boost_spec, query_expansion_spec: query_expansion_spec, variant_rollup_keys: variant_rollup_keys, page_categories: page_categories, search_mode: search_mode, personalization_spec: personalization_spec, labels: labels, spell_correction_spec: spell_correction_spec, entity: entity, conversational_search_spec: conversational_search_spec, tile_navigation_spec: tile_navigation_spec, language_code: language_code, region_code: region_code, place_id: place_id, user_attributes: user_attributes do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.search ::Google::Cloud::Retail::V2::SearchRequest.new(placement: placement, branch: branch, query: query, visitor_id: visitor_id, user_info: user_info, page_size: page_size, page_token: page_token, offset: offset, filter: filter, canonical_filter: canonical_filter, order_by: order_by, facet_specs: facet_specs, dynamic_facet_spec: dynamic_facet_spec, boost_spec: boost_spec, query_expansion_spec: query_expansion_spec, variant_rollup_keys: variant_rollup_keys, page_categories: page_categories, search_mode: search_mode, personalization_spec: personalization_spec, labels: labels, spell_correction_spec: spell_correction_spec, entity: entity, conversational_search_spec: conversational_search_spec, tile_navigation_spec: tile_navigation_spec, language_code: language_code, region_code: region_code, place_id: place_id, user_attributes: user_attributes) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.search({ placement: placement, branch: branch, query: query, visitor_id: visitor_id, user_info: user_info, page_size: page_size, page_token: page_token, offset: offset, filter: filter, canonical_filter: canonical_filter, order_by: order_by, facet_specs: facet_specs, dynamic_facet_spec: dynamic_facet_spec, boost_spec: boost_spec, query_expansion_spec: query_expansion_spec, variant_rollup_keys: variant_rollup_keys, page_categories: page_categories, search_mode: search_mode, personalization_spec: personalization_spec, labels: labels, spell_correction_spec: spell_correction_spec, entity: entity, conversational_search_spec: conversational_search_spec, tile_navigation_spec: tile_navigation_spec, language_code: language_code, region_code: region_code, place_id: place_id, user_attributes: user_attributes }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.search(::Google::Cloud::Retail::V2::SearchRequest.new(placement: placement, branch: branch, query: query, visitor_id: visitor_id, user_info: user_info, page_size: page_size, page_token: page_token, offset: offset, filter: filter, canonical_filter: canonical_filter, order_by: order_by, facet_specs: facet_specs, dynamic_facet_spec: dynamic_facet_spec, boost_spec: boost_spec, query_expansion_spec: query_expansion_spec, variant_rollup_keys: variant_rollup_keys, page_categories: page_categories, search_mode: search_mode, personalization_spec: personalization_spec, labels: labels, spell_correction_spec: spell_correction_spec, entity: entity, conversational_search_spec: conversational_search_spec, tile_navigation_spec: tile_navigation_spec, language_code: language_code, region_code: region_code, place_id: place_id, user_attributes: user_attributes), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, search_client_stub.call_count - end - end - end - - def test_configure - credentials_token = :dummy_value - - client = block_config = config = nil - dummy_stub = ClientStub.new nil - Gapic::Rest::ClientStub.stub :new, dummy_stub do - client = ::Google::Cloud::Retail::V2::SearchService::Rest::Client.new do |config| - config.credentials = credentials_token - end - end - - config = client.configure do |c| - block_config = c - end - - assert_same block_config, config - assert_kind_of ::Google::Cloud::Retail::V2::SearchService::Rest::Client::Configuration, config - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/search_service_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/search_service_test.rb deleted file mode 100644 index ba77fbd1cd82..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/search_service_test.rb +++ /dev/null @@ -1,222 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "helper" - -require "gapic/grpc/service_stub" - -require "google/cloud/retail/v2/search_service_pb" -require "google/cloud/retail/v2/search_service" - -class ::Google::Cloud::Retail::V2::SearchService::ClientTest < Minitest::Test - class ClientStub - attr_accessor :call_rpc_count, :requests - - def initialize response, operation, &block - @response = response - @operation = operation - @block = block - @call_rpc_count = 0 - @requests = [] - end - - def call_rpc *args, **kwargs - @call_rpc_count += 1 - - @requests << @block&.call(*args, **kwargs) - - catch :response do - yield @response, @operation if block_given? - @response - end - end - - def endpoint - "endpoint.example.com" - end - - def universe_domain - "example.com" - end - - def stub_logger - nil - end - - def logger - nil - end - end - - def test_search - # Create GRPC objects. - grpc_response = ::Google::Cloud::Retail::V2::SearchResponse.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - placement = "hello world" - branch = "hello world" - query = "hello world" - visitor_id = "hello world" - user_info = {} - page_size = 42 - page_token = "hello world" - offset = 42 - filter = "hello world" - canonical_filter = "hello world" - order_by = "hello world" - facet_specs = [{}] - dynamic_facet_spec = {} - boost_spec = {} - query_expansion_spec = {} - variant_rollup_keys = ["hello world"] - page_categories = ["hello world"] - search_mode = :SEARCH_MODE_UNSPECIFIED - personalization_spec = {} - labels = {} - spell_correction_spec = {} - entity = "hello world" - conversational_search_spec = {} - tile_navigation_spec = {} - language_code = "hello world" - region_code = "hello world" - place_id = "hello world" - user_attributes = {} - - search_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :search, name - assert_kind_of ::Google::Cloud::Retail::V2::SearchRequest, request - assert_equal "hello world", request["placement"] - assert_equal "hello world", request["branch"] - assert_equal "hello world", request["query"] - assert_equal "hello world", request["visitor_id"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::UserInfo), request["user_info"] - assert_equal 42, request["page_size"] - assert_equal "hello world", request["page_token"] - assert_equal 42, request["offset"] - assert_equal "hello world", request["filter"] - assert_equal "hello world", request["canonical_filter"] - assert_equal "hello world", request["order_by"] - assert_kind_of ::Google::Cloud::Retail::V2::SearchRequest::FacetSpec, request["facet_specs"].first - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::SearchRequest::DynamicFacetSpec), request["dynamic_facet_spec"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::SearchRequest::BoostSpec), request["boost_spec"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::SearchRequest::QueryExpansionSpec), request["query_expansion_spec"] - assert_equal ["hello world"], request["variant_rollup_keys"] - assert_equal ["hello world"], request["page_categories"] - assert_equal :SEARCH_MODE_UNSPECIFIED, request["search_mode"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::SearchRequest::PersonalizationSpec), request["personalization_spec"] - assert_equal({}, request["labels"].to_h) - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::SearchRequest::SpellCorrectionSpec), request["spell_correction_spec"] - assert request.has_spell_correction_spec? - assert_equal "hello world", request["entity"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::SearchRequest::ConversationalSearchSpec), request["conversational_search_spec"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::SearchRequest::TileNavigationSpec), request["tile_navigation_spec"] - assert_equal "hello world", request["language_code"] - assert_equal "hello world", request["region_code"] - assert_equal "hello world", request["place_id"] - assert_equal({}, request["user_attributes"].to_h) - refute_nil options - end - - Gapic::ServiceStub.stub :new, search_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::SearchService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.search({ placement: placement, branch: branch, query: query, visitor_id: visitor_id, user_info: user_info, page_size: page_size, page_token: page_token, offset: offset, filter: filter, canonical_filter: canonical_filter, order_by: order_by, facet_specs: facet_specs, dynamic_facet_spec: dynamic_facet_spec, boost_spec: boost_spec, query_expansion_spec: query_expansion_spec, variant_rollup_keys: variant_rollup_keys, page_categories: page_categories, search_mode: search_mode, personalization_spec: personalization_spec, labels: labels, spell_correction_spec: spell_correction_spec, entity: entity, conversational_search_spec: conversational_search_spec, tile_navigation_spec: tile_navigation_spec, language_code: language_code, region_code: region_code, place_id: place_id, user_attributes: user_attributes }) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.search placement: placement, branch: branch, query: query, visitor_id: visitor_id, user_info: user_info, page_size: page_size, page_token: page_token, offset: offset, filter: filter, canonical_filter: canonical_filter, order_by: order_by, facet_specs: facet_specs, dynamic_facet_spec: dynamic_facet_spec, boost_spec: boost_spec, query_expansion_spec: query_expansion_spec, variant_rollup_keys: variant_rollup_keys, page_categories: page_categories, search_mode: search_mode, personalization_spec: personalization_spec, labels: labels, spell_correction_spec: spell_correction_spec, entity: entity, conversational_search_spec: conversational_search_spec, tile_navigation_spec: tile_navigation_spec, language_code: language_code, region_code: region_code, place_id: place_id, user_attributes: user_attributes do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.search ::Google::Cloud::Retail::V2::SearchRequest.new(placement: placement, branch: branch, query: query, visitor_id: visitor_id, user_info: user_info, page_size: page_size, page_token: page_token, offset: offset, filter: filter, canonical_filter: canonical_filter, order_by: order_by, facet_specs: facet_specs, dynamic_facet_spec: dynamic_facet_spec, boost_spec: boost_spec, query_expansion_spec: query_expansion_spec, variant_rollup_keys: variant_rollup_keys, page_categories: page_categories, search_mode: search_mode, personalization_spec: personalization_spec, labels: labels, spell_correction_spec: spell_correction_spec, entity: entity, conversational_search_spec: conversational_search_spec, tile_navigation_spec: tile_navigation_spec, language_code: language_code, region_code: region_code, place_id: place_id, user_attributes: user_attributes) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.search({ placement: placement, branch: branch, query: query, visitor_id: visitor_id, user_info: user_info, page_size: page_size, page_token: page_token, offset: offset, filter: filter, canonical_filter: canonical_filter, order_by: order_by, facet_specs: facet_specs, dynamic_facet_spec: dynamic_facet_spec, boost_spec: boost_spec, query_expansion_spec: query_expansion_spec, variant_rollup_keys: variant_rollup_keys, page_categories: page_categories, search_mode: search_mode, personalization_spec: personalization_spec, labels: labels, spell_correction_spec: spell_correction_spec, entity: entity, conversational_search_spec: conversational_search_spec, tile_navigation_spec: tile_navigation_spec, language_code: language_code, region_code: region_code, place_id: place_id, user_attributes: user_attributes }, grpc_options) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.search(::Google::Cloud::Retail::V2::SearchRequest.new(placement: placement, branch: branch, query: query, visitor_id: visitor_id, user_info: user_info, page_size: page_size, page_token: page_token, offset: offset, filter: filter, canonical_filter: canonical_filter, order_by: order_by, facet_specs: facet_specs, dynamic_facet_spec: dynamic_facet_spec, boost_spec: boost_spec, query_expansion_spec: query_expansion_spec, variant_rollup_keys: variant_rollup_keys, page_categories: page_categories, search_mode: search_mode, personalization_spec: personalization_spec, labels: labels, spell_correction_spec: spell_correction_spec, entity: entity, conversational_search_spec: conversational_search_spec, tile_navigation_spec: tile_navigation_spec, language_code: language_code, region_code: region_code, place_id: place_id, user_attributes: user_attributes), grpc_options) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, search_client_stub.call_rpc_count - end - end - - def test_configure - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - - client = block_config = config = nil - dummy_stub = ClientStub.new nil, nil - Gapic::ServiceStub.stub :new, dummy_stub do - client = ::Google::Cloud::Retail::V2::SearchService::Client.new do |config| - config.credentials = grpc_channel - end - end - - config = client.configure do |c| - block_config = c - end - - assert_same block_config, config - assert_kind_of ::Google::Cloud::Retail::V2::SearchService::Client::Configuration, config - end - - def test_credentials - key = OpenSSL::PKey::RSA.new 2048 - cred_json = { - "private_key" => key.to_pem, - "client_email" => "app@developer.gserviceaccount.com", - "type" => "service_account" - } - key_file = StringIO.new cred_json.to_json - creds = Google::Auth::ServiceAccountCredentials.make_creds({ json_key_io: key_file }) - - dummy_stub = ClientStub.new nil, nil - Gapic::ServiceStub.stub :new, dummy_stub do - client = ::Google::Cloud::Retail::V2::SearchService::Client.new do |config| - config.credentials = creds - end - assert_kind_of ::Google::Cloud::Retail::V2::SearchService::Client, client - assert_equal creds, client.configure.credentials - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/serving_config_service_paths_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/serving_config_service_paths_test.rb deleted file mode 100644 index 68252813b8a3..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/serving_config_service_paths_test.rb +++ /dev/null @@ -1,67 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "helper" - -require "gapic/grpc/service_stub" - -require "google/cloud/retail/v2/serving_config_service" - -class ::Google::Cloud::Retail::V2::ServingConfigService::ClientPathsTest < Minitest::Test - class DummyStub - def endpoint - "endpoint.example.com" - end - - def universe_domain - "example.com" - end - - def stub_logger - nil - end - - def logger - nil - end - end - - def test_catalog_path - grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - ::Gapic::ServiceStub.stub :new, DummyStub.new do - client = ::Google::Cloud::Retail::V2::ServingConfigService::Client.new do |config| - config.credentials = grpc_channel - end - - path = client.catalog_path project: "value0", location: "value1", catalog: "value2" - assert_equal "projects/value0/locations/value1/catalogs/value2", path - end - end - - def test_serving_config_path - grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - ::Gapic::ServiceStub.stub :new, DummyStub.new do - client = ::Google::Cloud::Retail::V2::ServingConfigService::Client.new do |config| - config.credentials = grpc_channel - end - - path = client.serving_config_path project: "value0", location: "value1", catalog: "value2", serving_config: "value3" - assert_equal "projects/value0/locations/value1/catalogs/value2/servingConfigs/value3", path - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/serving_config_service_rest_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/serving_config_service_rest_test.rb deleted file mode 100644 index 448a287af110..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/serving_config_service_rest_test.rb +++ /dev/null @@ -1,484 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "helper" -require "gapic/rest" -require "google/cloud/retail/v2/serving_config_service_pb" -require "google/cloud/retail/v2/serving_config_service/rest" - - -class ::Google::Cloud::Retail::V2::ServingConfigService::Rest::ClientTest < Minitest::Test - class ClientStub - attr_accessor :call_count, :requests - - def initialize response, &block - @response = response - @block = block - @call_count = 0 - @requests = [] - end - - def make_get_request uri:, params: {}, options: {}, method_name: nil - make_http_request :get, uri: uri, body: nil, params: params, options: options, method_name: method_name - end - - def make_delete_request uri:, params: {}, options: {}, method_name: nil - make_http_request :delete, uri: uri, body: nil, params: params, options: options, method_name: method_name - end - - def make_post_request uri:, body: nil, params: {}, options: {}, method_name: nil - make_http_request :post, uri: uri, body: body, params: params, options: options, method_name: method_name - end - - def make_patch_request uri:, body:, params: {}, options: {}, method_name: nil - make_http_request :patch, uri: uri, body: body, params: params, options: options, method_name: method_name - end - - def make_put_request uri:, body:, params: {}, options: {}, method_name: nil - make_http_request :put, uri: uri, body: body, params: params, options: options, method_name: method_name - end - - def make_http_request *args, **kwargs - @call_count += 1 - - @requests << @block&.call(*args, **kwargs) - - @response - end - - def endpoint - "endpoint.example.com" - end - - def universe_domain - "example.com" - end - - def stub_logger - nil - end - - def logger - nil - end - end - - def test_create_serving_config - # Create test objects. - client_result = ::Google::Cloud::Retail::V2::ServingConfig.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - serving_config = {} - serving_config_id = "hello world" - - create_serving_config_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::ServingConfigService::Rest::ServiceStub.stub :transcode_create_serving_config_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, create_serving_config_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ServingConfigService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.create_serving_config({ parent: parent, serving_config: serving_config, serving_config_id: serving_config_id }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.create_serving_config parent: parent, serving_config: serving_config, serving_config_id: serving_config_id do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.create_serving_config ::Google::Cloud::Retail::V2::CreateServingConfigRequest.new(parent: parent, serving_config: serving_config, serving_config_id: serving_config_id) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.create_serving_config({ parent: parent, serving_config: serving_config, serving_config_id: serving_config_id }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.create_serving_config(::Google::Cloud::Retail::V2::CreateServingConfigRequest.new(parent: parent, serving_config: serving_config, serving_config_id: serving_config_id), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, create_serving_config_client_stub.call_count - end - end - end - - def test_delete_serving_config - # Create test objects. - client_result = ::Google::Protobuf::Empty.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - delete_serving_config_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::ServingConfigService::Rest::ServiceStub.stub :transcode_delete_serving_config_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, delete_serving_config_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ServingConfigService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.delete_serving_config({ name: name }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.delete_serving_config name: name do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.delete_serving_config ::Google::Cloud::Retail::V2::DeleteServingConfigRequest.new(name: name) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.delete_serving_config({ name: name }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.delete_serving_config(::Google::Cloud::Retail::V2::DeleteServingConfigRequest.new(name: name), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, delete_serving_config_client_stub.call_count - end - end - end - - def test_update_serving_config - # Create test objects. - client_result = ::Google::Cloud::Retail::V2::ServingConfig.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - serving_config = {} - update_mask = {} - - update_serving_config_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::ServingConfigService::Rest::ServiceStub.stub :transcode_update_serving_config_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, update_serving_config_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ServingConfigService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.update_serving_config({ serving_config: serving_config, update_mask: update_mask }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.update_serving_config serving_config: serving_config, update_mask: update_mask do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.update_serving_config ::Google::Cloud::Retail::V2::UpdateServingConfigRequest.new(serving_config: serving_config, update_mask: update_mask) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.update_serving_config({ serving_config: serving_config, update_mask: update_mask }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.update_serving_config(::Google::Cloud::Retail::V2::UpdateServingConfigRequest.new(serving_config: serving_config, update_mask: update_mask), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, update_serving_config_client_stub.call_count - end - end - end - - def test_get_serving_config - # Create test objects. - client_result = ::Google::Cloud::Retail::V2::ServingConfig.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - get_serving_config_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::ServingConfigService::Rest::ServiceStub.stub :transcode_get_serving_config_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, get_serving_config_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ServingConfigService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.get_serving_config({ name: name }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.get_serving_config name: name do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.get_serving_config ::Google::Cloud::Retail::V2::GetServingConfigRequest.new(name: name) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.get_serving_config({ name: name }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.get_serving_config(::Google::Cloud::Retail::V2::GetServingConfigRequest.new(name: name), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, get_serving_config_client_stub.call_count - end - end - end - - def test_list_serving_configs - # Create test objects. - client_result = ::Google::Cloud::Retail::V2::ListServingConfigsResponse.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - page_size = 42 - page_token = "hello world" - - list_serving_configs_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::ServingConfigService::Rest::ServiceStub.stub :transcode_list_serving_configs_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, list_serving_configs_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ServingConfigService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.list_serving_configs({ parent: parent, page_size: page_size, page_token: page_token }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.list_serving_configs parent: parent, page_size: page_size, page_token: page_token do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.list_serving_configs ::Google::Cloud::Retail::V2::ListServingConfigsRequest.new(parent: parent, page_size: page_size, page_token: page_token) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.list_serving_configs({ parent: parent, page_size: page_size, page_token: page_token }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.list_serving_configs(::Google::Cloud::Retail::V2::ListServingConfigsRequest.new(parent: parent, page_size: page_size, page_token: page_token), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, list_serving_configs_client_stub.call_count - end - end - end - - def test_add_control - # Create test objects. - client_result = ::Google::Cloud::Retail::V2::ServingConfig.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - serving_config = "hello world" - control_id = "hello world" - - add_control_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::ServingConfigService::Rest::ServiceStub.stub :transcode_add_control_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, add_control_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ServingConfigService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.add_control({ serving_config: serving_config, control_id: control_id }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.add_control serving_config: serving_config, control_id: control_id do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.add_control ::Google::Cloud::Retail::V2::AddControlRequest.new(serving_config: serving_config, control_id: control_id) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.add_control({ serving_config: serving_config, control_id: control_id }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.add_control(::Google::Cloud::Retail::V2::AddControlRequest.new(serving_config: serving_config, control_id: control_id), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, add_control_client_stub.call_count - end - end - end - - def test_remove_control - # Create test objects. - client_result = ::Google::Cloud::Retail::V2::ServingConfig.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - serving_config = "hello world" - control_id = "hello world" - - remove_control_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::ServingConfigService::Rest::ServiceStub.stub :transcode_remove_control_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, remove_control_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ServingConfigService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.remove_control({ serving_config: serving_config, control_id: control_id }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.remove_control serving_config: serving_config, control_id: control_id do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.remove_control ::Google::Cloud::Retail::V2::RemoveControlRequest.new(serving_config: serving_config, control_id: control_id) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.remove_control({ serving_config: serving_config, control_id: control_id }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.remove_control(::Google::Cloud::Retail::V2::RemoveControlRequest.new(serving_config: serving_config, control_id: control_id), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, remove_control_client_stub.call_count - end - end - end - - def test_configure - credentials_token = :dummy_value - - client = block_config = config = nil - dummy_stub = ClientStub.new nil - Gapic::Rest::ClientStub.stub :new, dummy_stub do - client = ::Google::Cloud::Retail::V2::ServingConfigService::Rest::Client.new do |config| - config.credentials = credentials_token - end - end - - config = client.configure do |c| - block_config = c - end - - assert_same block_config, config - assert_kind_of ::Google::Cloud::Retail::V2::ServingConfigService::Rest::Client::Configuration, config - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/serving_config_service_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/serving_config_service_test.rb deleted file mode 100644 index 6715965a490e..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/serving_config_service_test.rb +++ /dev/null @@ -1,529 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "helper" - -require "gapic/grpc/service_stub" - -require "google/cloud/retail/v2/serving_config_service_pb" -require "google/cloud/retail/v2/serving_config_service" - -class ::Google::Cloud::Retail::V2::ServingConfigService::ClientTest < Minitest::Test - class ClientStub - attr_accessor :call_rpc_count, :requests - - def initialize response, operation, &block - @response = response - @operation = operation - @block = block - @call_rpc_count = 0 - @requests = [] - end - - def call_rpc *args, **kwargs - @call_rpc_count += 1 - - @requests << @block&.call(*args, **kwargs) - - catch :response do - yield @response, @operation if block_given? - @response - end - end - - def endpoint - "endpoint.example.com" - end - - def universe_domain - "example.com" - end - - def stub_logger - nil - end - - def logger - nil - end - end - - def test_create_serving_config - # Create GRPC objects. - grpc_response = ::Google::Cloud::Retail::V2::ServingConfig.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - serving_config = {} - serving_config_id = "hello world" - - create_serving_config_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :create_serving_config, name - assert_kind_of ::Google::Cloud::Retail::V2::CreateServingConfigRequest, request - assert_equal "hello world", request["parent"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::ServingConfig), request["serving_config"] - assert_equal "hello world", request["serving_config_id"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, create_serving_config_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ServingConfigService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.create_serving_config({ parent: parent, serving_config: serving_config, serving_config_id: serving_config_id }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.create_serving_config parent: parent, serving_config: serving_config, serving_config_id: serving_config_id do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.create_serving_config ::Google::Cloud::Retail::V2::CreateServingConfigRequest.new(parent: parent, serving_config: serving_config, serving_config_id: serving_config_id) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.create_serving_config({ parent: parent, serving_config: serving_config, serving_config_id: serving_config_id }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.create_serving_config(::Google::Cloud::Retail::V2::CreateServingConfigRequest.new(parent: parent, serving_config: serving_config, serving_config_id: serving_config_id), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, create_serving_config_client_stub.call_rpc_count - end - end - - def test_delete_serving_config - # Create GRPC objects. - grpc_response = ::Google::Protobuf::Empty.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - delete_serving_config_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :delete_serving_config, name - assert_kind_of ::Google::Cloud::Retail::V2::DeleteServingConfigRequest, request - assert_equal "hello world", request["name"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, delete_serving_config_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ServingConfigService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.delete_serving_config({ name: name }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.delete_serving_config name: name do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.delete_serving_config ::Google::Cloud::Retail::V2::DeleteServingConfigRequest.new(name: name) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.delete_serving_config({ name: name }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.delete_serving_config(::Google::Cloud::Retail::V2::DeleteServingConfigRequest.new(name: name), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, delete_serving_config_client_stub.call_rpc_count - end - end - - def test_update_serving_config - # Create GRPC objects. - grpc_response = ::Google::Cloud::Retail::V2::ServingConfig.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - serving_config = {} - update_mask = {} - - update_serving_config_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :update_serving_config, name - assert_kind_of ::Google::Cloud::Retail::V2::UpdateServingConfigRequest, request - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::ServingConfig), request["serving_config"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::FieldMask), request["update_mask"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, update_serving_config_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ServingConfigService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.update_serving_config({ serving_config: serving_config, update_mask: update_mask }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.update_serving_config serving_config: serving_config, update_mask: update_mask do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.update_serving_config ::Google::Cloud::Retail::V2::UpdateServingConfigRequest.new(serving_config: serving_config, update_mask: update_mask) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.update_serving_config({ serving_config: serving_config, update_mask: update_mask }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.update_serving_config(::Google::Cloud::Retail::V2::UpdateServingConfigRequest.new(serving_config: serving_config, update_mask: update_mask), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, update_serving_config_client_stub.call_rpc_count - end - end - - def test_get_serving_config - # Create GRPC objects. - grpc_response = ::Google::Cloud::Retail::V2::ServingConfig.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - get_serving_config_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :get_serving_config, name - assert_kind_of ::Google::Cloud::Retail::V2::GetServingConfigRequest, request - assert_equal "hello world", request["name"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, get_serving_config_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ServingConfigService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.get_serving_config({ name: name }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.get_serving_config name: name do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.get_serving_config ::Google::Cloud::Retail::V2::GetServingConfigRequest.new(name: name) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.get_serving_config({ name: name }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.get_serving_config(::Google::Cloud::Retail::V2::GetServingConfigRequest.new(name: name), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, get_serving_config_client_stub.call_rpc_count - end - end - - def test_list_serving_configs - # Create GRPC objects. - grpc_response = ::Google::Cloud::Retail::V2::ListServingConfigsResponse.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - page_size = 42 - page_token = "hello world" - - list_serving_configs_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :list_serving_configs, name - assert_kind_of ::Google::Cloud::Retail::V2::ListServingConfigsRequest, request - assert_equal "hello world", request["parent"] - assert_equal 42, request["page_size"] - assert_equal "hello world", request["page_token"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, list_serving_configs_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ServingConfigService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.list_serving_configs({ parent: parent, page_size: page_size, page_token: page_token }) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.list_serving_configs parent: parent, page_size: page_size, page_token: page_token do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.list_serving_configs ::Google::Cloud::Retail::V2::ListServingConfigsRequest.new(parent: parent, page_size: page_size, page_token: page_token) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.list_serving_configs({ parent: parent, page_size: page_size, page_token: page_token }, grpc_options) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.list_serving_configs(::Google::Cloud::Retail::V2::ListServingConfigsRequest.new(parent: parent, page_size: page_size, page_token: page_token), grpc_options) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, list_serving_configs_client_stub.call_rpc_count - end - end - - def test_add_control - # Create GRPC objects. - grpc_response = ::Google::Cloud::Retail::V2::ServingConfig.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - serving_config = "hello world" - control_id = "hello world" - - add_control_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :add_control, name - assert_kind_of ::Google::Cloud::Retail::V2::AddControlRequest, request - assert_equal "hello world", request["serving_config"] - assert_equal "hello world", request["control_id"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, add_control_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ServingConfigService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.add_control({ serving_config: serving_config, control_id: control_id }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.add_control serving_config: serving_config, control_id: control_id do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.add_control ::Google::Cloud::Retail::V2::AddControlRequest.new(serving_config: serving_config, control_id: control_id) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.add_control({ serving_config: serving_config, control_id: control_id }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.add_control(::Google::Cloud::Retail::V2::AddControlRequest.new(serving_config: serving_config, control_id: control_id), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, add_control_client_stub.call_rpc_count - end - end - - def test_remove_control - # Create GRPC objects. - grpc_response = ::Google::Cloud::Retail::V2::ServingConfig.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - serving_config = "hello world" - control_id = "hello world" - - remove_control_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :remove_control, name - assert_kind_of ::Google::Cloud::Retail::V2::RemoveControlRequest, request - assert_equal "hello world", request["serving_config"] - assert_equal "hello world", request["control_id"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, remove_control_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::ServingConfigService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.remove_control({ serving_config: serving_config, control_id: control_id }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.remove_control serving_config: serving_config, control_id: control_id do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.remove_control ::Google::Cloud::Retail::V2::RemoveControlRequest.new(serving_config: serving_config, control_id: control_id) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.remove_control({ serving_config: serving_config, control_id: control_id }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.remove_control(::Google::Cloud::Retail::V2::RemoveControlRequest.new(serving_config: serving_config, control_id: control_id), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, remove_control_client_stub.call_rpc_count - end - end - - def test_configure - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - - client = block_config = config = nil - dummy_stub = ClientStub.new nil, nil - Gapic::ServiceStub.stub :new, dummy_stub do - client = ::Google::Cloud::Retail::V2::ServingConfigService::Client.new do |config| - config.credentials = grpc_channel - end - end - - config = client.configure do |c| - block_config = c - end - - assert_same block_config, config - assert_kind_of ::Google::Cloud::Retail::V2::ServingConfigService::Client::Configuration, config - end - - def test_credentials - key = OpenSSL::PKey::RSA.new 2048 - cred_json = { - "private_key" => key.to_pem, - "client_email" => "app@developer.gserviceaccount.com", - "type" => "service_account" - } - key_file = StringIO.new cred_json.to_json - creds = Google::Auth::ServiceAccountCredentials.make_creds({ json_key_io: key_file }) - - dummy_stub = ClientStub.new nil, nil - Gapic::ServiceStub.stub :new, dummy_stub do - client = ::Google::Cloud::Retail::V2::ServingConfigService::Client.new do |config| - config.credentials = creds - end - assert_kind_of ::Google::Cloud::Retail::V2::ServingConfigService::Client, client - assert_equal creds, client.configure.credentials - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/user_event_service_operations_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/user_event_service_operations_test.rb deleted file mode 100644 index a0bcbc887f9f..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/user_event_service_operations_test.rb +++ /dev/null @@ -1,400 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "helper" - -require "gapic/grpc/service_stub" - -require "google/cloud/retail/v2/user_event_service_pb" -require "google/cloud/retail/v2/user_event_service_services_pb" -require "google/cloud/retail/v2/user_event_service" - -class ::Google::Cloud::Retail::V2::UserEventService::OperationsTest < Minitest::Test - class ClientStub - attr_accessor :call_rpc_count, :requests - - def initialize response, operation, &block - @response = response - @operation = operation - @block = block - @call_rpc_count = 0 - @requests = [] - end - - def call_rpc *args, **kwargs - @call_rpc_count += 1 - - @requests << @block&.call(*args, **kwargs) - - catch :response do - yield @response, @operation if block_given? - @response - end - end - - def endpoint - "endpoint.example.com" - end - - def universe_domain - "example.com" - end - - def stub_logger - nil - end - - def logger - nil - end - end - - def test_list_operations - # Create GRPC objects. - grpc_response = ::Google::Longrunning::ListOperationsResponse.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - filter = "hello world" - page_size = 42 - page_token = "hello world" - return_partial_success = true - - list_operations_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :list_operations, name - assert_kind_of ::Google::Longrunning::ListOperationsRequest, request - assert_equal "hello world", request["name"] - assert_equal "hello world", request["filter"] - assert_equal 42, request["page_size"] - assert_equal "hello world", request["page_token"] - assert_equal true, request["return_partial_success"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, list_operations_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::UserEventService::Operations.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.list_operations({ name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success }) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.list_operations name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.list_operations ::Google::Longrunning::ListOperationsRequest.new(name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.list_operations({ name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success }, grpc_options) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.list_operations(::Google::Longrunning::ListOperationsRequest.new(name: name, filter: filter, page_size: page_size, page_token: page_token, return_partial_success: return_partial_success), grpc_options) do |response, operation| - assert_kind_of Gapic::PagedEnumerable, response - assert_equal grpc_response, response.response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, list_operations_client_stub.call_rpc_count - end - end - - def test_get_operation - # Create GRPC objects. - grpc_response = ::Google::Longrunning::Operation.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - get_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :get_operation, name - assert_kind_of ::Google::Longrunning::GetOperationRequest, request - assert_equal "hello world", request["name"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, get_operation_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::UserEventService::Operations.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.get_operation({ name: name }) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use named arguments - c.get_operation name: name do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.get_operation ::Google::Longrunning::GetOperationRequest.new(name: name) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.get_operation({ name: name }, grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.get_operation(::Google::Longrunning::GetOperationRequest.new(name: name), grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, get_operation_client_stub.call_rpc_count - end - end - - def test_delete_operation - # Create GRPC objects. - grpc_response = ::Google::Protobuf::Empty.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - delete_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :delete_operation, name - assert_kind_of ::Google::Longrunning::DeleteOperationRequest, request - assert_equal "hello world", request["name"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, delete_operation_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::UserEventService::Operations.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.delete_operation({ name: name }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.delete_operation name: name do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.delete_operation ::Google::Longrunning::DeleteOperationRequest.new(name: name) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.delete_operation({ name: name }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.delete_operation(::Google::Longrunning::DeleteOperationRequest.new(name: name), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, delete_operation_client_stub.call_rpc_count - end - end - - def test_cancel_operation - # Create GRPC objects. - grpc_response = ::Google::Protobuf::Empty.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - - cancel_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :cancel_operation, name - assert_kind_of ::Google::Longrunning::CancelOperationRequest, request - assert_equal "hello world", request["name"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, cancel_operation_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::UserEventService::Operations.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.cancel_operation({ name: name }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.cancel_operation name: name do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.cancel_operation ::Google::Longrunning::CancelOperationRequest.new(name: name) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.cancel_operation({ name: name }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.cancel_operation(::Google::Longrunning::CancelOperationRequest.new(name: name), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, cancel_operation_client_stub.call_rpc_count - end - end - - def test_wait_operation - # Create GRPC objects. - grpc_response = ::Google::Longrunning::Operation.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - name = "hello world" - timeout = {} - - wait_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :wait_operation, name - assert_kind_of ::Google::Longrunning::WaitOperationRequest, request - assert_equal "hello world", request["name"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::Duration), request["timeout"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, wait_operation_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::UserEventService::Operations.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.wait_operation({ name: name, timeout: timeout }) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use named arguments - c.wait_operation name: name, timeout: timeout do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.wait_operation ::Google::Longrunning::WaitOperationRequest.new(name: name, timeout: timeout) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.wait_operation({ name: name, timeout: timeout }, grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.wait_operation(::Google::Longrunning::WaitOperationRequest.new(name: name, timeout: timeout), grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, wait_operation_client_stub.call_rpc_count - end - end - - def test_configure - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - - client = block_config = config = nil - dummy_stub = ClientStub.new nil, nil - Gapic::ServiceStub.stub :new, dummy_stub do - client = ::Google::Cloud::Retail::V2::UserEventService::Operations.new do |config| - config.credentials = grpc_channel - end - end - - config = client.configure do |c| - block_config = c - end - - assert_same block_config, config - assert_kind_of ::Google::Cloud::Retail::V2::UserEventService::Operations::Configuration, config - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/user_event_service_paths_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/user_event_service_paths_test.rb deleted file mode 100644 index 359bdf51e611..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/user_event_service_paths_test.rb +++ /dev/null @@ -1,67 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "helper" - -require "gapic/grpc/service_stub" - -require "google/cloud/retail/v2/user_event_service" - -class ::Google::Cloud::Retail::V2::UserEventService::ClientPathsTest < Minitest::Test - class DummyStub - def endpoint - "endpoint.example.com" - end - - def universe_domain - "example.com" - end - - def stub_logger - nil - end - - def logger - nil - end - end - - def test_catalog_path - grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - ::Gapic::ServiceStub.stub :new, DummyStub.new do - client = ::Google::Cloud::Retail::V2::UserEventService::Client.new do |config| - config.credentials = grpc_channel - end - - path = client.catalog_path project: "value0", location: "value1", catalog: "value2" - assert_equal "projects/value0/locations/value1/catalogs/value2", path - end - end - - def test_product_path - grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - ::Gapic::ServiceStub.stub :new, DummyStub.new do - client = ::Google::Cloud::Retail::V2::UserEventService::Client.new do |config| - config.credentials = grpc_channel - end - - path = client.product_path project: "value0", location: "value1", catalog: "value2", branch: "value3", product: "value4" - assert_equal "projects/value0/locations/value1/catalogs/value2/branches/value3/products/value4", path - end - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/user_event_service_rest_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/user_event_service_rest_test.rb deleted file mode 100644 index 91464499cee3..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/user_event_service_rest_test.rb +++ /dev/null @@ -1,381 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "helper" -require "gapic/rest" -require "google/cloud/retail/v2/user_event_service_pb" -require "google/cloud/retail/v2/user_event_service/rest" - - -class ::Google::Cloud::Retail::V2::UserEventService::Rest::ClientTest < Minitest::Test - class ClientStub - attr_accessor :call_count, :requests - - def initialize response, &block - @response = response - @block = block - @call_count = 0 - @requests = [] - end - - def make_get_request uri:, params: {}, options: {}, method_name: nil - make_http_request :get, uri: uri, body: nil, params: params, options: options, method_name: method_name - end - - def make_delete_request uri:, params: {}, options: {}, method_name: nil - make_http_request :delete, uri: uri, body: nil, params: params, options: options, method_name: method_name - end - - def make_post_request uri:, body: nil, params: {}, options: {}, method_name: nil - make_http_request :post, uri: uri, body: body, params: params, options: options, method_name: method_name - end - - def make_patch_request uri:, body:, params: {}, options: {}, method_name: nil - make_http_request :patch, uri: uri, body: body, params: params, options: options, method_name: method_name - end - - def make_put_request uri:, body:, params: {}, options: {}, method_name: nil - make_http_request :put, uri: uri, body: body, params: params, options: options, method_name: method_name - end - - def make_http_request *args, **kwargs - @call_count += 1 - - @requests << @block&.call(*args, **kwargs) - - @response - end - - def endpoint - "endpoint.example.com" - end - - def universe_domain - "example.com" - end - - def stub_logger - nil - end - - def logger - nil - end - end - - def test_write_user_event - # Create test objects. - client_result = ::Google::Cloud::Retail::V2::UserEvent.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - user_event = {} - write_async = true - - write_user_event_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::UserEventService::Rest::ServiceStub.stub :transcode_write_user_event_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, write_user_event_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::UserEventService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.write_user_event({ parent: parent, user_event: user_event, write_async: write_async }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.write_user_event parent: parent, user_event: user_event, write_async: write_async do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.write_user_event ::Google::Cloud::Retail::V2::WriteUserEventRequest.new(parent: parent, user_event: user_event, write_async: write_async) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.write_user_event({ parent: parent, user_event: user_event, write_async: write_async }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.write_user_event(::Google::Cloud::Retail::V2::WriteUserEventRequest.new(parent: parent, user_event: user_event, write_async: write_async), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, write_user_event_client_stub.call_count - end - end - end - - def test_collect_user_event - # Create test objects. - client_result = ::Google::Api::HttpBody.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - prebuilt_rule = "hello world" - parent = "hello world" - user_event = "hello world" - uri = "hello world" - ets = 42 - raw_json = "hello world" - - collect_user_event_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::UserEventService::Rest::ServiceStub.stub :transcode_collect_user_event_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, collect_user_event_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::UserEventService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.collect_user_event({ prebuilt_rule: prebuilt_rule, parent: parent, user_event: user_event, uri: uri, ets: ets, raw_json: raw_json }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.collect_user_event prebuilt_rule: prebuilt_rule, parent: parent, user_event: user_event, uri: uri, ets: ets, raw_json: raw_json do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.collect_user_event ::Google::Cloud::Retail::V2::CollectUserEventRequest.new(prebuilt_rule: prebuilt_rule, parent: parent, user_event: user_event, uri: uri, ets: ets, raw_json: raw_json) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.collect_user_event({ prebuilt_rule: prebuilt_rule, parent: parent, user_event: user_event, uri: uri, ets: ets, raw_json: raw_json }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.collect_user_event(::Google::Cloud::Retail::V2::CollectUserEventRequest.new(prebuilt_rule: prebuilt_rule, parent: parent, user_event: user_event, uri: uri, ets: ets, raw_json: raw_json), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, collect_user_event_client_stub.call_count - end - end - end - - def test_purge_user_events - # Create test objects. - client_result = ::Google::Longrunning::Operation.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - filter = "hello world" - force = true - - purge_user_events_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::UserEventService::Rest::ServiceStub.stub :transcode_purge_user_events_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, purge_user_events_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::UserEventService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.purge_user_events({ parent: parent, filter: filter, force: force }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.purge_user_events parent: parent, filter: filter, force: force do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.purge_user_events ::Google::Cloud::Retail::V2::PurgeUserEventsRequest.new(parent: parent, filter: filter, force: force) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.purge_user_events({ parent: parent, filter: filter, force: force }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.purge_user_events(::Google::Cloud::Retail::V2::PurgeUserEventsRequest.new(parent: parent, filter: filter, force: force), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, purge_user_events_client_stub.call_count - end - end - end - - def test_import_user_events - # Create test objects. - client_result = ::Google::Longrunning::Operation.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - input_config = {} - errors_config = {} - - import_user_events_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::UserEventService::Rest::ServiceStub.stub :transcode_import_user_events_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, import_user_events_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::UserEventService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.import_user_events({ parent: parent, input_config: input_config, errors_config: errors_config }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.import_user_events parent: parent, input_config: input_config, errors_config: errors_config do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.import_user_events ::Google::Cloud::Retail::V2::ImportUserEventsRequest.new(parent: parent, input_config: input_config, errors_config: errors_config) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.import_user_events({ parent: parent, input_config: input_config, errors_config: errors_config }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.import_user_events(::Google::Cloud::Retail::V2::ImportUserEventsRequest.new(parent: parent, input_config: input_config, errors_config: errors_config), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, import_user_events_client_stub.call_count - end - end - end - - def test_rejoin_user_events - # Create test objects. - client_result = ::Google::Longrunning::Operation.new - http_response = OpenStruct.new body: client_result.to_json - - call_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - user_event_rejoin_scope = :USER_EVENT_REJOIN_SCOPE_UNSPECIFIED - - rejoin_user_events_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| - assert options.metadata.key? :"x-goog-api-client" - assert options.metadata[:"x-goog-api-client"].include? "rest" - refute options.metadata[:"x-goog-api-client"].include? "grpc" - end - - ::Google::Cloud::Retail::V2::UserEventService::Rest::ServiceStub.stub :transcode_rejoin_user_events_request, ["", "", {}] do - Gapic::Rest::ClientStub.stub :new, rejoin_user_events_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::UserEventService::Rest::Client.new do |config| - config.credentials = :dummy_value - end - - # Use hash object - c.rejoin_user_events({ parent: parent, user_event_rejoin_scope: user_event_rejoin_scope }) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use named arguments - c.rejoin_user_events parent: parent, user_event_rejoin_scope: user_event_rejoin_scope do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object - c.rejoin_user_events ::Google::Cloud::Retail::V2::RejoinUserEventsRequest.new(parent: parent, user_event_rejoin_scope: user_event_rejoin_scope) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use hash object with options - c.rejoin_user_events({ parent: parent, user_event_rejoin_scope: user_event_rejoin_scope }, call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Use protobuf object with options - c.rejoin_user_events(::Google::Cloud::Retail::V2::RejoinUserEventsRequest.new(parent: parent, user_event_rejoin_scope: user_event_rejoin_scope), call_options) do |_result, response| - assert_equal http_response, response.underlying_op - end - - # Verify method calls - assert_equal 5, rejoin_user_events_client_stub.call_count - end - end - end - - def test_configure - credentials_token = :dummy_value - - client = block_config = config = nil - dummy_stub = ClientStub.new nil - Gapic::Rest::ClientStub.stub :new, dummy_stub do - client = ::Google::Cloud::Retail::V2::UserEventService::Rest::Client.new do |config| - config.credentials = credentials_token - end - end - - config = client.configure do |c| - block_config = c - end - - assert_same block_config, config - assert_kind_of ::Google::Cloud::Retail::V2::UserEventService::Rest::Client::Configuration, config - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/user_event_service_test.rb b/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/user_event_service_test.rb deleted file mode 100644 index 9b8c7aae2a75..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/test/google/cloud/retail/v2/user_event_service_test.rb +++ /dev/null @@ -1,448 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -require "helper" - -require "gapic/grpc/service_stub" - -require "google/cloud/retail/v2/user_event_service_pb" -require "google/cloud/retail/v2/user_event_service" - -class ::Google::Cloud::Retail::V2::UserEventService::ClientTest < Minitest::Test - class ClientStub - attr_accessor :call_rpc_count, :requests - - def initialize response, operation, &block - @response = response - @operation = operation - @block = block - @call_rpc_count = 0 - @requests = [] - end - - def call_rpc *args, **kwargs - @call_rpc_count += 1 - - @requests << @block&.call(*args, **kwargs) - - catch :response do - yield @response, @operation if block_given? - @response - end - end - - def endpoint - "endpoint.example.com" - end - - def universe_domain - "example.com" - end - - def stub_logger - nil - end - - def logger - nil - end - end - - def test_write_user_event - # Create GRPC objects. - grpc_response = ::Google::Cloud::Retail::V2::UserEvent.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - user_event = {} - write_async = true - - write_user_event_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :write_user_event, name - assert_kind_of ::Google::Cloud::Retail::V2::WriteUserEventRequest, request - assert_equal "hello world", request["parent"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::UserEvent), request["user_event"] - assert_equal true, request["write_async"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, write_user_event_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::UserEventService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.write_user_event({ parent: parent, user_event: user_event, write_async: write_async }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.write_user_event parent: parent, user_event: user_event, write_async: write_async do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.write_user_event ::Google::Cloud::Retail::V2::WriteUserEventRequest.new(parent: parent, user_event: user_event, write_async: write_async) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.write_user_event({ parent: parent, user_event: user_event, write_async: write_async }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.write_user_event(::Google::Cloud::Retail::V2::WriteUserEventRequest.new(parent: parent, user_event: user_event, write_async: write_async), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, write_user_event_client_stub.call_rpc_count - end - end - - def test_collect_user_event - # Create GRPC objects. - grpc_response = ::Google::Api::HttpBody.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - prebuilt_rule = "hello world" - parent = "hello world" - user_event = "hello world" - uri = "hello world" - ets = 42 - raw_json = "hello world" - - collect_user_event_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :collect_user_event, name - assert_kind_of ::Google::Cloud::Retail::V2::CollectUserEventRequest, request - assert_equal "hello world", request["prebuilt_rule"] - assert_equal :prebuilt_rule, request.conversion_rule - assert_equal "hello world", request["parent"] - assert_equal "hello world", request["user_event"] - assert_equal "hello world", request["uri"] - assert_equal 42, request["ets"] - assert_equal "hello world", request["raw_json"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, collect_user_event_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::UserEventService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.collect_user_event({ prebuilt_rule: prebuilt_rule, parent: parent, user_event: user_event, uri: uri, ets: ets, raw_json: raw_json }) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use named arguments - c.collect_user_event prebuilt_rule: prebuilt_rule, parent: parent, user_event: user_event, uri: uri, ets: ets, raw_json: raw_json do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.collect_user_event ::Google::Cloud::Retail::V2::CollectUserEventRequest.new(prebuilt_rule: prebuilt_rule, parent: parent, user_event: user_event, uri: uri, ets: ets, raw_json: raw_json) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.collect_user_event({ prebuilt_rule: prebuilt_rule, parent: parent, user_event: user_event, uri: uri, ets: ets, raw_json: raw_json }, grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.collect_user_event(::Google::Cloud::Retail::V2::CollectUserEventRequest.new(prebuilt_rule: prebuilt_rule, parent: parent, user_event: user_event, uri: uri, ets: ets, raw_json: raw_json), grpc_options) do |response, operation| - assert_equal grpc_response, response - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, collect_user_event_client_stub.call_rpc_count - end - end - - def test_purge_user_events - # Create GRPC objects. - grpc_response = ::Google::Longrunning::Operation.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - filter = "hello world" - force = true - - purge_user_events_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :purge_user_events, name - assert_kind_of ::Google::Cloud::Retail::V2::PurgeUserEventsRequest, request - assert_equal "hello world", request["parent"] - assert_equal "hello world", request["filter"] - assert_equal true, request["force"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, purge_user_events_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::UserEventService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.purge_user_events({ parent: parent, filter: filter, force: force }) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use named arguments - c.purge_user_events parent: parent, filter: filter, force: force do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.purge_user_events ::Google::Cloud::Retail::V2::PurgeUserEventsRequest.new(parent: parent, filter: filter, force: force) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.purge_user_events({ parent: parent, filter: filter, force: force }, grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.purge_user_events(::Google::Cloud::Retail::V2::PurgeUserEventsRequest.new(parent: parent, filter: filter, force: force), grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, purge_user_events_client_stub.call_rpc_count - end - end - - def test_import_user_events - # Create GRPC objects. - grpc_response = ::Google::Longrunning::Operation.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - input_config = {} - errors_config = {} - - import_user_events_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :import_user_events, name - assert_kind_of ::Google::Cloud::Retail::V2::ImportUserEventsRequest, request - assert_equal "hello world", request["parent"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::UserEventInputConfig), request["input_config"] - assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Retail::V2::ImportErrorsConfig), request["errors_config"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, import_user_events_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::UserEventService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.import_user_events({ parent: parent, input_config: input_config, errors_config: errors_config }) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use named arguments - c.import_user_events parent: parent, input_config: input_config, errors_config: errors_config do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.import_user_events ::Google::Cloud::Retail::V2::ImportUserEventsRequest.new(parent: parent, input_config: input_config, errors_config: errors_config) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.import_user_events({ parent: parent, input_config: input_config, errors_config: errors_config }, grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.import_user_events(::Google::Cloud::Retail::V2::ImportUserEventsRequest.new(parent: parent, input_config: input_config, errors_config: errors_config), grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, import_user_events_client_stub.call_rpc_count - end - end - - def test_rejoin_user_events - # Create GRPC objects. - grpc_response = ::Google::Longrunning::Operation.new - grpc_operation = GRPC::ActiveCall::Operation.new nil - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - grpc_options = {} - - # Create request parameters for a unary method. - parent = "hello world" - user_event_rejoin_scope = :USER_EVENT_REJOIN_SCOPE_UNSPECIFIED - - rejoin_user_events_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| - assert_equal :rejoin_user_events, name - assert_kind_of ::Google::Cloud::Retail::V2::RejoinUserEventsRequest, request - assert_equal "hello world", request["parent"] - assert_equal :USER_EVENT_REJOIN_SCOPE_UNSPECIFIED, request["user_event_rejoin_scope"] - refute_nil options - end - - Gapic::ServiceStub.stub :new, rejoin_user_events_client_stub do - # Create client - c = ::Google::Cloud::Retail::V2::UserEventService::Client.new do |config| - config.credentials = grpc_channel - end - - # Use hash object - c.rejoin_user_events({ parent: parent, user_event_rejoin_scope: user_event_rejoin_scope }) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use named arguments - c.rejoin_user_events parent: parent, user_event_rejoin_scope: user_event_rejoin_scope do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object - c.rejoin_user_events ::Google::Cloud::Retail::V2::RejoinUserEventsRequest.new(parent: parent, user_event_rejoin_scope: user_event_rejoin_scope) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use hash object with options - c.rejoin_user_events({ parent: parent, user_event_rejoin_scope: user_event_rejoin_scope }, grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Use protobuf object with options - c.rejoin_user_events(::Google::Cloud::Retail::V2::RejoinUserEventsRequest.new(parent: parent, user_event_rejoin_scope: user_event_rejoin_scope), grpc_options) do |response, operation| - assert_kind_of Gapic::Operation, response - assert_equal grpc_response, response.grpc_op - assert_equal grpc_operation, operation - end - - # Verify method calls - assert_equal 5, rejoin_user_events_client_stub.call_rpc_count - end - end - - def test_configure - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - - client = block_config = config = nil - dummy_stub = ClientStub.new nil, nil - Gapic::ServiceStub.stub :new, dummy_stub do - client = ::Google::Cloud::Retail::V2::UserEventService::Client.new do |config| - config.credentials = grpc_channel - end - end - - config = client.configure do |c| - block_config = c - end - - assert_same block_config, config - assert_kind_of ::Google::Cloud::Retail::V2::UserEventService::Client::Configuration, config - end - - def test_credentials - key = OpenSSL::PKey::RSA.new 2048 - cred_json = { - "private_key" => key.to_pem, - "client_email" => "app@developer.gserviceaccount.com", - "type" => "service_account" - } - key_file = StringIO.new cred_json.to_json - creds = Google::Auth::ServiceAccountCredentials.make_creds({ json_key_io: key_file }) - - dummy_stub = ClientStub.new nil, nil - Gapic::ServiceStub.stub :new, dummy_stub do - client = ::Google::Cloud::Retail::V2::UserEventService::Client.new do |config| - config.credentials = creds - end - assert_kind_of ::Google::Cloud::Retail::V2::UserEventService::Client, client - assert_equal creds, client.configure.credentials - end - end - - def test_operations_client - grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure - - client = nil - dummy_stub = ClientStub.new nil, nil - Gapic::ServiceStub.stub :new, dummy_stub do - client = ::Google::Cloud::Retail::V2::UserEventService::Client.new do |config| - config.credentials = grpc_channel - end - end - - assert_kind_of ::Google::Cloud::Retail::V2::UserEventService::Operations, client.operations_client - end -end diff --git a/owl-bot-staging/google-cloud-retail-v2/test/helper.rb b/owl-bot-staging/google-cloud-retail-v2/test/helper.rb deleted file mode 100644 index 4fb6756ac7e2..000000000000 --- a/owl-bot-staging/google-cloud-retail-v2/test/helper.rb +++ /dev/null @@ -1,35 +0,0 @@ -# frozen_string_literal: true - -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Auto-generated by gapic-generator-ruby. DO NOT EDIT! - -# Load JUnit XML formatter from googleapis/ruby-common-tools to write -# tmp/reports/sponge_log.xml for Kokoro/TestGrid build health tracking. -if ENV["CI"] || ENV["KOKORO_JOB_NAME"] - begin - require "gapic/minitest_junit_preloader" - rescue LoadError - end -end - -require "minitest/autorun" -require "minitest/focus" -require "minitest/mock" -require "minitest/rg" - -require "grpc" - -require "ostruct"