Class ProductReviewsServiceClient (0.1.0)

GitHub RepositoryProduct Reference

Service Description: Service to manage product reviews.

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 (ProductReviewsServiceClient productReviewsServiceClient =
     ProductReviewsServiceClient.create()) {
   ProductReviewName name = ProductReviewName.of("[ACCOUNT]", "[PRODUCTREVIEW]");
   ProductReview response = productReviewsServiceClient.getProductReview(name);
 }
 

Note: close() needs to be called on the ProductReviewsServiceClient 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

GetProductReview

Gets a product review.

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

  • getProductReview(GetProductReviewRequest request)

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

  • getProductReview(ProductReviewName name)

  • getProductReview(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.

  • getProductReviewCallable()

ListProductReviews

Lists product reviews.

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

  • listProductReviews(ListProductReviewsRequest request)

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

  • listProductReviews(AccountName parent)

  • listProductReviews(String parent)

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

  • listProductReviewsPagedCallable()

  • listProductReviewsCallable()

InsertProductReview

Inserts a product review.

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

  • insertProductReview(InsertProductReviewRequest request)

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

  • insertProductReviewCallable()

DeleteProductReview

Deletes a product review.

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

  • deleteProductReview(DeleteProductReviewRequest request)

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

  • deleteProductReview(ProductReviewName name)

  • deleteProductReview(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.

  • deleteProductReviewCallable()

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 ProductReviewsServiceSettings 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
 ProductReviewsServiceSettings productReviewsServiceSettings =
     ProductReviewsServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 ProductReviewsServiceClient productReviewsServiceClient =
     ProductReviewsServiceClient.create(productReviewsServiceSettings);
 

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
 ProductReviewsServiceSettings productReviewsServiceSettings =
     ProductReviewsServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 ProductReviewsServiceClient productReviewsServiceClient =
     ProductReviewsServiceClient.create(productReviewsServiceSettings);
 

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
 ProductReviewsServiceSettings productReviewsServiceSettings =
     ProductReviewsServiceSettings.newHttpJsonBuilder().build();
 ProductReviewsServiceClient productReviewsServiceClient =
     ProductReviewsServiceClient.create(productReviewsServiceSettings);
 

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

Inheritance

java.lang.Object > ProductReviewsServiceClient

Static Methods

create()

public static final ProductReviewsServiceClient create()

Constructs an instance of ProductReviewsServiceClient with default settings.

Returns
Type Description
ProductReviewsServiceClient
Exceptions
Type Description
IOException

create(ProductReviewsServiceSettings settings)

public static final ProductReviewsServiceClient create(ProductReviewsServiceSettings settings)

Constructs an instance of ProductReviewsServiceClient, 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 ProductReviewsServiceSettings
Returns
Type Description
ProductReviewsServiceClient
Exceptions
Type Description
IOException

create(ProductReviewsServiceStub stub)

public static final ProductReviewsServiceClient create(ProductReviewsServiceStub stub)

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

Parameter
Name Description
stub ProductReviewsServiceStub
Returns
Type Description
ProductReviewsServiceClient

Constructors

ProductReviewsServiceClient(ProductReviewsServiceSettings settings)

protected ProductReviewsServiceClient(ProductReviewsServiceSettings settings)

Constructs an instance of ProductReviewsServiceClient, 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 ProductReviewsServiceSettings

ProductReviewsServiceClient(ProductReviewsServiceStub stub)

protected ProductReviewsServiceClient(ProductReviewsServiceStub stub)
Parameter
Name Description
stub ProductReviewsServiceStub

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()

deleteProductReview(DeleteProductReviewRequest request)

public final void deleteProductReview(DeleteProductReviewRequest request)

Deletes a product review.

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 (ProductReviewsServiceClient productReviewsServiceClient =
     ProductReviewsServiceClient.create()) {
   DeleteProductReviewRequest request =
       DeleteProductReviewRequest.newBuilder()
           .setName(ProductReviewName.of("[ACCOUNT]", "[PRODUCTREVIEW]").toString())
           .build();
   productReviewsServiceClient.deleteProductReview(request);
 }
 
Parameter
Name Description
request DeleteProductReviewRequest

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

deleteProductReview(ProductReviewName name)

public final void deleteProductReview(ProductReviewName name)

Deletes a product review.

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 (ProductReviewsServiceClient productReviewsServiceClient =
     ProductReviewsServiceClient.create()) {
   ProductReviewName name = ProductReviewName.of("[ACCOUNT]", "[PRODUCTREVIEW]");
   productReviewsServiceClient.deleteProductReview(name);
 }
 
Parameter
Name Description
name ProductReviewName

Required. The ID of the Product review. Format: accounts/{account}/productReviews/{productReview}

deleteProductReview(String name)

public final void deleteProductReview(String name)

Deletes a product review.

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 (ProductReviewsServiceClient productReviewsServiceClient =
     ProductReviewsServiceClient.create()) {
   String name = ProductReviewName.of("[ACCOUNT]", "[PRODUCTREVIEW]").toString();
   productReviewsServiceClient.deleteProductReview(name);
 }
 
Parameter
Name Description
name String

Required. The ID of the Product review. Format: accounts/{account}/productReviews/{productReview}

deleteProductReviewCallable()

public final UnaryCallable<DeleteProductReviewRequest,Empty> deleteProductReviewCallable()

Deletes a product review.

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 (ProductReviewsServiceClient productReviewsServiceClient =
     ProductReviewsServiceClient.create()) {
   DeleteProductReviewRequest request =
       DeleteProductReviewRequest.newBuilder()
           .setName(ProductReviewName.of("[ACCOUNT]", "[PRODUCTREVIEW]").toString())
           .build();
   ApiFuture<Empty> future =
       productReviewsServiceClient.deleteProductReviewCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
Type Description
UnaryCallable<DeleteProductReviewRequest,Empty>

getProductReview(GetProductReviewRequest request)

public final ProductReview getProductReview(GetProductReviewRequest request)

Gets a product review.

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 (ProductReviewsServiceClient productReviewsServiceClient =
     ProductReviewsServiceClient.create()) {
   GetProductReviewRequest request =
       GetProductReviewRequest.newBuilder()
           .setName(ProductReviewName.of("[ACCOUNT]", "[PRODUCTREVIEW]").toString())
           .build();
   ProductReview response = productReviewsServiceClient.getProductReview(request);
 }
 
Parameter
Name Description
request GetProductReviewRequest

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

Returns
Type Description
ProductReview

getProductReview(ProductReviewName name)

public final ProductReview getProductReview(ProductReviewName name)

Gets a product review.

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 (ProductReviewsServiceClient productReviewsServiceClient =
     ProductReviewsServiceClient.create()) {
   ProductReviewName name = ProductReviewName.of("[ACCOUNT]", "[PRODUCTREVIEW]");
   ProductReview response = productReviewsServiceClient.getProductReview(name);
 }
 
Parameter
Name Description
name ProductReviewName

Required. The ID of the merchant review. Format: accounts/{account}/productReviews/{productReview}

Returns
Type Description
ProductReview

getProductReview(String name)

public final ProductReview getProductReview(String name)

Gets a product review.

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 (ProductReviewsServiceClient productReviewsServiceClient =
     ProductReviewsServiceClient.create()) {
   String name = ProductReviewName.of("[ACCOUNT]", "[PRODUCTREVIEW]").toString();
   ProductReview response = productReviewsServiceClient.getProductReview(name);
 }
 
Parameter
Name Description
name String

Required. The ID of the merchant review. Format: accounts/{account}/productReviews/{productReview}

Returns
Type Description
ProductReview

getProductReviewCallable()

public final UnaryCallable<GetProductReviewRequest,ProductReview> getProductReviewCallable()

Gets a product review.

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 (ProductReviewsServiceClient productReviewsServiceClient =
     ProductReviewsServiceClient.create()) {
   GetProductReviewRequest request =
       GetProductReviewRequest.newBuilder()
           .setName(ProductReviewName.of("[ACCOUNT]", "[PRODUCTREVIEW]").toString())
           .build();
   ApiFuture<ProductReview> future =
       productReviewsServiceClient.getProductReviewCallable().futureCall(request);
   // Do something.
   ProductReview response = future.get();
 }
 
Returns
Type Description
UnaryCallable<GetProductReviewRequest,ProductReview>

getSettings()

public final ProductReviewsServiceSettings getSettings()
Returns
Type Description
ProductReviewsServiceSettings

getStub()

public ProductReviewsServiceStub getStub()
Returns
Type Description
ProductReviewsServiceStub

insertProductReview(InsertProductReviewRequest request)

public final ProductReview insertProductReview(InsertProductReviewRequest request)

Inserts a product review.

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 (ProductReviewsServiceClient productReviewsServiceClient =
     ProductReviewsServiceClient.create()) {
   InsertProductReviewRequest request =
       InsertProductReviewRequest.newBuilder()
           .setParent("parent-995424086")
           .setProductReview(ProductReview.newBuilder().build())
           .setDataSource("dataSource1272470629")
           .build();
   ProductReview response = productReviewsServiceClient.insertProductReview(request);
 }
 
Parameter
Name Description
request InsertProductReviewRequest

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

Returns
Type Description
ProductReview

insertProductReviewCallable()

public final UnaryCallable<InsertProductReviewRequest,ProductReview> insertProductReviewCallable()

Inserts a product review.

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 (ProductReviewsServiceClient productReviewsServiceClient =
     ProductReviewsServiceClient.create()) {
   InsertProductReviewRequest request =
       InsertProductReviewRequest.newBuilder()
           .setParent("parent-995424086")
           .setProductReview(ProductReview.newBuilder().build())
           .setDataSource("dataSource1272470629")
           .build();
   ApiFuture<ProductReview> future =
       productReviewsServiceClient.insertProductReviewCallable().futureCall(request);
   // Do something.
   ProductReview response = future.get();
 }
 
Returns
Type Description
UnaryCallable<InsertProductReviewRequest,ProductReview>

isShutdown()

public boolean isShutdown()
Returns
Type Description
boolean

isTerminated()

public boolean isTerminated()
Returns
Type Description
boolean

listProductReviews(AccountName parent)

public final ProductReviewsServiceClient.ListProductReviewsPagedResponse listProductReviews(AccountName parent)

Lists product reviews.

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 (ProductReviewsServiceClient productReviewsServiceClient =
     ProductReviewsServiceClient.create()) {
   AccountName parent = AccountName.of("[ACCOUNT]");
   for (ProductReview element :
       productReviewsServiceClient.listProductReviews(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent AccountName

Required. The account to list product reviews for. Format: accounts/{account}

Returns
Type Description
ProductReviewsServiceClient.ListProductReviewsPagedResponse

listProductReviews(ListProductReviewsRequest request)

public final ProductReviewsServiceClient.ListProductReviewsPagedResponse listProductReviews(ListProductReviewsRequest request)

Lists product reviews.

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 (ProductReviewsServiceClient productReviewsServiceClient =
     ProductReviewsServiceClient.create()) {
   ListProductReviewsRequest request =
       ListProductReviewsRequest.newBuilder()
           .setParent(AccountName.of("[ACCOUNT]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   for (ProductReview element :
       productReviewsServiceClient.listProductReviews(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
request ListProductReviewsRequest

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

Returns
Type Description
ProductReviewsServiceClient.ListProductReviewsPagedResponse

listProductReviews(String parent)

public final ProductReviewsServiceClient.ListProductReviewsPagedResponse listProductReviews(String parent)

Lists product reviews.

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 (ProductReviewsServiceClient productReviewsServiceClient =
     ProductReviewsServiceClient.create()) {
   String parent = AccountName.of("[ACCOUNT]").toString();
   for (ProductReview element :
       productReviewsServiceClient.listProductReviews(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent String

Required. The account to list product reviews for. Format: accounts/{account}

Returns
Type Description
ProductReviewsServiceClient.ListProductReviewsPagedResponse

listProductReviewsCallable()

public final UnaryCallable<ListProductReviewsRequest,ListProductReviewsResponse> listProductReviewsCallable()

Lists product reviews.

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 (ProductReviewsServiceClient productReviewsServiceClient =
     ProductReviewsServiceClient.create()) {
   ListProductReviewsRequest request =
       ListProductReviewsRequest.newBuilder()
           .setParent(AccountName.of("[ACCOUNT]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   while (true) {
     ListProductReviewsResponse response =
         productReviewsServiceClient.listProductReviewsCallable().call(request);
     for (ProductReview element : response.getProductReviewsList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<ListProductReviewsRequest,ListProductReviewsResponse>

listProductReviewsPagedCallable()

public final UnaryCallable<ListProductReviewsRequest,ProductReviewsServiceClient.ListProductReviewsPagedResponse> listProductReviewsPagedCallable()

Lists product reviews.

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 (ProductReviewsServiceClient productReviewsServiceClient =
     ProductReviewsServiceClient.create()) {
   ListProductReviewsRequest request =
       ListProductReviewsRequest.newBuilder()
           .setParent(AccountName.of("[ACCOUNT]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   ApiFuture<ProductReview> future =
       productReviewsServiceClient.listProductReviewsPagedCallable().futureCall(request);
   // Do something.
   for (ProductReview element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
Type Description
UnaryCallable<ListProductReviewsRequest,ListProductReviewsPagedResponse>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()