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 (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(). + * + *
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. + *
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. + *
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. + *
|
+ *
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. + *
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. + *
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. + *
|
+ *
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. + *
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. + *
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. + *
|
+ *
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. + *
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. + *
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. + *
|
+ *
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. + *
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. + *
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. + *
|
+ *
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: + * + *
{@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 + * NotificationsApiServiceSettings notificationsApiServiceSettings = + * NotificationsApiServiceSettings.newBuilder() + * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + * .build(); + * NotificationsApiServiceClient notificationsApiServiceClient = + * NotificationsApiServiceClient.create(notificationsApiServiceSettings); + * }+ * + *
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 + * 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: + * + *
{@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 + * NotificationsApiServiceSettings notificationsApiServiceSettings = + * NotificationsApiServiceSettings.newHttpJsonBuilder().build(); + * NotificationsApiServiceClient notificationsApiServiceClient = + * NotificationsApiServiceClient.create(notificationsApiServiceSettings); + * }+ * + *
Please refer to the GitHub repository's samples for more quickstart code snippets. + */ +@BetaApi +@Generated("by gapic-generator-java") +public class NotificationsApiServiceClient implements BackgroundResource { + private final NotificationsApiServiceSettings settings; + private final NotificationsApiServiceStub stub; + + /** Constructs an instance of NotificationsApiServiceClient with default settings. */ + public static final NotificationsApiServiceClient create() throws IOException { + return create(NotificationsApiServiceSettings.newBuilder().build()); + } + + /** + * 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. + */ + public static final NotificationsApiServiceClient create(NotificationsApiServiceSettings settings) + throws IOException { + return new NotificationsApiServiceClient(settings); + } + + /** + * Constructs an instance of NotificationsApiServiceClient, using the given stub for making calls. + * This is for advanced usage - prefer using create(NotificationsApiServiceSettings). + */ + public static final NotificationsApiServiceClient create(NotificationsApiServiceStub stub) { + return new NotificationsApiServiceClient(stub); + } + + /** + * 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. + */ + protected NotificationsApiServiceClient(NotificationsApiServiceSettings settings) + throws IOException { + this.settings = settings; + this.stub = ((NotificationsApiServiceStubSettings) settings.getStubSettings()).createStub(); + } + + protected NotificationsApiServiceClient(NotificationsApiServiceStub stub) { + this.settings = null; + this.stub = stub; + } + + public final NotificationsApiServiceSettings getSettings() { + return settings; + } + + public NotificationsApiServiceStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets notification subscriptions for an 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 (NotificationsApiServiceClient notificationsApiServiceClient = + * NotificationsApiServiceClient.create()) { + * NotificationSubscriptionName name = + * NotificationSubscriptionName.of("[ACCOUNT]", "[NOTIFICATION_SUBSCRIPTION]"); + * NotificationSubscription response = + * notificationsApiServiceClient.getNotificationSubscription(name); + * } + * }+ * + * @param name Required. The `name` of the notification subscription. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final NotificationSubscription getNotificationSubscription( + NotificationSubscriptionName name) { + GetNotificationSubscriptionRequest request = + GetNotificationSubscriptionRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + return getNotificationSubscription(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets notification subscriptions for an 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 (NotificationsApiServiceClient notificationsApiServiceClient = + * NotificationsApiServiceClient.create()) { + * String name = + * NotificationSubscriptionName.of("[ACCOUNT]", "[NOTIFICATION_SUBSCRIPTION]").toString(); + * NotificationSubscription response = + * notificationsApiServiceClient.getNotificationSubscription(name); + * } + * }+ * + * @param name Required. The `name` of the notification subscription. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final NotificationSubscription getNotificationSubscription(String name) { + GetNotificationSubscriptionRequest request = + GetNotificationSubscriptionRequest.newBuilder().setName(name).build(); + return getNotificationSubscription(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets notification subscriptions for an 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 (NotificationsApiServiceClient notificationsApiServiceClient = + * NotificationsApiServiceClient.create()) { + * GetNotificationSubscriptionRequest request = + * GetNotificationSubscriptionRequest.newBuilder() + * .setName( + * NotificationSubscriptionName.of("[ACCOUNT]", "[NOTIFICATION_SUBSCRIPTION]") + * .toString()) + * .build(); + * NotificationSubscription response = + * notificationsApiServiceClient.getNotificationSubscription(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 NotificationSubscription getNotificationSubscription( + GetNotificationSubscriptionRequest request) { + return getNotificationSubscriptionCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets notification subscriptions for an 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 (NotificationsApiServiceClient notificationsApiServiceClient = + * NotificationsApiServiceClient.create()) { + * GetNotificationSubscriptionRequest request = + * GetNotificationSubscriptionRequest.newBuilder() + * .setName( + * NotificationSubscriptionName.of("[ACCOUNT]", "[NOTIFICATION_SUBSCRIPTION]") + * .toString()) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * notificationsApiServiceClient.getNotificationSubscriptionCallable().futureCall(request); + * // Do something. + * NotificationSubscription response = future.get(); + * } + * }
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: + * + *
{@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); + * } + * }+ * + * @param parent Required. The merchant account that owns the new notification subscription. + * Format: `accounts/{account}` + * @param notificationSubscription Required. The notification subscription to create. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final NotificationSubscription createNotificationSubscription( + AccountName parent, NotificationSubscription notificationSubscription) { + CreateNotificationSubscriptionRequest request = + CreateNotificationSubscriptionRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .setNotificationSubscription(notificationSubscription) + .build(); + return createNotificationSubscription(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * 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: + * + *
{@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); + * } + * }+ * + * @param parent Required. The merchant account that owns the new notification subscription. + * Format: `accounts/{account}` + * @param notificationSubscription Required. The notification subscription to create. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final NotificationSubscription createNotificationSubscription( + String parent, NotificationSubscription notificationSubscription) { + CreateNotificationSubscriptionRequest request = + CreateNotificationSubscriptionRequest.newBuilder() + .setParent(parent) + .setNotificationSubscription(notificationSubscription) + .build(); + return createNotificationSubscription(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * 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: + * + *
{@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); + * } + * }+ * + * @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 NotificationSubscription createNotificationSubscription( + CreateNotificationSubscriptionRequest request) { + return createNotificationSubscriptionCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * 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: + * + *
{@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+ */ + public final UnaryCallablefuture = + * notificationsApiServiceClient + * .createNotificationSubscriptionCallable() + * .futureCall(request); + * // Do something. + * NotificationSubscription 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 (NotificationsApiServiceClient notificationsApiServiceClient = + * NotificationsApiServiceClient.create()) { + * NotificationSubscription notificationSubscription = + * NotificationSubscription.newBuilder().build(); + * FieldMask updateMask = FieldMask.newBuilder().build(); + * NotificationSubscription response = + * notificationsApiServiceClient.updateNotificationSubscription( + * notificationSubscription, updateMask); + * } + * }+ * + * @param notificationSubscription Required. The new version of the notification subscription that + * should be updated. + * @param updateMask List of fields being updated. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final NotificationSubscription updateNotificationSubscription( + NotificationSubscription notificationSubscription, FieldMask updateMask) { + UpdateNotificationSubscriptionRequest request = + UpdateNotificationSubscriptionRequest.newBuilder() + .setNotificationSubscription(notificationSubscription) + .setUpdateMask(updateMask) + .build(); + return updateNotificationSubscription(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates an existing notification subscription for a merchant. + * + *
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 (NotificationsApiServiceClient notificationsApiServiceClient = + * NotificationsApiServiceClient.create()) { + * UpdateNotificationSubscriptionRequest request = + * UpdateNotificationSubscriptionRequest.newBuilder() + * .setNotificationSubscription(NotificationSubscription.newBuilder().build()) + * .setUpdateMask(FieldMask.newBuilder().build()) + * .build(); + * NotificationSubscription response = + * notificationsApiServiceClient.updateNotificationSubscription(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 NotificationSubscription updateNotificationSubscription( + UpdateNotificationSubscriptionRequest request) { + return updateNotificationSubscriptionCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates an existing notification subscription for a merchant. + * + *
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 (NotificationsApiServiceClient notificationsApiServiceClient = + * NotificationsApiServiceClient.create()) { + * UpdateNotificationSubscriptionRequest request = + * UpdateNotificationSubscriptionRequest.newBuilder() + * .setNotificationSubscription(NotificationSubscription.newBuilder().build()) + * .setUpdateMask(FieldMask.newBuilder().build()) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * notificationsApiServiceClient + * .updateNotificationSubscriptionCallable() + * .futureCall(request); + * // Do something. + * NotificationSubscription 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 (NotificationsApiServiceClient notificationsApiServiceClient = + * NotificationsApiServiceClient.create()) { + * NotificationSubscriptionName name = + * NotificationSubscriptionName.of("[ACCOUNT]", "[NOTIFICATION_SUBSCRIPTION]"); + * notificationsApiServiceClient.deleteNotificationSubscription(name); + * } + * }+ * + * @param name Required. The name of the notification subscription to be deleted. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteNotificationSubscription(NotificationSubscriptionName name) { + DeleteNotificationSubscriptionRequest request = + DeleteNotificationSubscriptionRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + deleteNotificationSubscription(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes a notification subscription for a merchant. + * + *
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 (NotificationsApiServiceClient notificationsApiServiceClient = + * NotificationsApiServiceClient.create()) { + * String name = + * NotificationSubscriptionName.of("[ACCOUNT]", "[NOTIFICATION_SUBSCRIPTION]").toString(); + * notificationsApiServiceClient.deleteNotificationSubscription(name); + * } + * }+ * + * @param name Required. The name of the notification subscription to be deleted. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteNotificationSubscription(String name) { + DeleteNotificationSubscriptionRequest request = + DeleteNotificationSubscriptionRequest.newBuilder().setName(name).build(); + deleteNotificationSubscription(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes a notification subscription for a merchant. + * + *
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 (NotificationsApiServiceClient notificationsApiServiceClient = + * NotificationsApiServiceClient.create()) { + * DeleteNotificationSubscriptionRequest request = + * DeleteNotificationSubscriptionRequest.newBuilder() + * .setName( + * NotificationSubscriptionName.of("[ACCOUNT]", "[NOTIFICATION_SUBSCRIPTION]") + * .toString()) + * .build(); + * notificationsApiServiceClient.deleteNotificationSubscription(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 deleteNotificationSubscription(DeleteNotificationSubscriptionRequest request) { + deleteNotificationSubscriptionCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes a notification subscription for a merchant. + * + *
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 (NotificationsApiServiceClient notificationsApiServiceClient = + * NotificationsApiServiceClient.create()) { + * DeleteNotificationSubscriptionRequest request = + * DeleteNotificationSubscriptionRequest.newBuilder() + * .setName( + * NotificationSubscriptionName.of("[ACCOUNT]", "[NOTIFICATION_SUBSCRIPTION]") + * .toString()) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * notificationsApiServiceClient + * .deleteNotificationSubscriptionCallable() + * .futureCall(request); + * // Do something. + * 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 (NotificationsApiServiceClient notificationsApiServiceClient = + * NotificationsApiServiceClient.create()) { + * AccountName parent = AccountName.of("[ACCOUNT]"); + * for (NotificationSubscription element : + * notificationsApiServiceClient.listNotificationSubscriptions(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * + * @param parent Required. The merchant account who owns the notification subscriptions. Format: + * `accounts/{account}` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListNotificationSubscriptionsPagedResponse listNotificationSubscriptions( + AccountName parent) { + ListNotificationSubscriptionsRequest request = + ListNotificationSubscriptionsRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .build(); + return listNotificationSubscriptions(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets all the notification subscriptions for a merchant. + * + *
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 (NotificationsApiServiceClient notificationsApiServiceClient = + * NotificationsApiServiceClient.create()) { + * String parent = AccountName.of("[ACCOUNT]").toString(); + * for (NotificationSubscription element : + * notificationsApiServiceClient.listNotificationSubscriptions(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * + * @param parent Required. The merchant account who owns the notification subscriptions. Format: + * `accounts/{account}` + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListNotificationSubscriptionsPagedResponse listNotificationSubscriptions( + String parent) { + ListNotificationSubscriptionsRequest request = + ListNotificationSubscriptionsRequest.newBuilder().setParent(parent).build(); + return listNotificationSubscriptions(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets all the notification subscriptions for a merchant. + * + *
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 (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); + * } + * } + * }+ * + * @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 ListNotificationSubscriptionsPagedResponse listNotificationSubscriptions( + ListNotificationSubscriptionsRequest request) { + return listNotificationSubscriptionsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets all the notification subscriptions for a merchant. + * + *
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 (NotificationsApiServiceClient notificationsApiServiceClient = + * NotificationsApiServiceClient.create()) { + * ListNotificationSubscriptionsRequest request = + * ListNotificationSubscriptionsRequest.newBuilder() + * .setParent(AccountName.of("[ACCOUNT]").toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * ApiFuture+ */ + public final UnaryCallable< + ListNotificationSubscriptionsRequest, ListNotificationSubscriptionsPagedResponse> + listNotificationSubscriptionsPagedCallable() { + return stub.listNotificationSubscriptionsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets all the notification subscriptions for a merchant. + * + *future = + * notificationsApiServiceClient + * .listNotificationSubscriptionsPagedCallable() + * .futureCall(request); + * // Do something. + * for (NotificationSubscription element : future.get().iterateAll()) { + * // doThingsWith(element); + * } + * } + * }
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 (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; + * } + * } + * } + * }+ */ + public final UnaryCallable< + ListNotificationSubscriptionsRequest, ListNotificationSubscriptionsResponse> + listNotificationSubscriptionsCallable() { + return stub.listNotificationSubscriptionsCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class ListNotificationSubscriptionsPagedResponse + extends AbstractPagedListResponse< + ListNotificationSubscriptionsRequest, + ListNotificationSubscriptionsResponse, + NotificationSubscription, + ListNotificationSubscriptionsPage, + ListNotificationSubscriptionsFixedSizeCollection> { + + public static ApiFuture
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 getNotificationSubscription 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 + * NotificationsApiServiceSettings.Builder notificationsApiServiceSettingsBuilder = + * NotificationsApiServiceSettings.newBuilder(); + * notificationsApiServiceSettingsBuilder + * .getNotificationSubscriptionSettings() + * .setRetrySettings( + * notificationsApiServiceSettingsBuilder + * .getNotificationSubscriptionSettings() + * .getRetrySettings() + * .toBuilder() + * .setTotalTimeout(Duration.ofSeconds(30)) + * .build()); + * NotificationsApiServiceSettings notificationsApiServiceSettings = + * notificationsApiServiceSettingsBuilder.build(); + * }+ */ +@BetaApi +@Generated("by gapic-generator-java") +public class NotificationsApiServiceSettings + extends ClientSettings
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.
+ *
+ * ======================= NotificationsApiServiceClient =======================
+ *
+ * Service Description: Service to manage notification subscriptions for merchants
+ *
+ * Sample for NotificationsApiServiceClient:
+ *
+ * This class is for advanced usage.
+ */
+@BetaApi
+@Generated("by gapic-generator-java")
+public class GrpcNotificationsApiServiceCallableFactory implements GrpcStubCallableFactory {
+
+ @Override
+ public This class is for advanced usage and reflects the underlying API directly.
+ */
+@BetaApi
+@Generated("by gapic-generator-java")
+public class GrpcNotificationsApiServiceStub extends NotificationsApiServiceStub {
+ private static final MethodDescriptor<
+ GetNotificationSubscriptionRequest, NotificationSubscription>
+ getNotificationSubscriptionMethodDescriptor =
+ MethodDescriptor
+ . This class is for advanced usage.
+ */
+@BetaApi
+@Generated("by gapic-generator-java")
+public class HttpJsonNotificationsApiServiceCallableFactory
+ implements HttpJsonStubCallableFactory This class is for advanced usage and reflects the underlying API directly.
+ */
+@BetaApi
+@Generated("by gapic-generator-java")
+public class HttpJsonNotificationsApiServiceStub extends NotificationsApiServiceStub {
+ private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder().build();
+
+ private static final ApiMethodDescriptor<
+ GetNotificationSubscriptionRequest, NotificationSubscription>
+ getNotificationSubscriptionMethodDescriptor =
+ ApiMethodDescriptor
+ . This class is for advanced usage and reflects the underlying API directly.
+ */
+@BetaApi
+@Generated("by gapic-generator-java")
+public abstract class NotificationsApiServiceStub implements BackgroundResource {
+
+ public UnaryCallable 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 getNotificationSubscription to 30 seconds:
+ *
+ * Note: This method does not support applying settings to streaming methods.
+ */
+ public Builder applyToAllUnaryMethods(
+ ApiFunction{@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);
+ * }
+ * }
+ */
+@Generated("by gapic-generator-java")
+package com.google.shopping.merchant.notifications.v1beta;
+
+import javax.annotation.Generated;
diff --git a/java-shopping-merchant-notifications/google-shopping-merchant-notifications/src/main/java/com/google/shopping/merchant/notifications/v1beta/stub/GrpcNotificationsApiServiceCallableFactory.java b/java-shopping-merchant-notifications/google-shopping-merchant-notifications/src/main/java/com/google/shopping/merchant/notifications/v1beta/stub/GrpcNotificationsApiServiceCallableFactory.java
new file mode 100644
index 000000000000..4a498f6d8793
--- /dev/null
+++ b/java-shopping-merchant-notifications/google-shopping-merchant-notifications/src/main/java/com/google/shopping/merchant/notifications/v1beta/stub/GrpcNotificationsApiServiceCallableFactory.java
@@ -0,0 +1,115 @@
+/*
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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.notifications.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 NotificationsApiService service API.
+ *
+ *
+ *
+ *
+ * {@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
+ * NotificationsApiServiceStubSettings.Builder notificationsApiServiceSettingsBuilder =
+ * NotificationsApiServiceStubSettings.newBuilder();
+ * notificationsApiServiceSettingsBuilder
+ * .getNotificationSubscriptionSettings()
+ * .setRetrySettings(
+ * notificationsApiServiceSettingsBuilder
+ * .getNotificationSubscriptionSettings()
+ * .getRetrySettings()
+ * .toBuilder()
+ * .setTotalTimeout(Duration.ofSeconds(30))
+ * .build());
+ * NotificationsApiServiceStubSettings notificationsApiServiceSettings =
+ * notificationsApiServiceSettingsBuilder.build();
+ * }
+ */
+@BetaApi
+@Generated("by gapic-generator-java")
+public class NotificationsApiServiceStubSettings
+ extends StubSettings