Class NotificationsApiServiceClient (0.7.0)

GitHub RepositoryProduct Reference

Service Description: Service to manage notification subscriptions for merchants

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 (NotificationsApiServiceClient notificationsApiServiceClient =
     NotificationsApiServiceClient.create()) {
   NotificationSubscriptionName name =
       NotificationSubscriptionName.of("[ACCOUNT]", "[NOTIFICATION_SUBSCRIPTION]");
   NotificationSubscription response =
       notificationsApiServiceClient.getNotificationSubscription(name);
 }
 

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

GetNotificationSubscription

Gets notification subscriptions for an account.

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

  • getNotificationSubscription(GetNotificationSubscriptionRequest request)

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

  • getNotificationSubscription(NotificationSubscriptionName name)

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

  • getNotificationSubscriptionCallable()

CreateNotificationSubscription

Creates a notification subscription for a merchant. We will allow the following types of notification subscriptions to exist together (per merchant as a subscriber per event type): 1. Subscription for all managed accounts + subscription for self 2. Multiple "partial" subscriptions for managed accounts + subscription for self

we will not allow (per merchant as a subscriber per event type): 1. multiple self subscriptions. 2. multiple "all managed accounts" subscriptions. 3. all and partial subscriptions at the same time. 4. multiple partial subscriptions for the same target account

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

  • createNotificationSubscription(CreateNotificationSubscriptionRequest request)

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

  • createNotificationSubscription(AccountName parent, NotificationSubscription notificationSubscription)

  • createNotificationSubscription(String parent, NotificationSubscription notificationSubscription)

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

  • createNotificationSubscriptionCallable()

UpdateNotificationSubscription

Updates an existing notification subscription for a merchant.

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

  • updateNotificationSubscription(UpdateNotificationSubscriptionRequest request)

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

  • updateNotificationSubscription(NotificationSubscription notificationSubscription, FieldMask updateMask)

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

  • updateNotificationSubscriptionCallable()

DeleteNotificationSubscription

Deletes a notification subscription for a merchant.

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

  • deleteNotificationSubscription(DeleteNotificationSubscriptionRequest request)

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

  • deleteNotificationSubscription(NotificationSubscriptionName name)

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

  • deleteNotificationSubscriptionCallable()

ListNotificationSubscriptions

Gets all the notification subscriptions for a merchant.

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

  • listNotificationSubscriptions(ListNotificationSubscriptionsRequest request)

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

  • listNotificationSubscriptions(AccountName parent)

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

  • listNotificationSubscriptionsPagedCallable()

  • listNotificationSubscriptionsCallable()

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 NotificationsApiServiceSettings 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
 NotificationsApiServiceSettings notificationsApiServiceSettings =
     NotificationsApiServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 NotificationsApiServiceClient notificationsApiServiceClient =
     NotificationsApiServiceClient.create(notificationsApiServiceSettings);
 

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
 NotificationsApiServiceSettings notificationsApiServiceSettings =
     NotificationsApiServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 NotificationsApiServiceClient notificationsApiServiceClient =
     NotificationsApiServiceClient.create(notificationsApiServiceSettings);
 

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
 NotificationsApiServiceSettings notificationsApiServiceSettings =
     NotificationsApiServiceSettings.newHttpJsonBuilder().build();
 NotificationsApiServiceClient notificationsApiServiceClient =
     NotificationsApiServiceClient.create(notificationsApiServiceSettings);
 

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

Inheritance

java.lang.Object > NotificationsApiServiceClient

Static Methods

create()

public static final NotificationsApiServiceClient create()

Constructs an instance of NotificationsApiServiceClient with default settings.

Returns
Type Description
NotificationsApiServiceClient
Exceptions
Type Description
IOException

create(NotificationsApiServiceSettings settings)

public static final NotificationsApiServiceClient create(NotificationsApiServiceSettings settings)

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

create(NotificationsApiServiceStub stub)

public static final NotificationsApiServiceClient create(NotificationsApiServiceStub stub)

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

Parameter
Name Description
stub NotificationsApiServiceStub
Returns
Type Description
NotificationsApiServiceClient

Constructors

NotificationsApiServiceClient(NotificationsApiServiceSettings settings)

protected NotificationsApiServiceClient(NotificationsApiServiceSettings settings)

Constructs an instance of NotificationsApiServiceClient, 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 NotificationsApiServiceSettings

NotificationsApiServiceClient(NotificationsApiServiceStub stub)

protected NotificationsApiServiceClient(NotificationsApiServiceStub stub)
Parameter
Name Description
stub NotificationsApiServiceStub

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

createNotificationSubscription(AccountName parent, NotificationSubscription notificationSubscription)

public final NotificationSubscription createNotificationSubscription(AccountName parent, NotificationSubscription notificationSubscription)

Creates a notification subscription for a merchant. We will allow the following types of notification subscriptions to exist together (per merchant as a subscriber per event type): 1. Subscription for all managed accounts + subscription for self 2. Multiple "partial" subscriptions for managed accounts + subscription for self

we will not allow (per merchant as a subscriber per event type): 1. multiple self subscriptions. 2. multiple "all managed accounts" subscriptions. 3. all and partial subscriptions at the same time. 4. multiple partial subscriptions for the same target account

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 (NotificationsApiServiceClient notificationsApiServiceClient =
     NotificationsApiServiceClient.create()) {
   AccountName parent = AccountName.of("[ACCOUNT]");
   NotificationSubscription notificationSubscription =
       NotificationSubscription.newBuilder().build();
   NotificationSubscription response =
       notificationsApiServiceClient.createNotificationSubscription(
           parent, notificationSubscription);
 }
 
Parameters
Name Description
parent AccountName

Required. The merchant account that owns the new notification subscription. Format: accounts/{account}

notificationSubscription NotificationSubscription

Required. The notification subscription to create.

Returns
Type Description
NotificationSubscription

createNotificationSubscription(CreateNotificationSubscriptionRequest request)

public final NotificationSubscription createNotificationSubscription(CreateNotificationSubscriptionRequest request)

Creates a notification subscription for a merchant. We will allow the following types of notification subscriptions to exist together (per merchant as a subscriber per event type): 1. Subscription for all managed accounts + subscription for self 2. Multiple "partial" subscriptions for managed accounts + subscription for self

we will not allow (per merchant as a subscriber per event type): 1. multiple self subscriptions. 2. multiple "all managed accounts" subscriptions. 3. all and partial subscriptions at the same time. 4. multiple partial subscriptions for the same target account

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 (NotificationsApiServiceClient notificationsApiServiceClient =
     NotificationsApiServiceClient.create()) {
   CreateNotificationSubscriptionRequest request =
       CreateNotificationSubscriptionRequest.newBuilder()
           .setParent(AccountName.of("[ACCOUNT]").toString())
           .setNotificationSubscription(NotificationSubscription.newBuilder().build())
           .build();
   NotificationSubscription response =
       notificationsApiServiceClient.createNotificationSubscription(request);
 }
 
Parameter
Name Description
request CreateNotificationSubscriptionRequest

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

Returns
Type Description
NotificationSubscription

createNotificationSubscription(String parent, NotificationSubscription notificationSubscription)

public final NotificationSubscription createNotificationSubscription(String parent, NotificationSubscription notificationSubscription)

Creates a notification subscription for a merchant. We will allow the following types of notification subscriptions to exist together (per merchant as a subscriber per event type): 1. Subscription for all managed accounts + subscription for self 2. Multiple "partial" subscriptions for managed accounts + subscription for self

we will not allow (per merchant as a subscriber per event type): 1. multiple self subscriptions. 2. multiple "all managed accounts" subscriptions. 3. all and partial subscriptions at the same time. 4. multiple partial subscriptions for the same target account

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 (NotificationsApiServiceClient notificationsApiServiceClient =
     NotificationsApiServiceClient.create()) {
   String parent = AccountName.of("[ACCOUNT]").toString();
   NotificationSubscription notificationSubscription =
       NotificationSubscription.newBuilder().build();
   NotificationSubscription response =
       notificationsApiServiceClient.createNotificationSubscription(
           parent, notificationSubscription);
 }
 
Parameters
Name Description
parent String

Required. The merchant account that owns the new notification subscription. Format: accounts/{account}

notificationSubscription NotificationSubscription

Required. The notification subscription to create.

Returns
Type Description
NotificationSubscription

createNotificationSubscriptionCallable()

public final UnaryCallable<CreateNotificationSubscriptionRequest,NotificationSubscription> createNotificationSubscriptionCallable()

Creates a notification subscription for a merchant. We will allow the following types of notification subscriptions to exist together (per merchant as a subscriber per event type): 1. Subscription for all managed accounts + subscription for self 2. Multiple "partial" subscriptions for managed accounts + subscription for self

we will not allow (per merchant as a subscriber per event type): 1. multiple self subscriptions. 2. multiple "all managed accounts" subscriptions. 3. all and partial subscriptions at the same time. 4. multiple partial subscriptions for the same target account

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 (NotificationsApiServiceClient notificationsApiServiceClient =
     NotificationsApiServiceClient.create()) {
   CreateNotificationSubscriptionRequest request =
       CreateNotificationSubscriptionRequest.newBuilder()
           .setParent(AccountName.of("[ACCOUNT]").toString())
           .setNotificationSubscription(NotificationSubscription.newBuilder().build())
           .build();
   ApiFuture<NotificationSubscription> future =
       notificationsApiServiceClient
           .createNotificationSubscriptionCallable()
           .futureCall(request);
   // Do something.
   NotificationSubscription response = future.get();
 }
 
Returns
Type Description
UnaryCallable<CreateNotificationSubscriptionRequest,NotificationSubscription>

deleteNotificationSubscription(DeleteNotificationSubscriptionRequest request)

public final void deleteNotificationSubscription(DeleteNotificationSubscriptionRequest request)

Deletes a notification subscription for a merchant.

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 (NotificationsApiServiceClient notificationsApiServiceClient =
     NotificationsApiServiceClient.create()) {
   DeleteNotificationSubscriptionRequest request =
       DeleteNotificationSubscriptionRequest.newBuilder()
           .setName(
               NotificationSubscriptionName.of("[ACCOUNT]", "[NOTIFICATION_SUBSCRIPTION]")
                   .toString())
           .build();
   notificationsApiServiceClient.deleteNotificationSubscription(request);
 }
 
Parameter
Name Description
request DeleteNotificationSubscriptionRequest

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

deleteNotificationSubscription(NotificationSubscriptionName name)

public final void deleteNotificationSubscription(NotificationSubscriptionName name)

Deletes a notification subscription for a merchant.

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 (NotificationsApiServiceClient notificationsApiServiceClient =
     NotificationsApiServiceClient.create()) {
   NotificationSubscriptionName name =
       NotificationSubscriptionName.of("[ACCOUNT]", "[NOTIFICATION_SUBSCRIPTION]");
   notificationsApiServiceClient.deleteNotificationSubscription(name);
 }
 
Parameter
Name Description
name NotificationSubscriptionName

Required. The name of the notification subscription to be deleted.

deleteNotificationSubscription(String name)

public final void deleteNotificationSubscription(String name)

Deletes a notification subscription for a merchant.

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 (NotificationsApiServiceClient notificationsApiServiceClient =
     NotificationsApiServiceClient.create()) {
   String name =
       NotificationSubscriptionName.of("[ACCOUNT]", "[NOTIFICATION_SUBSCRIPTION]").toString();
   notificationsApiServiceClient.deleteNotificationSubscription(name);
 }
 
Parameter
Name Description
name String

Required. The name of the notification subscription to be deleted.

deleteNotificationSubscriptionCallable()

public final UnaryCallable<DeleteNotificationSubscriptionRequest,Empty> deleteNotificationSubscriptionCallable()

Deletes a notification subscription for a merchant.

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 (NotificationsApiServiceClient notificationsApiServiceClient =
     NotificationsApiServiceClient.create()) {
   DeleteNotificationSubscriptionRequest request =
       DeleteNotificationSubscriptionRequest.newBuilder()
           .setName(
               NotificationSubscriptionName.of("[ACCOUNT]", "[NOTIFICATION_SUBSCRIPTION]")
                   .toString())
           .build();
   ApiFuture<Empty> future =
       notificationsApiServiceClient
           .deleteNotificationSubscriptionCallable()
           .futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
Type Description
UnaryCallable<DeleteNotificationSubscriptionRequest,Empty>

getNotificationSubscription(GetNotificationSubscriptionRequest request)

public final NotificationSubscription getNotificationSubscription(GetNotificationSubscriptionRequest request)

Gets notification subscriptions for an account.

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 (NotificationsApiServiceClient notificationsApiServiceClient =
     NotificationsApiServiceClient.create()) {
   GetNotificationSubscriptionRequest request =
       GetNotificationSubscriptionRequest.newBuilder()
           .setName(
               NotificationSubscriptionName.of("[ACCOUNT]", "[NOTIFICATION_SUBSCRIPTION]")
                   .toString())
           .build();
   NotificationSubscription response =
       notificationsApiServiceClient.getNotificationSubscription(request);
 }
 
Parameter
Name Description
request GetNotificationSubscriptionRequest

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

Returns
Type Description
NotificationSubscription

getNotificationSubscription(NotificationSubscriptionName name)

public final NotificationSubscription getNotificationSubscription(NotificationSubscriptionName name)

Gets notification subscriptions for an account.

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 (NotificationsApiServiceClient notificationsApiServiceClient =
     NotificationsApiServiceClient.create()) {
   NotificationSubscriptionName name =
       NotificationSubscriptionName.of("[ACCOUNT]", "[NOTIFICATION_SUBSCRIPTION]");
   NotificationSubscription response =
       notificationsApiServiceClient.getNotificationSubscription(name);
 }
 
Parameter
Name Description
name NotificationSubscriptionName

Required. The name of the notification subscription.

Returns
Type Description
NotificationSubscription

getNotificationSubscription(String name)

public final NotificationSubscription getNotificationSubscription(String name)

Gets notification subscriptions for an account.

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 (NotificationsApiServiceClient notificationsApiServiceClient =
     NotificationsApiServiceClient.create()) {
   String name =
       NotificationSubscriptionName.of("[ACCOUNT]", "[NOTIFICATION_SUBSCRIPTION]").toString();
   NotificationSubscription response =
       notificationsApiServiceClient.getNotificationSubscription(name);
 }
 
Parameter
Name Description
name String

Required. The name of the notification subscription.

Returns
Type Description
NotificationSubscription

getNotificationSubscriptionCallable()

public final UnaryCallable<GetNotificationSubscriptionRequest,NotificationSubscription> getNotificationSubscriptionCallable()

Gets notification subscriptions for an account.

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 (NotificationsApiServiceClient notificationsApiServiceClient =
     NotificationsApiServiceClient.create()) {
   GetNotificationSubscriptionRequest request =
       GetNotificationSubscriptionRequest.newBuilder()
           .setName(
               NotificationSubscriptionName.of("[ACCOUNT]", "[NOTIFICATION_SUBSCRIPTION]")
                   .toString())
           .build();
   ApiFuture<NotificationSubscription> future =
       notificationsApiServiceClient.getNotificationSubscriptionCallable().futureCall(request);
   // Do something.
   NotificationSubscription response = future.get();
 }
 
Returns
Type Description
UnaryCallable<GetNotificationSubscriptionRequest,NotificationSubscription>

getSettings()

public final NotificationsApiServiceSettings getSettings()
Returns
Type Description
NotificationsApiServiceSettings

getStub()

public NotificationsApiServiceStub getStub()
Returns
Type Description
NotificationsApiServiceStub

isShutdown()

public boolean isShutdown()
Returns
Type Description
boolean

isTerminated()

public boolean isTerminated()
Returns
Type Description
boolean

listNotificationSubscriptions(AccountName parent)

public final NotificationsApiServiceClient.ListNotificationSubscriptionsPagedResponse listNotificationSubscriptions(AccountName parent)

Gets all the notification subscriptions for a merchant.

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

Required. The merchant account who owns the notification subscriptions. Format: accounts/{account}

Returns
Type Description
NotificationsApiServiceClient.ListNotificationSubscriptionsPagedResponse

listNotificationSubscriptions(ListNotificationSubscriptionsRequest request)

public final NotificationsApiServiceClient.ListNotificationSubscriptionsPagedResponse listNotificationSubscriptions(ListNotificationSubscriptionsRequest request)

Gets all the notification subscriptions for a merchant.

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

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

Returns
Type Description
NotificationsApiServiceClient.ListNotificationSubscriptionsPagedResponse

listNotificationSubscriptions(String parent)

public final NotificationsApiServiceClient.ListNotificationSubscriptionsPagedResponse listNotificationSubscriptions(String parent)

Gets all the notification subscriptions for a merchant.

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

Required. The merchant account who owns the notification subscriptions. Format: accounts/{account}

Returns
Type Description
NotificationsApiServiceClient.ListNotificationSubscriptionsPagedResponse

listNotificationSubscriptionsCallable()

public final UnaryCallable<ListNotificationSubscriptionsRequest,ListNotificationSubscriptionsResponse> listNotificationSubscriptionsCallable()

Gets all the notification subscriptions for a merchant.

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 (NotificationsApiServiceClient notificationsApiServiceClient =
     NotificationsApiServiceClient.create()) {
   ListNotificationSubscriptionsRequest request =
       ListNotificationSubscriptionsRequest.newBuilder()
           .setParent(AccountName.of("[ACCOUNT]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   while (true) {
     ListNotificationSubscriptionsResponse response =
         notificationsApiServiceClient.listNotificationSubscriptionsCallable().call(request);
     for (NotificationSubscription element : response.getNotificationSubscriptionsList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<ListNotificationSubscriptionsRequest,ListNotificationSubscriptionsResponse>

listNotificationSubscriptionsPagedCallable()

public final UnaryCallable<ListNotificationSubscriptionsRequest,NotificationsApiServiceClient.ListNotificationSubscriptionsPagedResponse> listNotificationSubscriptionsPagedCallable()

Gets all the notification subscriptions for a merchant.

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

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

updateNotificationSubscription(NotificationSubscription notificationSubscription, FieldMask updateMask)

public final NotificationSubscription updateNotificationSubscription(NotificationSubscription notificationSubscription, FieldMask updateMask)

Updates an existing notification subscription for a merchant.

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 (NotificationsApiServiceClient notificationsApiServiceClient =
     NotificationsApiServiceClient.create()) {
   NotificationSubscription notificationSubscription =
       NotificationSubscription.newBuilder().build();
   FieldMask updateMask = FieldMask.newBuilder().build();
   NotificationSubscription response =
       notificationsApiServiceClient.updateNotificationSubscription(
           notificationSubscription, updateMask);
 }
 
Parameters
Name Description
notificationSubscription NotificationSubscription

Required. The new version of the notification subscription that should be updated.

updateMask FieldMask

List of fields being updated.

Returns
Type Description
NotificationSubscription

updateNotificationSubscription(UpdateNotificationSubscriptionRequest request)

public final NotificationSubscription updateNotificationSubscription(UpdateNotificationSubscriptionRequest request)

Updates an existing notification subscription for a merchant.

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 (NotificationsApiServiceClient notificationsApiServiceClient =
     NotificationsApiServiceClient.create()) {
   UpdateNotificationSubscriptionRequest request =
       UpdateNotificationSubscriptionRequest.newBuilder()
           .setNotificationSubscription(NotificationSubscription.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   NotificationSubscription response =
       notificationsApiServiceClient.updateNotificationSubscription(request);
 }
 
Parameter
Name Description
request UpdateNotificationSubscriptionRequest

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

Returns
Type Description
NotificationSubscription

updateNotificationSubscriptionCallable()

public final UnaryCallable<UpdateNotificationSubscriptionRequest,NotificationSubscription> updateNotificationSubscriptionCallable()

Updates an existing notification subscription for a merchant.

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 (NotificationsApiServiceClient notificationsApiServiceClient =
     NotificationsApiServiceClient.create()) {
   UpdateNotificationSubscriptionRequest request =
       UpdateNotificationSubscriptionRequest.newBuilder()
           .setNotificationSubscription(NotificationSubscription.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   ApiFuture<NotificationSubscription> future =
       notificationsApiServiceClient
           .updateNotificationSubscriptionCallable()
           .futureCall(request);
   // Do something.
   NotificationSubscription response = future.get();
 }
 
Returns
Type Description
UnaryCallable<UpdateNotificationSubscriptionRequest,NotificationSubscription>