This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *
{@code + * // 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/java/docs/setup#configure_endpoints_for_the_client_library + * try (LocalInventoryServiceClient localInventoryServiceClient = + * LocalInventoryServiceClient.create()) { + * InsertLocalInventoryRequest request = + * InsertLocalInventoryRequest.newBuilder() + * .setParent("parent-995424086") + * .setLocalInventory(LocalInventory.newBuilder().build()) + * .build(); + * LocalInventory response = localInventoryServiceClient.insertLocalInventory(request); + * } + * }+ * + *
Note: close() needs to be called on the LocalInventoryServiceClient object to clean up + * resources such as threads. In the example above, try-with-resources is used, which automatically + * calls close(). + * + *
The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *
See the individual methods for example code. + * + *
Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *
This class can be customized by passing in a custom instance of LocalInventoryServiceSettings + * to create(). For example: + * + *
To customize credentials: + * + *
{@code + * // 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/java/docs/setup#configure_endpoints_for_the_client_library + * LocalInventoryServiceSettings localInventoryServiceSettings = + * LocalInventoryServiceSettings.newBuilder() + * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + * .build(); + * LocalInventoryServiceClient localInventoryServiceClient = + * LocalInventoryServiceClient.create(localInventoryServiceSettings); + * }+ * + *
To customize the endpoint: + * + *
{@code + * // 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/java/docs/setup#configure_endpoints_for_the_client_library + * LocalInventoryServiceSettings localInventoryServiceSettings = + * LocalInventoryServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); + * LocalInventoryServiceClient localInventoryServiceClient = + * LocalInventoryServiceClient.create(localInventoryServiceSettings); + * }+ * + *
To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over + * the wire: + * + *
{@code + * // 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/java/docs/setup#configure_endpoints_for_the_client_library + * LocalInventoryServiceSettings localInventoryServiceSettings = + * LocalInventoryServiceSettings.newHttpJsonBuilder().build(); + * LocalInventoryServiceClient localInventoryServiceClient = + * LocalInventoryServiceClient.create(localInventoryServiceSettings); + * }+ * + *
Please refer to the GitHub repository's samples for more quickstart code snippets. + */ +@BetaApi +@Generated("by gapic-generator-java") +public class LocalInventoryServiceClient implements BackgroundResource { + private final LocalInventoryServiceSettings settings; + private final LocalInventoryServiceStub stub; + + /** Constructs an instance of LocalInventoryServiceClient with default settings. */ + public static final LocalInventoryServiceClient create() throws IOException { + return create(LocalInventoryServiceSettings.newBuilder().build()); + } + + /** + * Constructs an instance of LocalInventoryServiceClient, using the given settings. The channels + * are created based on the settings passed in, or defaults for any settings that are not set. + */ + public static final LocalInventoryServiceClient create(LocalInventoryServiceSettings settings) + throws IOException { + return new LocalInventoryServiceClient(settings); + } + + /** + * Constructs an instance of LocalInventoryServiceClient, using the given stub for making calls. + * This is for advanced usage - prefer using create(LocalInventoryServiceSettings). + */ + public static final LocalInventoryServiceClient create(LocalInventoryServiceStub stub) { + return new LocalInventoryServiceClient(stub); + } + + /** + * Constructs an instance of LocalInventoryServiceClient, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected LocalInventoryServiceClient(LocalInventoryServiceSettings settings) throws IOException { + this.settings = settings; + this.stub = ((LocalInventoryServiceStubSettings) settings.getStubSettings()).createStub(); + } + + protected LocalInventoryServiceClient(LocalInventoryServiceStub stub) { + this.settings = null; + this.stub = stub; + } + + public final LocalInventoryServiceSettings getSettings() { + return settings; + } + + public LocalInventoryServiceStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists the `LocalInventory` resources for the given product in your merchant account. The + * response might contain fewer items than specified by `pageSize`. If `pageToken` was returned in + * previous request, it can be used to obtain additional results. + * + *
`LocalInventory` resources are listed per product for a given account. + * + *
Sample code: + * + *
{@code + * // 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/java/docs/setup#configure_endpoints_for_the_client_library + * try (LocalInventoryServiceClient localInventoryServiceClient = + * LocalInventoryServiceClient.create()) { + * String parent = "parent-995424086"; + * for (LocalInventory element : + * localInventoryServiceClient.listLocalInventories(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * + * @param parent Required. The `name` of the parent product to list local inventories for. Format: + * `accounts/{account}/products/{product}` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListLocalInventoriesPagedResponse listLocalInventories(String parent) { + ListLocalInventoriesRequest request = + ListLocalInventoriesRequest.newBuilder().setParent(parent).build(); + return listLocalInventories(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists the `LocalInventory` resources for the given product in your merchant account. The + * response might contain fewer items than specified by `pageSize`. If `pageToken` was returned in + * previous request, it can be used to obtain additional results. + * + *
`LocalInventory` resources are listed per product for a given account. + * + *
Sample code: + * + *
{@code + * // 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/java/docs/setup#configure_endpoints_for_the_client_library + * try (LocalInventoryServiceClient localInventoryServiceClient = + * LocalInventoryServiceClient.create()) { + * ListLocalInventoriesRequest request = + * ListLocalInventoriesRequest.newBuilder() + * .setParent("parent-995424086") + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * for (LocalInventory element : + * localInventoryServiceClient.listLocalInventories(request).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListLocalInventoriesPagedResponse listLocalInventories( + ListLocalInventoriesRequest request) { + return listLocalInventoriesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists the `LocalInventory` resources for the given product in your merchant account. The + * response might contain fewer items than specified by `pageSize`. If `pageToken` was returned in + * previous request, it can be used to obtain additional results. + * + *
`LocalInventory` resources are listed per product for a given account. + * + *
Sample code: + * + *
{@code + * // 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/java/docs/setup#configure_endpoints_for_the_client_library + * try (LocalInventoryServiceClient localInventoryServiceClient = + * LocalInventoryServiceClient.create()) { + * ListLocalInventoriesRequest request = + * ListLocalInventoriesRequest.newBuilder() + * .setParent("parent-995424086") + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * localInventoryServiceClient.listLocalInventoriesPagedCallable().futureCall(request); + * // Do something. + * for (LocalInventory element : future.get().iterateAll()) { + * // doThingsWith(element); + * } + * } + * }
`LocalInventory` resources are listed per product for a given account. + * + *
Sample code: + * + *
{@code + * // 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/java/docs/setup#configure_endpoints_for_the_client_library + * try (LocalInventoryServiceClient localInventoryServiceClient = + * LocalInventoryServiceClient.create()) { + * ListLocalInventoriesRequest request = + * ListLocalInventoriesRequest.newBuilder() + * .setParent("parent-995424086") + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * while (true) { + * ListLocalInventoriesResponse response = + * localInventoryServiceClient.listLocalInventoriesCallable().call(request); + * for (LocalInventory element : response.getLocalInventoriesList()) { + * // doThingsWith(element); + * } + * String nextPageToken = response.getNextPageToken(); + * if (!Strings.isNullOrEmpty(nextPageToken)) { + * request = request.toBuilder().setPageToken(nextPageToken).build(); + * } else { + * break; + * } + * } + * } + * }+ */ + public final UnaryCallable
Replaces the full `LocalInventory` resource if an entry with the same + * [`storeCode`][google.shopping.merchant.inventories.v1beta.LocalInventory.store_code] already + * exists for the product. + * + *
It might take up to 30 minutes for the new or updated `LocalInventory` resource to appear in + * products. + * + *
Sample code: + * + *
{@code + * // 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/java/docs/setup#configure_endpoints_for_the_client_library + * try (LocalInventoryServiceClient localInventoryServiceClient = + * LocalInventoryServiceClient.create()) { + * InsertLocalInventoryRequest request = + * InsertLocalInventoryRequest.newBuilder() + * .setParent("parent-995424086") + * .setLocalInventory(LocalInventory.newBuilder().build()) + * .build(); + * LocalInventory response = localInventoryServiceClient.insertLocalInventory(request); + * } + * }+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final LocalInventory insertLocalInventory(InsertLocalInventoryRequest request) { + return insertLocalInventoryCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Inserts a `LocalInventory` resource to a product in your merchant account. + * + *
Replaces the full `LocalInventory` resource if an entry with the same + * [`storeCode`][google.shopping.merchant.inventories.v1beta.LocalInventory.store_code] already + * exists for the product. + * + *
It might take up to 30 minutes for the new or updated `LocalInventory` resource to appear in + * products. + * + *
Sample code: + * + *
{@code + * // 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/java/docs/setup#configure_endpoints_for_the_client_library + * try (LocalInventoryServiceClient localInventoryServiceClient = + * LocalInventoryServiceClient.create()) { + * InsertLocalInventoryRequest request = + * InsertLocalInventoryRequest.newBuilder() + * .setParent("parent-995424086") + * .setLocalInventory(LocalInventory.newBuilder().build()) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * localInventoryServiceClient.insertLocalInventoryCallable().futureCall(request); + * // Do something. + * LocalInventory response = future.get(); + * } + * }
Sample code: + * + *
{@code + * // 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/java/docs/setup#configure_endpoints_for_the_client_library + * try (LocalInventoryServiceClient localInventoryServiceClient = + * LocalInventoryServiceClient.create()) { + * LocalInventoryName name = LocalInventoryName.of("[ACCOUNT]", "[PRODUCT]", "[STORE_CODE]"); + * localInventoryServiceClient.deleteLocalInventory(name); + * } + * }+ * + * @param name Required. The name of the local inventory for the given product to delete. Format: + * `accounts/{account}/products/{product}/localInventories/{store_code}` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteLocalInventory(LocalInventoryName name) { + DeleteLocalInventoryRequest request = + DeleteLocalInventoryRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + deleteLocalInventory(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes the specified `LocalInventory` from the given product in your merchant account. It + * might take a up to an hour for the `LocalInventory` to be deleted from the specific product. + * Once you have received a successful delete response, wait for that period before attempting a + * delete again. + * + *
Sample code: + * + *
{@code + * // 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/java/docs/setup#configure_endpoints_for_the_client_library + * try (LocalInventoryServiceClient localInventoryServiceClient = + * LocalInventoryServiceClient.create()) { + * String name = LocalInventoryName.of("[ACCOUNT]", "[PRODUCT]", "[STORE_CODE]").toString(); + * localInventoryServiceClient.deleteLocalInventory(name); + * } + * }+ * + * @param name Required. The name of the local inventory for the given product to delete. Format: + * `accounts/{account}/products/{product}/localInventories/{store_code}` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteLocalInventory(String name) { + DeleteLocalInventoryRequest request = + DeleteLocalInventoryRequest.newBuilder().setName(name).build(); + deleteLocalInventory(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes the specified `LocalInventory` from the given product in your merchant account. It + * might take a up to an hour for the `LocalInventory` to be deleted from the specific product. + * Once you have received a successful delete response, wait for that period before attempting a + * delete again. + * + *
Sample code: + * + *
{@code + * // 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/java/docs/setup#configure_endpoints_for_the_client_library + * try (LocalInventoryServiceClient localInventoryServiceClient = + * LocalInventoryServiceClient.create()) { + * DeleteLocalInventoryRequest request = + * DeleteLocalInventoryRequest.newBuilder() + * .setName(LocalInventoryName.of("[ACCOUNT]", "[PRODUCT]", "[STORE_CODE]").toString()) + * .build(); + * localInventoryServiceClient.deleteLocalInventory(request); + * } + * }+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteLocalInventory(DeleteLocalInventoryRequest request) { + deleteLocalInventoryCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes the specified `LocalInventory` from the given product in your merchant account. It + * might take a up to an hour for the `LocalInventory` to be deleted from the specific product. + * Once you have received a successful delete response, wait for that period before attempting a + * delete again. + * + *
Sample code: + * + *
{@code + * // 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/java/docs/setup#configure_endpoints_for_the_client_library + * try (LocalInventoryServiceClient localInventoryServiceClient = + * LocalInventoryServiceClient.create()) { + * DeleteLocalInventoryRequest request = + * DeleteLocalInventoryRequest.newBuilder() + * .setName(LocalInventoryName.of("[ACCOUNT]", "[PRODUCT]", "[STORE_CODE]").toString()) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * localInventoryServiceClient.deleteLocalInventoryCallable().futureCall(request); + * // Do something. + * future.get(); + * } + * }
The default instance has everything set to sensible defaults: + * + *
The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *
For example, to set the total timeout of insertLocalInventory to 30 seconds: + * + *
{@code + * // 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/java/docs/setup#configure_endpoints_for_the_client_library + * LocalInventoryServiceSettings.Builder localInventoryServiceSettingsBuilder = + * LocalInventoryServiceSettings.newBuilder(); + * localInventoryServiceSettingsBuilder + * .insertLocalInventorySettings() + * .setRetrySettings( + * localInventoryServiceSettingsBuilder + * .insertLocalInventorySettings() + * .getRetrySettings() + * .toBuilder() + * .setTotalTimeout(Duration.ofSeconds(30)) + * .build()); + * LocalInventoryServiceSettings localInventoryServiceSettings = + * localInventoryServiceSettingsBuilder.build(); + * }+ */ +@BetaApi +@Generated("by gapic-generator-java") +public class LocalInventoryServiceSettings extends ClientSettings
Note: This method does not support applying settings to streaming methods.
+ */
+ public Builder applyToAllUnaryMethods(
+ ApiFunction This class provides the ability to make remote calls to the backing service through method
+ * calls that map to API methods. Sample code to get started:
+ *
+ * Note: close() needs to be called on the RegionalInventoryServiceClient object to clean up
+ * resources such as threads. In the example above, try-with-resources is used, which automatically
+ * calls close().
+ *
+ * The surface of this class includes several types of Java methods for each of the API's
+ * methods:
+ *
+ * See the individual methods for example code.
+ *
+ * Many parameters require resource names to be formatted in a particular way. To assist with
+ * these names, this class includes a format method for each type of name, and additionally a parse
+ * method to extract the individual identifiers contained within names that are returned.
+ *
+ * This class can be customized by passing in a custom instance of
+ * RegionalInventoryServiceSettings to create(). For example:
+ *
+ * To customize credentials:
+ *
+ * To customize the endpoint:
+ *
+ * To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over
+ * the wire:
+ *
+ * Please refer to the GitHub repository's samples for more quickstart code snippets.
+ */
+@BetaApi
+@Generated("by gapic-generator-java")
+public class RegionalInventoryServiceClient implements BackgroundResource {
+ private final RegionalInventoryServiceSettings settings;
+ private final RegionalInventoryServiceStub stub;
+
+ /** Constructs an instance of RegionalInventoryServiceClient with default settings. */
+ public static final RegionalInventoryServiceClient create() throws IOException {
+ return create(RegionalInventoryServiceSettings.newBuilder().build());
+ }
+
+ /**
+ * Constructs an instance of RegionalInventoryServiceClient, using the given settings. The
+ * channels are created based on the settings passed in, or defaults for any settings that are not
+ * set.
+ */
+ public static final RegionalInventoryServiceClient create(
+ RegionalInventoryServiceSettings settings) throws IOException {
+ return new RegionalInventoryServiceClient(settings);
+ }
+
+ /**
+ * Constructs an instance of RegionalInventoryServiceClient, using the given stub for making
+ * calls. This is for advanced usage - prefer using create(RegionalInventoryServiceSettings).
+ */
+ public static final RegionalInventoryServiceClient create(RegionalInventoryServiceStub stub) {
+ return new RegionalInventoryServiceClient(stub);
+ }
+
+ /**
+ * Constructs an instance of RegionalInventoryServiceClient, using the given settings. This is
+ * protected so that it is easy to make a subclass, but otherwise, the static factory methods
+ * should be preferred.
+ */
+ protected RegionalInventoryServiceClient(RegionalInventoryServiceSettings settings)
+ throws IOException {
+ this.settings = settings;
+ this.stub = ((RegionalInventoryServiceStubSettings) settings.getStubSettings()).createStub();
+ }
+
+ protected RegionalInventoryServiceClient(RegionalInventoryServiceStub stub) {
+ this.settings = null;
+ this.stub = stub;
+ }
+
+ public final RegionalInventoryServiceSettings getSettings() {
+ return settings;
+ }
+
+ public RegionalInventoryServiceStub getStub() {
+ return stub;
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Lists the `RegionalInventory` resources for the given product in your merchant account. The
+ * response might contain fewer items than specified by `pageSize`. If `pageToken` was returned in
+ * previous request, it can be used to obtain additional results.
+ *
+ * `RegionalInventory` resources are listed per product for a given account.
+ *
+ * Sample code:
+ *
+ * `RegionalInventory` resources are listed per product for a given account.
+ *
+ * Sample code:
+ *
+ * `RegionalInventory` resources are listed per product for a given account.
+ *
+ * Sample code:
+ *
+ * `RegionalInventory` resources are listed per product for a given account.
+ *
+ * Sample code:
+ *
+ * Replaces the full `RegionalInventory` resource if an entry with the same
+ * [`region`][google.shopping.merchant.inventories.v1beta.RegionalInventory.region] already exists
+ * for the product.
+ *
+ * It might take up to 30 minutes for the new or updated `RegionalInventory` resource to appear
+ * in products.
+ *
+ * Sample code:
+ *
+ * Replaces the full `RegionalInventory` resource if an entry with the same
+ * [`region`][google.shopping.merchant.inventories.v1beta.RegionalInventory.region] already exists
+ * for the product.
+ *
+ * It might take up to 30 minutes for the new or updated `RegionalInventory` resource to appear
+ * in products.
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * The default instance has everything set to sensible defaults:
+ *
+ * The builder of this class is recursive, so contained classes are themselves builders. When
+ * build() is called, the tree of builders is called to create the complete settings object.
+ *
+ * For example, to set the total timeout of insertRegionalInventory to 30 seconds:
+ *
+ * Note: This method does not support applying settings to streaming methods.
+ */
+ public Builder applyToAllUnaryMethods(
+ ApiFunction The interfaces provided are listed below, along with usage samples.
+ *
+ * ======================= LocalInventoryServiceClient =======================
+ *
+ * Service Description: Service to manage local inventory for products
+ *
+ * Sample for LocalInventoryServiceClient:
+ *
+ * ======================= RegionalInventoryServiceClient =======================
+ *
+ * Service Description: Service to manage regional inventory for products. There is also separate
+ * `regions` resource and API to manage regions definitions.
+ *
+ * Sample for RegionalInventoryServiceClient:
+ *
+ * This class is for advanced usage.
+ */
+@BetaApi
+@Generated("by gapic-generator-java")
+public class GrpcLocalInventoryServiceCallableFactory implements GrpcStubCallableFactory {
+
+ @Override
+ public This class is for advanced usage and reflects the underlying API directly.
+ */
+@BetaApi
+@Generated("by gapic-generator-java")
+public class GrpcLocalInventoryServiceStub extends LocalInventoryServiceStub {
+ private static final MethodDescriptor This class is for advanced usage.
+ */
+@BetaApi
+@Generated("by gapic-generator-java")
+public class GrpcRegionalInventoryServiceCallableFactory implements GrpcStubCallableFactory {
+
+ @Override
+ public This class is for advanced usage and reflects the underlying API directly.
+ */
+@BetaApi
+@Generated("by gapic-generator-java")
+public class GrpcRegionalInventoryServiceStub extends RegionalInventoryServiceStub {
+ private static final MethodDescriptor<
+ ListRegionalInventoriesRequest, ListRegionalInventoriesResponse>
+ listRegionalInventoriesMethodDescriptor =
+ MethodDescriptor
+ . This class is for advanced usage.
+ */
+@BetaApi
+@Generated("by gapic-generator-java")
+public class HttpJsonLocalInventoryServiceCallableFactory
+ implements HttpJsonStubCallableFactory This class is for advanced usage and reflects the underlying API directly.
+ */
+@BetaApi
+@Generated("by gapic-generator-java")
+public class HttpJsonLocalInventoryServiceStub extends LocalInventoryServiceStub {
+ private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder().build();
+
+ private static final ApiMethodDescriptor<
+ ListLocalInventoriesRequest, ListLocalInventoriesResponse>
+ listLocalInventoriesMethodDescriptor =
+ ApiMethodDescriptor
+ . This class is for advanced usage.
+ */
+@BetaApi
+@Generated("by gapic-generator-java")
+public class HttpJsonRegionalInventoryServiceCallableFactory
+ implements HttpJsonStubCallableFactory This class is for advanced usage and reflects the underlying API directly.
+ */
+@BetaApi
+@Generated("by gapic-generator-java")
+public class HttpJsonRegionalInventoryServiceStub extends RegionalInventoryServiceStub {
+ private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder().build();
+
+ private static final ApiMethodDescriptor<
+ ListRegionalInventoriesRequest, ListRegionalInventoriesResponse>
+ listRegionalInventoriesMethodDescriptor =
+ ApiMethodDescriptor
+ .{@code
+ * // 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/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (RegionalInventoryServiceClient regionalInventoryServiceClient =
+ * RegionalInventoryServiceClient.create()) {
+ * InsertRegionalInventoryRequest request =
+ * InsertRegionalInventoryRequest.newBuilder()
+ * .setParent("parent-995424086")
+ * .setRegionalInventory(RegionalInventory.newBuilder().build())
+ * .build();
+ * RegionalInventory response = regionalInventoryServiceClient.insertRegionalInventory(request);
+ * }
+ * }
+ *
+ *
+ *
+ *
+ * {@code
+ * // 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/java/docs/setup#configure_endpoints_for_the_client_library
+ * RegionalInventoryServiceSettings regionalInventoryServiceSettings =
+ * RegionalInventoryServiceSettings.newBuilder()
+ * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ * .build();
+ * RegionalInventoryServiceClient regionalInventoryServiceClient =
+ * RegionalInventoryServiceClient.create(regionalInventoryServiceSettings);
+ * }
+ *
+ * {@code
+ * // 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/java/docs/setup#configure_endpoints_for_the_client_library
+ * RegionalInventoryServiceSettings regionalInventoryServiceSettings =
+ * RegionalInventoryServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * RegionalInventoryServiceClient regionalInventoryServiceClient =
+ * RegionalInventoryServiceClient.create(regionalInventoryServiceSettings);
+ * }
+ *
+ * {@code
+ * // 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/java/docs/setup#configure_endpoints_for_the_client_library
+ * RegionalInventoryServiceSettings regionalInventoryServiceSettings =
+ * RegionalInventoryServiceSettings.newHttpJsonBuilder().build();
+ * RegionalInventoryServiceClient regionalInventoryServiceClient =
+ * RegionalInventoryServiceClient.create(regionalInventoryServiceSettings);
+ * }
+ *
+ * {@code
+ * // 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/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (RegionalInventoryServiceClient regionalInventoryServiceClient =
+ * RegionalInventoryServiceClient.create()) {
+ * String parent = "parent-995424086";
+ * for (RegionalInventory element :
+ * regionalInventoryServiceClient.listRegionalInventories(parent).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ *
+ * @param parent Required. The `name` of the parent product to list `RegionalInventory` resources
+ * for. Format: `accounts/{account}/products/{product}`
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListRegionalInventoriesPagedResponse listRegionalInventories(String parent) {
+ ListRegionalInventoriesRequest request =
+ ListRegionalInventoriesRequest.newBuilder().setParent(parent).build();
+ return listRegionalInventories(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Lists the `RegionalInventory` resources for the given product in your merchant account. The
+ * response might contain fewer items than specified by `pageSize`. If `pageToken` was returned in
+ * previous request, it can be used to obtain additional results.
+ *
+ * {@code
+ * // 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/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (RegionalInventoryServiceClient regionalInventoryServiceClient =
+ * RegionalInventoryServiceClient.create()) {
+ * ListRegionalInventoriesRequest request =
+ * ListRegionalInventoriesRequest.newBuilder()
+ * .setParent("parent-995424086")
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .build();
+ * for (RegionalInventory element :
+ * regionalInventoryServiceClient.listRegionalInventories(request).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListRegionalInventoriesPagedResponse listRegionalInventories(
+ ListRegionalInventoriesRequest request) {
+ return listRegionalInventoriesPagedCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Lists the `RegionalInventory` resources for the given product in your merchant account. The
+ * response might contain fewer items than specified by `pageSize`. If `pageToken` was returned in
+ * previous request, it can be used to obtain additional results.
+ *
+ * {@code
+ * // 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/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (RegionalInventoryServiceClient regionalInventoryServiceClient =
+ * RegionalInventoryServiceClient.create()) {
+ * ListRegionalInventoriesRequest request =
+ * ListRegionalInventoriesRequest.newBuilder()
+ * .setParent("parent-995424086")
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .build();
+ * ApiFuture
+ */
+ public final UnaryCallable{@code
+ * // 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/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (RegionalInventoryServiceClient regionalInventoryServiceClient =
+ * RegionalInventoryServiceClient.create()) {
+ * ListRegionalInventoriesRequest request =
+ * ListRegionalInventoriesRequest.newBuilder()
+ * .setParent("parent-995424086")
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .build();
+ * while (true) {
+ * ListRegionalInventoriesResponse response =
+ * regionalInventoryServiceClient.listRegionalInventoriesCallable().call(request);
+ * for (RegionalInventory element : response.getRegionalInventoriesList()) {
+ * // doThingsWith(element);
+ * }
+ * String nextPageToken = response.getNextPageToken();
+ * if (!Strings.isNullOrEmpty(nextPageToken)) {
+ * request = request.toBuilder().setPageToken(nextPageToken).build();
+ * } else {
+ * break;
+ * }
+ * }
+ * }
+ * }
+ */
+ public final UnaryCallable{@code
+ * // 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/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (RegionalInventoryServiceClient regionalInventoryServiceClient =
+ * RegionalInventoryServiceClient.create()) {
+ * InsertRegionalInventoryRequest request =
+ * InsertRegionalInventoryRequest.newBuilder()
+ * .setParent("parent-995424086")
+ * .setRegionalInventory(RegionalInventory.newBuilder().build())
+ * .build();
+ * RegionalInventory response = regionalInventoryServiceClient.insertRegionalInventory(request);
+ * }
+ * }
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final RegionalInventory insertRegionalInventory(InsertRegionalInventoryRequest request) {
+ return insertRegionalInventoryCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Inserts a `RegionalInventory` to a given product in your merchant account.
+ *
+ * {@code
+ * // 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/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (RegionalInventoryServiceClient regionalInventoryServiceClient =
+ * RegionalInventoryServiceClient.create()) {
+ * InsertRegionalInventoryRequest request =
+ * InsertRegionalInventoryRequest.newBuilder()
+ * .setParent("parent-995424086")
+ * .setRegionalInventory(RegionalInventory.newBuilder().build())
+ * .build();
+ * ApiFuture
+ */
+ public final UnaryCallable{@code
+ * // 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/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (RegionalInventoryServiceClient regionalInventoryServiceClient =
+ * RegionalInventoryServiceClient.create()) {
+ * RegionalInventoryName name = RegionalInventoryName.of("[ACCOUNT]", "[PRODUCT]", "[REGION]");
+ * regionalInventoryServiceClient.deleteRegionalInventory(name);
+ * }
+ * }
+ *
+ * @param name Required. The name of the `RegionalInventory` resource to delete. Format:
+ * `accounts/{account}/products/{product}/regionalInventories/{region}`
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final void deleteRegionalInventory(RegionalInventoryName name) {
+ DeleteRegionalInventoryRequest request =
+ DeleteRegionalInventoryRequest.newBuilder()
+ .setName(name == null ? null : name.toString())
+ .build();
+ deleteRegionalInventory(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Deletes the specified `RegionalInventory` resource from the given product in your merchant
+ * account. It might take up to an hour for the `RegionalInventory` to be deleted from the
+ * specific product. Once you have received a successful delete response, wait for that period
+ * before attempting a delete again.
+ *
+ * {@code
+ * // 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/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (RegionalInventoryServiceClient regionalInventoryServiceClient =
+ * RegionalInventoryServiceClient.create()) {
+ * String name = RegionalInventoryName.of("[ACCOUNT]", "[PRODUCT]", "[REGION]").toString();
+ * regionalInventoryServiceClient.deleteRegionalInventory(name);
+ * }
+ * }
+ *
+ * @param name Required. The name of the `RegionalInventory` resource to delete. Format:
+ * `accounts/{account}/products/{product}/regionalInventories/{region}`
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final void deleteRegionalInventory(String name) {
+ DeleteRegionalInventoryRequest request =
+ DeleteRegionalInventoryRequest.newBuilder().setName(name).build();
+ deleteRegionalInventory(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Deletes the specified `RegionalInventory` resource from the given product in your merchant
+ * account. It might take up to an hour for the `RegionalInventory` to be deleted from the
+ * specific product. Once you have received a successful delete response, wait for that period
+ * before attempting a delete again.
+ *
+ * {@code
+ * // 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/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (RegionalInventoryServiceClient regionalInventoryServiceClient =
+ * RegionalInventoryServiceClient.create()) {
+ * DeleteRegionalInventoryRequest request =
+ * DeleteRegionalInventoryRequest.newBuilder()
+ * .setName(RegionalInventoryName.of("[ACCOUNT]", "[PRODUCT]", "[REGION]").toString())
+ * .build();
+ * regionalInventoryServiceClient.deleteRegionalInventory(request);
+ * }
+ * }
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final void deleteRegionalInventory(DeleteRegionalInventoryRequest request) {
+ deleteRegionalInventoryCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Deletes the specified `RegionalInventory` resource from the given product in your merchant
+ * account. It might take up to an hour for the `RegionalInventory` to be deleted from the
+ * specific product. Once you have received a successful delete response, wait for that period
+ * before attempting a delete again.
+ *
+ * {@code
+ * // 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/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (RegionalInventoryServiceClient regionalInventoryServiceClient =
+ * RegionalInventoryServiceClient.create()) {
+ * DeleteRegionalInventoryRequest request =
+ * DeleteRegionalInventoryRequest.newBuilder()
+ * .setName(RegionalInventoryName.of("[ACCOUNT]", "[PRODUCT]", "[REGION]").toString())
+ * .build();
+ * ApiFuture
+ */
+ public final UnaryCallable
+ *
+ *
+ * {@code
+ * // 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/java/docs/setup#configure_endpoints_for_the_client_library
+ * RegionalInventoryServiceSettings.Builder regionalInventoryServiceSettingsBuilder =
+ * RegionalInventoryServiceSettings.newBuilder();
+ * regionalInventoryServiceSettingsBuilder
+ * .insertRegionalInventorySettings()
+ * .setRetrySettings(
+ * regionalInventoryServiceSettingsBuilder
+ * .insertRegionalInventorySettings()
+ * .getRetrySettings()
+ * .toBuilder()
+ * .setTotalTimeout(Duration.ofSeconds(30))
+ * .build());
+ * RegionalInventoryServiceSettings regionalInventoryServiceSettings =
+ * regionalInventoryServiceSettingsBuilder.build();
+ * }
+ */
+@BetaApi
+@Generated("by gapic-generator-java")
+public class RegionalInventoryServiceSettings
+ extends ClientSettings{@code
+ * // 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/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (LocalInventoryServiceClient localInventoryServiceClient =
+ * LocalInventoryServiceClient.create()) {
+ * InsertLocalInventoryRequest request =
+ * InsertLocalInventoryRequest.newBuilder()
+ * .setParent("parent-995424086")
+ * .setLocalInventory(LocalInventory.newBuilder().build())
+ * .build();
+ * LocalInventory response = localInventoryServiceClient.insertLocalInventory(request);
+ * }
+ * }
+ *
+ * {@code
+ * // 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/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (RegionalInventoryServiceClient regionalInventoryServiceClient =
+ * RegionalInventoryServiceClient.create()) {
+ * InsertRegionalInventoryRequest request =
+ * InsertRegionalInventoryRequest.newBuilder()
+ * .setParent("parent-995424086")
+ * .setRegionalInventory(RegionalInventory.newBuilder().build())
+ * .build();
+ * RegionalInventory response = regionalInventoryServiceClient.insertRegionalInventory(request);
+ * }
+ * }
+ */
+@Generated("by gapic-generator-java")
+package com.google.shopping.merchant.inventories.v1beta;
+
+import javax.annotation.Generated;
diff --git a/java-merchantapi/google-shopping-merchant-inventories/src/main/java/com/google/shopping/merchant/inventories/v1beta/stub/GrpcLocalInventoryServiceCallableFactory.java b/java-merchantapi/google-shopping-merchant-inventories/src/main/java/com/google/shopping/merchant/inventories/v1beta/stub/GrpcLocalInventoryServiceCallableFactory.java
new file mode 100644
index 000000000000..b0eb2ccd0e0a
--- /dev/null
+++ b/java-merchantapi/google-shopping-merchant-inventories/src/main/java/com/google/shopping/merchant/inventories/v1beta/stub/GrpcLocalInventoryServiceCallableFactory.java
@@ -0,0 +1,115 @@
+/*
+ * Copyright 2023 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.shopping.merchant.inventories.v1beta.stub;
+
+import com.google.api.core.BetaApi;
+import com.google.api.gax.grpc.GrpcCallSettings;
+import com.google.api.gax.grpc.GrpcCallableFactory;
+import com.google.api.gax.grpc.GrpcStubCallableFactory;
+import com.google.api.gax.rpc.BatchingCallSettings;
+import com.google.api.gax.rpc.BidiStreamingCallable;
+import com.google.api.gax.rpc.ClientContext;
+import com.google.api.gax.rpc.ClientStreamingCallable;
+import com.google.api.gax.rpc.OperationCallSettings;
+import com.google.api.gax.rpc.OperationCallable;
+import com.google.api.gax.rpc.PagedCallSettings;
+import com.google.api.gax.rpc.ServerStreamingCallSettings;
+import com.google.api.gax.rpc.ServerStreamingCallable;
+import com.google.api.gax.rpc.StreamingCallSettings;
+import com.google.api.gax.rpc.UnaryCallSettings;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.longrunning.Operation;
+import com.google.longrunning.stub.OperationsStub;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * gRPC callable factory implementation for the LocalInventoryService service API.
+ *
+ *