Class ProductInputsServiceClient (0.4.0)

GitHub RepositoryProduct Reference

Service Description: Service to use ProductInput resource. This service works for products with online channel only.

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:


 // 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 (ProductInputsServiceClient productInputsServiceClient =
     ProductInputsServiceClient.create()) {
   InsertProductInputRequest request =
       InsertProductInputRequest.newBuilder()
           .setParent(AccountName.of("[ACCOUNT]").toString())
           .setProductInput(ProductInput.newBuilder().build())
           .setDataSource("dataSource1272470629")
           .build();
   ProductInput response = productInputsServiceClient.insertProductInput(request);
 }
 

Note: close() needs to be called on the ProductInputsServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

Methods
Method Description Method Variants

InsertProductInput

Uploads a product input to your Merchant Center account. If an input with the same contentLanguage, offerId, and dataSource already exists, this method replaces that entry.

After inserting, updating, or deleting a product input, it may take several minutes before the processed product can be retrieved.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • insertProductInput(InsertProductInputRequest request)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • insertProductInputCallable()

DeleteProductInput

Deletes a product input from your Merchant Center account.

After inserting, updating, or deleting a product input, it may take several minutes before the processed product can be retrieved.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • deleteProductInput(DeleteProductInputRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • deleteProductInput(ProductInputName name)

  • deleteProductInput(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • deleteProductInputCallable()

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 ProductInputsServiceSettings to create(). For example:

To customize credentials:


 // 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
 ProductInputsServiceSettings productInputsServiceSettings =
     ProductInputsServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 ProductInputsServiceClient productInputsServiceClient =
     ProductInputsServiceClient.create(productInputsServiceSettings);
 

To customize the endpoint:


 // 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
 ProductInputsServiceSettings productInputsServiceSettings =
     ProductInputsServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 ProductInputsServiceClient productInputsServiceClient =
     ProductInputsServiceClient.create(productInputsServiceSettings);
 

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:


 // 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
 ProductInputsServiceSettings productInputsServiceSettings =
     ProductInputsServiceSettings.newHttpJsonBuilder().build();
 ProductInputsServiceClient productInputsServiceClient =
     ProductInputsServiceClient.create(productInputsServiceSettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

Inheritance

java.lang.Object > ProductInputsServiceClient

Static Methods

create()

public static final ProductInputsServiceClient create()

Constructs an instance of ProductInputsServiceClient with default settings.

Returns
Type Description
ProductInputsServiceClient
Exceptions
Type Description
IOException

create(ProductInputsServiceSettings settings)

public static final ProductInputsServiceClient create(ProductInputsServiceSettings settings)

Constructs an instance of ProductInputsServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.

Parameter
Name Description
settings ProductInputsServiceSettings
Returns
Type Description
ProductInputsServiceClient
Exceptions
Type Description
IOException

create(ProductInputsServiceStub stub)

public static final ProductInputsServiceClient create(ProductInputsServiceStub stub)

Constructs an instance of ProductInputsServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(ProductInputsServiceSettings).

Parameter
Name Description
stub ProductInputsServiceStub
Returns
Type Description
ProductInputsServiceClient

Constructors

ProductInputsServiceClient(ProductInputsServiceSettings settings)

protected ProductInputsServiceClient(ProductInputsServiceSettings settings)

Constructs an instance of ProductInputsServiceClient, 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.

Parameter
Name Description
settings ProductInputsServiceSettings

ProductInputsServiceClient(ProductInputsServiceStub stub)

protected ProductInputsServiceClient(ProductInputsServiceStub stub)
Parameter
Name Description
stub ProductInputsServiceStub

Methods

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
Name Description
duration long
unit TimeUnit
Returns
Type Description
boolean
Exceptions
Type Description
InterruptedException

close()

public final void close()

deleteProductInput(DeleteProductInputRequest request)

public final void deleteProductInput(DeleteProductInputRequest request)

Deletes a product input from your Merchant Center account.

After inserting, updating, or deleting a product input, it may take several minutes before the processed product can be retrieved.

Sample 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 (ProductInputsServiceClient productInputsServiceClient =
     ProductInputsServiceClient.create()) {
   DeleteProductInputRequest request =
       DeleteProductInputRequest.newBuilder()
           .setName(ProductInputName.of("[ACCOUNT]", "[PRODUCTINPUT]").toString())
           .setDataSource("dataSource1272470629")
           .build();
   productInputsServiceClient.deleteProductInput(request);
 }
 
Parameter
Name Description
request DeleteProductInputRequest

The request object containing all of the parameters for the API call.

deleteProductInput(ProductInputName name)

public final void deleteProductInput(ProductInputName name)

Deletes a product input from your Merchant Center account.

After inserting, updating, or deleting a product input, it may take several minutes before the processed product can be retrieved.

Sample 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 (ProductInputsServiceClient productInputsServiceClient =
     ProductInputsServiceClient.create()) {
   ProductInputName name = ProductInputName.of("[ACCOUNT]", "[PRODUCTINPUT]");
   productInputsServiceClient.deleteProductInput(name);
 }
 
Parameter
Name Description
name ProductInputName

Required. The name of the product input resource to delete. Format: accounts/{account}/productInputs/{product}

deleteProductInput(String name)

public final void deleteProductInput(String name)

Deletes a product input from your Merchant Center account.

After inserting, updating, or deleting a product input, it may take several minutes before the processed product can be retrieved.

Sample 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 (ProductInputsServiceClient productInputsServiceClient =
     ProductInputsServiceClient.create()) {
   String name = ProductInputName.of("[ACCOUNT]", "[PRODUCTINPUT]").toString();
   productInputsServiceClient.deleteProductInput(name);
 }
 
Parameter
Name Description
name String

Required. The name of the product input resource to delete. Format: accounts/{account}/productInputs/{product}

deleteProductInputCallable()

public final UnaryCallable<DeleteProductInputRequest,Empty> deleteProductInputCallable()

Deletes a product input from your Merchant Center account.

After inserting, updating, or deleting a product input, it may take several minutes before the processed product can be retrieved.

Sample 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 (ProductInputsServiceClient productInputsServiceClient =
     ProductInputsServiceClient.create()) {
   DeleteProductInputRequest request =
       DeleteProductInputRequest.newBuilder()
           .setName(ProductInputName.of("[ACCOUNT]", "[PRODUCTINPUT]").toString())
           .setDataSource("dataSource1272470629")
           .build();
   ApiFuture<Empty> future =
       productInputsServiceClient.deleteProductInputCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
Type Description
UnaryCallable<DeleteProductInputRequest,Empty>

getSettings()

public final ProductInputsServiceSettings getSettings()
Returns
Type Description
ProductInputsServiceSettings

getStub()

public ProductInputsServiceStub getStub()
Returns
Type Description
ProductInputsServiceStub

insertProductInput(InsertProductInputRequest request)

public final ProductInput insertProductInput(InsertProductInputRequest request)

Uploads a product input to your Merchant Center account. If an input with the same contentLanguage, offerId, and dataSource already exists, this method replaces that entry.

After inserting, updating, or deleting a product input, it may take several minutes before the processed product can be retrieved.

Sample 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 (ProductInputsServiceClient productInputsServiceClient =
     ProductInputsServiceClient.create()) {
   InsertProductInputRequest request =
       InsertProductInputRequest.newBuilder()
           .setParent(AccountName.of("[ACCOUNT]").toString())
           .setProductInput(ProductInput.newBuilder().build())
           .setDataSource("dataSource1272470629")
           .build();
   ProductInput response = productInputsServiceClient.insertProductInput(request);
 }
 
Parameter
Name Description
request InsertProductInputRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
ProductInput

insertProductInputCallable()

public final UnaryCallable<InsertProductInputRequest,ProductInput> insertProductInputCallable()

Uploads a product input to your Merchant Center account. If an input with the same contentLanguage, offerId, and dataSource already exists, this method replaces that entry.

After inserting, updating, or deleting a product input, it may take several minutes before the processed product can be retrieved.

Sample 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 (ProductInputsServiceClient productInputsServiceClient =
     ProductInputsServiceClient.create()) {
   InsertProductInputRequest request =
       InsertProductInputRequest.newBuilder()
           .setParent(AccountName.of("[ACCOUNT]").toString())
           .setProductInput(ProductInput.newBuilder().build())
           .setDataSource("dataSource1272470629")
           .build();
   ApiFuture<ProductInput> future =
       productInputsServiceClient.insertProductInputCallable().futureCall(request);
   // Do something.
   ProductInput response = future.get();
 }
 
Returns
Type Description
UnaryCallable<InsertProductInputRequest,ProductInput>

isShutdown()

public boolean isShutdown()
Returns
Type Description
boolean

isTerminated()

public boolean isTerminated()
Returns
Type Description
boolean

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()