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 (ConversionSourcesServiceClient conversionSourcesServiceClient =
+ * ConversionSourcesServiceClient.create()) {
+ * AccountName parent = AccountName.of("[ACCOUNT]");
+ * ConversionSource conversionSource = ConversionSource.newBuilder().build();
+ * ConversionSource response =
+ * conversionSourcesServiceClient.createConversionSource(parent, conversionSource);
+ * }
+ * }
+ *
+ * Note: close() needs to be called on the ConversionSourcesServiceClient 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 | + *
|---|---|---|
CreateConversionSource |
+ * Creates a new conversion source. |
+ *
+ * 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. + *
|
+ *
UpdateConversionSource |
+ * Updates information of an existing conversion source. Available only for Merchant Center Destination conversion sources. |
+ *
+ * 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. + *
|
+ *
DeleteConversionSource |
+ * Archives an existing conversion source. If the conversion source is a Merchant Center Destination, it will be recoverable for 30 days. If the conversion source is a Google Analytics Link, it will be deleted immediately and can be restored by creating a new one. |
+ *
+ * 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. + *
|
+ *
UndeleteConversionSource |
+ * Re-enables an archived conversion source. Only Available for Merchant Center Destination conversion sources. |
+ *
+ * Request object method variants only take one parameter, a request object, which must be constructed before the call. + *
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. + *
|
+ *
GetConversionSource |
+ * Fetches a conversion source. |
+ *
+ * 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. + *
|
+ *
ListConversionSources |
+ * Retrieves the list of conversion sources the caller has access to. |
+ *
+ * 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 + * ConversionSourcesServiceSettings 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
+ * ConversionSourcesServiceSettings conversionSourcesServiceSettings =
+ * ConversionSourcesServiceSettings.newBuilder()
+ * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ * .build();
+ * ConversionSourcesServiceClient conversionSourcesServiceClient =
+ * ConversionSourcesServiceClient.create(conversionSourcesServiceSettings);
+ * }
+ *
+ * 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
+ * ConversionSourcesServiceSettings conversionSourcesServiceSettings =
+ * ConversionSourcesServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * ConversionSourcesServiceClient conversionSourcesServiceClient =
+ * ConversionSourcesServiceClient.create(conversionSourcesServiceSettings);
+ * }
+ *
+ * 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
+ * ConversionSourcesServiceSettings conversionSourcesServiceSettings =
+ * ConversionSourcesServiceSettings.newHttpJsonBuilder().build();
+ * ConversionSourcesServiceClient conversionSourcesServiceClient =
+ * ConversionSourcesServiceClient.create(conversionSourcesServiceSettings);
+ * }
+ *
+ * Please refer to the GitHub repository's samples for more quickstart code snippets. + */ +@Generated("by gapic-generator-java") +public class ConversionSourcesServiceClient implements BackgroundResource { + private final ConversionSourcesServiceSettings settings; + private final ConversionSourcesServiceStub stub; + + /** Constructs an instance of ConversionSourcesServiceClient with default settings. */ + public static final ConversionSourcesServiceClient create() throws IOException { + return create(ConversionSourcesServiceSettings.newBuilder().build()); + } + + /** + * Constructs an instance of ConversionSourcesServiceClient, 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 ConversionSourcesServiceClient create( + ConversionSourcesServiceSettings settings) throws IOException { + return new ConversionSourcesServiceClient(settings); + } + + /** + * Constructs an instance of ConversionSourcesServiceClient, using the given stub for making + * calls. This is for advanced usage - prefer using create(ConversionSourcesServiceSettings). + */ + public static final ConversionSourcesServiceClient create(ConversionSourcesServiceStub stub) { + return new ConversionSourcesServiceClient(stub); + } + + /** + * Constructs an instance of ConversionSourcesServiceClient, 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 ConversionSourcesServiceClient(ConversionSourcesServiceSettings settings) + throws IOException { + this.settings = settings; + this.stub = ((ConversionSourcesServiceStubSettings) settings.getStubSettings()).createStub(); + } + + protected ConversionSourcesServiceClient(ConversionSourcesServiceStub stub) { + this.settings = null; + this.stub = stub; + } + + public final ConversionSourcesServiceSettings getSettings() { + return settings; + } + + public ConversionSourcesServiceStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a new conversion source. + * + *
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 (ConversionSourcesServiceClient conversionSourcesServiceClient =
+ * ConversionSourcesServiceClient.create()) {
+ * AccountName parent = AccountName.of("[ACCOUNT]");
+ * ConversionSource conversionSource = ConversionSource.newBuilder().build();
+ * ConversionSource response =
+ * conversionSourcesServiceClient.createConversionSource(parent, conversionSource);
+ * }
+ * }
+ *
+ * @param parent Required. The merchant account that will own the new conversion source. Format:
+ * `accounts/{account}`
+ * @param conversionSource Required. The conversion source description. A new ID will be
+ * automatically assigned to it upon creation.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ConversionSource createConversionSource(
+ AccountName parent, ConversionSource conversionSource) {
+ CreateConversionSourceRequest request =
+ CreateConversionSourceRequest.newBuilder()
+ .setParent(parent == null ? null : parent.toString())
+ .setConversionSource(conversionSource)
+ .build();
+ return createConversionSource(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Creates a new conversion source.
+ *
+ * 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 (ConversionSourcesServiceClient conversionSourcesServiceClient =
+ * ConversionSourcesServiceClient.create()) {
+ * String parent = AccountName.of("[ACCOUNT]").toString();
+ * ConversionSource conversionSource = ConversionSource.newBuilder().build();
+ * ConversionSource response =
+ * conversionSourcesServiceClient.createConversionSource(parent, conversionSource);
+ * }
+ * }
+ *
+ * @param parent Required. The merchant account that will own the new conversion source. Format:
+ * `accounts/{account}`
+ * @param conversionSource Required. The conversion source description. A new ID will be
+ * automatically assigned to it upon creation.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ConversionSource createConversionSource(
+ String parent, ConversionSource conversionSource) {
+ CreateConversionSourceRequest request =
+ CreateConversionSourceRequest.newBuilder()
+ .setParent(parent)
+ .setConversionSource(conversionSource)
+ .build();
+ return createConversionSource(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Creates a new conversion source.
+ *
+ * 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 (ConversionSourcesServiceClient conversionSourcesServiceClient =
+ * ConversionSourcesServiceClient.create()) {
+ * CreateConversionSourceRequest request =
+ * CreateConversionSourceRequest.newBuilder()
+ * .setParent(AccountName.of("[ACCOUNT]").toString())
+ * .setConversionSource(ConversionSource.newBuilder().build())
+ * .build();
+ * ConversionSource response = conversionSourcesServiceClient.createConversionSource(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 ConversionSource createConversionSource(CreateConversionSourceRequest request) {
+ return createConversionSourceCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Creates a new conversion source.
+ *
+ * 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 (ConversionSourcesServiceClient conversionSourcesServiceClient =
+ * ConversionSourcesServiceClient.create()) {
+ * CreateConversionSourceRequest request =
+ * CreateConversionSourceRequest.newBuilder()
+ * .setParent(AccountName.of("[ACCOUNT]").toString())
+ * .setConversionSource(ConversionSource.newBuilder().build())
+ * .build();
+ * ApiFuture future =
+ * conversionSourcesServiceClient.createConversionSourceCallable().futureCall(request);
+ * // Do something.
+ * ConversionSource response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallableSample 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 (ConversionSourcesServiceClient conversionSourcesServiceClient =
+ * ConversionSourcesServiceClient.create()) {
+ * ConversionSource conversionSource = ConversionSource.newBuilder().build();
+ * FieldMask updateMask = FieldMask.newBuilder().build();
+ * ConversionSource response =
+ * conversionSourcesServiceClient.updateConversionSource(conversionSource, updateMask);
+ * }
+ * }
+ *
+ * @param conversionSource Required. The new version of the conversion source data.
+ * @param updateMask Optional. List of fields being updated.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ConversionSource updateConversionSource(
+ ConversionSource conversionSource, FieldMask updateMask) {
+ UpdateConversionSourceRequest request =
+ UpdateConversionSourceRequest.newBuilder()
+ .setConversionSource(conversionSource)
+ .setUpdateMask(updateMask)
+ .build();
+ return updateConversionSource(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Updates information of an existing conversion source. Available only for Merchant Center
+ * Destination conversion sources.
+ *
+ * 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 (ConversionSourcesServiceClient conversionSourcesServiceClient =
+ * ConversionSourcesServiceClient.create()) {
+ * UpdateConversionSourceRequest request =
+ * UpdateConversionSourceRequest.newBuilder()
+ * .setConversionSource(ConversionSource.newBuilder().build())
+ * .setUpdateMask(FieldMask.newBuilder().build())
+ * .build();
+ * ConversionSource response = conversionSourcesServiceClient.updateConversionSource(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 ConversionSource updateConversionSource(UpdateConversionSourceRequest request) {
+ return updateConversionSourceCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Updates information of an existing conversion source. Available only for Merchant Center
+ * Destination conversion sources.
+ *
+ * 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 (ConversionSourcesServiceClient conversionSourcesServiceClient =
+ * ConversionSourcesServiceClient.create()) {
+ * UpdateConversionSourceRequest request =
+ * UpdateConversionSourceRequest.newBuilder()
+ * .setConversionSource(ConversionSource.newBuilder().build())
+ * .setUpdateMask(FieldMask.newBuilder().build())
+ * .build();
+ * ApiFuture future =
+ * conversionSourcesServiceClient.updateConversionSourceCallable().futureCall(request);
+ * // Do something.
+ * ConversionSource response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallableSample 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 (ConversionSourcesServiceClient conversionSourcesServiceClient =
+ * ConversionSourcesServiceClient.create()) {
+ * ConversionSourceName name = ConversionSourceName.of("[ACCOUNT]", "[CONVERSION_SOURCE]");
+ * conversionSourcesServiceClient.deleteConversionSource(name);
+ * }
+ * }
+ *
+ * @param name Required. The name of the conversion source to be deleted. Format:
+ * `accounts/{account}/conversionSources/{conversion_source}`
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final void deleteConversionSource(ConversionSourceName name) {
+ DeleteConversionSourceRequest request =
+ DeleteConversionSourceRequest.newBuilder()
+ .setName(name == null ? null : name.toString())
+ .build();
+ deleteConversionSource(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Archives an existing conversion source. If the conversion source is a Merchant Center
+ * Destination, it will be recoverable for 30 days. If the conversion source is a Google Analytics
+ * Link, it will be deleted immediately and can be restored by creating a new one.
+ *
+ * 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 (ConversionSourcesServiceClient conversionSourcesServiceClient =
+ * ConversionSourcesServiceClient.create()) {
+ * String name = ConversionSourceName.of("[ACCOUNT]", "[CONVERSION_SOURCE]").toString();
+ * conversionSourcesServiceClient.deleteConversionSource(name);
+ * }
+ * }
+ *
+ * @param name Required. The name of the conversion source to be deleted. Format:
+ * `accounts/{account}/conversionSources/{conversion_source}`
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final void deleteConversionSource(String name) {
+ DeleteConversionSourceRequest request =
+ DeleteConversionSourceRequest.newBuilder().setName(name).build();
+ deleteConversionSource(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Archives an existing conversion source. If the conversion source is a Merchant Center
+ * Destination, it will be recoverable for 30 days. If the conversion source is a Google Analytics
+ * Link, it will be deleted immediately and can be restored by creating a new one.
+ *
+ * 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 (ConversionSourcesServiceClient conversionSourcesServiceClient =
+ * ConversionSourcesServiceClient.create()) {
+ * DeleteConversionSourceRequest request =
+ * DeleteConversionSourceRequest.newBuilder()
+ * .setName(ConversionSourceName.of("[ACCOUNT]", "[CONVERSION_SOURCE]").toString())
+ * .build();
+ * conversionSourcesServiceClient.deleteConversionSource(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 deleteConversionSource(DeleteConversionSourceRequest request) {
+ deleteConversionSourceCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Archives an existing conversion source. If the conversion source is a Merchant Center
+ * Destination, it will be recoverable for 30 days. If the conversion source is a Google Analytics
+ * Link, it will be deleted immediately and can be restored by creating a new one.
+ *
+ * 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 (ConversionSourcesServiceClient conversionSourcesServiceClient =
+ * ConversionSourcesServiceClient.create()) {
+ * DeleteConversionSourceRequest request =
+ * DeleteConversionSourceRequest.newBuilder()
+ * .setName(ConversionSourceName.of("[ACCOUNT]", "[CONVERSION_SOURCE]").toString())
+ * .build();
+ * ApiFuture future =
+ * conversionSourcesServiceClient.deleteConversionSourceCallable().futureCall(request);
+ * // Do something.
+ * future.get();
+ * }
+ * }
+ */
+ public final UnaryCallableSample 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 (ConversionSourcesServiceClient conversionSourcesServiceClient =
+ * ConversionSourcesServiceClient.create()) {
+ * UndeleteConversionSourceRequest request =
+ * UndeleteConversionSourceRequest.newBuilder()
+ * .setName(ConversionSourceName.of("[ACCOUNT]", "[CONVERSION_SOURCE]").toString())
+ * .build();
+ * ConversionSource response = conversionSourcesServiceClient.undeleteConversionSource(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 ConversionSource undeleteConversionSource(UndeleteConversionSourceRequest request) {
+ return undeleteConversionSourceCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Re-enables an archived conversion source. Only Available for Merchant Center Destination
+ * conversion sources.
+ *
+ * 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 (ConversionSourcesServiceClient conversionSourcesServiceClient =
+ * ConversionSourcesServiceClient.create()) {
+ * UndeleteConversionSourceRequest request =
+ * UndeleteConversionSourceRequest.newBuilder()
+ * .setName(ConversionSourceName.of("[ACCOUNT]", "[CONVERSION_SOURCE]").toString())
+ * .build();
+ * ApiFuture future =
+ * conversionSourcesServiceClient.undeleteConversionSourceCallable().futureCall(request);
+ * // Do something.
+ * ConversionSource response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallableSample 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 (ConversionSourcesServiceClient conversionSourcesServiceClient =
+ * ConversionSourcesServiceClient.create()) {
+ * ConversionSourceName name = ConversionSourceName.of("[ACCOUNT]", "[CONVERSION_SOURCE]");
+ * ConversionSource response = conversionSourcesServiceClient.getConversionSource(name);
+ * }
+ * }
+ *
+ * @param name Required. The name of the conversion source to be fetched. Format:
+ * `accounts/{account}/conversionSources/{conversion_source}`
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ConversionSource getConversionSource(ConversionSourceName name) {
+ GetConversionSourceRequest request =
+ GetConversionSourceRequest.newBuilder()
+ .setName(name == null ? null : name.toString())
+ .build();
+ return getConversionSource(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Fetches a conversion source.
+ *
+ * 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 (ConversionSourcesServiceClient conversionSourcesServiceClient =
+ * ConversionSourcesServiceClient.create()) {
+ * String name = ConversionSourceName.of("[ACCOUNT]", "[CONVERSION_SOURCE]").toString();
+ * ConversionSource response = conversionSourcesServiceClient.getConversionSource(name);
+ * }
+ * }
+ *
+ * @param name Required. The name of the conversion source to be fetched. Format:
+ * `accounts/{account}/conversionSources/{conversion_source}`
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ConversionSource getConversionSource(String name) {
+ GetConversionSourceRequest request =
+ GetConversionSourceRequest.newBuilder().setName(name).build();
+ return getConversionSource(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Fetches a conversion source.
+ *
+ * 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 (ConversionSourcesServiceClient conversionSourcesServiceClient =
+ * ConversionSourcesServiceClient.create()) {
+ * GetConversionSourceRequest request =
+ * GetConversionSourceRequest.newBuilder()
+ * .setName(ConversionSourceName.of("[ACCOUNT]", "[CONVERSION_SOURCE]").toString())
+ * .build();
+ * ConversionSource response = conversionSourcesServiceClient.getConversionSource(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 ConversionSource getConversionSource(GetConversionSourceRequest request) {
+ return getConversionSourceCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Fetches a conversion source.
+ *
+ * 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 (ConversionSourcesServiceClient conversionSourcesServiceClient =
+ * ConversionSourcesServiceClient.create()) {
+ * GetConversionSourceRequest request =
+ * GetConversionSourceRequest.newBuilder()
+ * .setName(ConversionSourceName.of("[ACCOUNT]", "[CONVERSION_SOURCE]").toString())
+ * .build();
+ * ApiFuture future =
+ * conversionSourcesServiceClient.getConversionSourceCallable().futureCall(request);
+ * // Do something.
+ * ConversionSource response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallableSample 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 (ConversionSourcesServiceClient conversionSourcesServiceClient =
+ * ConversionSourcesServiceClient.create()) {
+ * AccountName parent = AccountName.of("[ACCOUNT]");
+ * for (ConversionSource element :
+ * conversionSourcesServiceClient.listConversionSources(parent).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ *
+ * @param parent Required. The merchant account who owns the collection of conversion sources.
+ * Format: `accounts/{account}`
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListConversionSourcesPagedResponse listConversionSources(AccountName parent) {
+ ListConversionSourcesRequest request =
+ ListConversionSourcesRequest.newBuilder()
+ .setParent(parent == null ? null : parent.toString())
+ .build();
+ return listConversionSources(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Retrieves the list of conversion sources the caller has access to.
+ *
+ * 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 (ConversionSourcesServiceClient conversionSourcesServiceClient =
+ * ConversionSourcesServiceClient.create()) {
+ * String parent = AccountName.of("[ACCOUNT]").toString();
+ * for (ConversionSource element :
+ * conversionSourcesServiceClient.listConversionSources(parent).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ *
+ * @param parent Required. The merchant account who owns the collection of conversion sources.
+ * Format: `accounts/{account}`
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListConversionSourcesPagedResponse listConversionSources(String parent) {
+ ListConversionSourcesRequest request =
+ ListConversionSourcesRequest.newBuilder().setParent(parent).build();
+ return listConversionSources(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Retrieves the list of conversion sources the caller has access to.
+ *
+ * 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 (ConversionSourcesServiceClient conversionSourcesServiceClient =
+ * ConversionSourcesServiceClient.create()) {
+ * ListConversionSourcesRequest request =
+ * ListConversionSourcesRequest.newBuilder()
+ * .setParent(AccountName.of("[ACCOUNT]").toString())
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .setShowDeleted(true)
+ * .build();
+ * for (ConversionSource element :
+ * conversionSourcesServiceClient.listConversionSources(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 ListConversionSourcesPagedResponse listConversionSources(
+ ListConversionSourcesRequest request) {
+ return listConversionSourcesPagedCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Retrieves the list of conversion sources the caller has access to.
+ *
+ * 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 (ConversionSourcesServiceClient conversionSourcesServiceClient =
+ * ConversionSourcesServiceClient.create()) {
+ * ListConversionSourcesRequest request =
+ * ListConversionSourcesRequest.newBuilder()
+ * .setParent(AccountName.of("[ACCOUNT]").toString())
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .setShowDeleted(true)
+ * .build();
+ * ApiFuture future =
+ * conversionSourcesServiceClient.listConversionSourcesPagedCallable().futureCall(request);
+ * // Do something.
+ * for (ConversionSource element : future.get().iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ */
+ public final UnaryCallableSample 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 (ConversionSourcesServiceClient conversionSourcesServiceClient =
+ * ConversionSourcesServiceClient.create()) {
+ * ListConversionSourcesRequest request =
+ * ListConversionSourcesRequest.newBuilder()
+ * .setParent(AccountName.of("[ACCOUNT]").toString())
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .setShowDeleted(true)
+ * .build();
+ * while (true) {
+ * ListConversionSourcesResponse response =
+ * conversionSourcesServiceClient.listConversionSourcesCallable().call(request);
+ * for (ConversionSource element : response.getConversionSourcesList()) {
+ * // doThingsWith(element);
+ * }
+ * String nextPageToken = response.getNextPageToken();
+ * if (!Strings.isNullOrEmpty(nextPageToken)) {
+ * request = request.toBuilder().setPageToken(nextPageToken).build();
+ * } else {
+ * break;
+ * }
+ * }
+ * }
+ * }
+ */
+ public final UnaryCallableThe 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 + * [RetrySettings](https://cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.retrying.RetrySettings) + * of createConversionSource: + * + *
{@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
+ * ConversionSourcesServiceSettings.Builder conversionSourcesServiceSettingsBuilder =
+ * ConversionSourcesServiceSettings.newBuilder();
+ * conversionSourcesServiceSettingsBuilder
+ * .createConversionSourceSettings()
+ * .setRetrySettings(
+ * conversionSourcesServiceSettingsBuilder
+ * .createConversionSourceSettings()
+ * .getRetrySettings()
+ * .toBuilder()
+ * .setInitialRetryDelayDuration(Duration.ofSeconds(1))
+ * .setInitialRpcTimeoutDuration(Duration.ofSeconds(5))
+ * .setMaxAttempts(5)
+ * .setMaxRetryDelayDuration(Duration.ofSeconds(30))
+ * .setMaxRpcTimeoutDuration(Duration.ofSeconds(60))
+ * .setRetryDelayMultiplier(1.3)
+ * .setRpcTimeoutMultiplier(1.5)
+ * .setTotalTimeoutDuration(Duration.ofSeconds(300))
+ * .build());
+ * ConversionSourcesServiceSettings conversionSourcesServiceSettings =
+ * conversionSourcesServiceSettingsBuilder.build();
+ * }
+ *
+ * Please refer to the [Client Side Retry
+ * Guide](https://github.com/googleapis/google-cloud-java/blob/main/docs/client_retries.md) for
+ * additional support in setting retries.
+ */
+@Generated("by gapic-generator-java")
+public class ConversionSourcesServiceSettings
+ extends ClientSettingsNote: This method does not support applying settings to streaming methods.
+ */
+ public Builder applyToAllUnaryMethods(
+ ApiFunction The interfaces provided are listed below, along with usage samples.
+ *
+ * ======================= ConversionSourcesServiceClient =======================
+ *
+ * Service Description: Service for managing conversion sources for a merchant account.
+ *
+ * Sample for ConversionSourcesServiceClient:
+ *
+ * This class is for advanced usage and reflects the underlying API directly.
+ */
+@Generated("by gapic-generator-java")
+public abstract class ConversionSourcesServiceStub 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
+ * [RetrySettings](https://cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.retrying.RetrySettings)
+ * of createConversionSource:
+ *
+ * Note: This method does not support applying settings to streaming methods.
+ */
+ public Builder applyToAllUnaryMethods(
+ ApiFunction This class is for advanced usage.
+ */
+@Generated("by gapic-generator-java")
+public class GrpcConversionSourcesServiceCallableFactory implements GrpcStubCallableFactory {
+
+ @Override
+ public This class is for advanced usage and reflects the underlying API directly.
+ */
+@Generated("by gapic-generator-java")
+public class GrpcConversionSourcesServiceStub extends ConversionSourcesServiceStub {
+ private static final MethodDescriptor This class is for advanced usage.
+ */
+@Generated("by gapic-generator-java")
+public class HttpJsonConversionSourcesServiceCallableFactory
+ implements HttpJsonStubCallableFactory This class is for advanced usage and reflects the underlying API directly.
+ */
+@Generated("by gapic-generator-java")
+public class HttpJsonConversionSourcesServiceStub extends ConversionSourcesServiceStub {
+ private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder().build();
+
+ private static final ApiMethodDescriptor{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (ConversionSourcesServiceClient conversionSourcesServiceClient =
+ * ConversionSourcesServiceClient.create()) {
+ * AccountName parent = AccountName.of("[ACCOUNT]");
+ * ConversionSource conversionSource = ConversionSource.newBuilder().build();
+ * ConversionSource response =
+ * conversionSourcesServiceClient.createConversionSource(parent, conversionSource);
+ * }
+ * }
+ */
+@Generated("by gapic-generator-java")
+package com.google.shopping.merchant.conversions.v1;
+
+import javax.annotation.Generated;
diff --git a/java-shopping-merchant-conversions/google-shopping-merchant-conversions/src/main/java/com/google/shopping/merchant/conversions/v1/stub/ConversionSourcesServiceStub.java b/java-shopping-merchant-conversions/google-shopping-merchant-conversions/src/main/java/com/google/shopping/merchant/conversions/v1/stub/ConversionSourcesServiceStub.java
new file mode 100644
index 000000000000..488241b936b9
--- /dev/null
+++ b/java-shopping-merchant-conversions/google-shopping-merchant-conversions/src/main/java/com/google/shopping/merchant/conversions/v1/stub/ConversionSourcesServiceStub.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2025 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.conversions.v1.stub;
+
+import static com.google.shopping.merchant.conversions.v1.ConversionSourcesServiceClient.ListConversionSourcesPagedResponse;
+
+import com.google.api.gax.core.BackgroundResource;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.protobuf.Empty;
+import com.google.shopping.merchant.conversions.v1.ConversionSource;
+import com.google.shopping.merchant.conversions.v1.CreateConversionSourceRequest;
+import com.google.shopping.merchant.conversions.v1.DeleteConversionSourceRequest;
+import com.google.shopping.merchant.conversions.v1.GetConversionSourceRequest;
+import com.google.shopping.merchant.conversions.v1.ListConversionSourcesRequest;
+import com.google.shopping.merchant.conversions.v1.ListConversionSourcesResponse;
+import com.google.shopping.merchant.conversions.v1.UndeleteConversionSourceRequest;
+import com.google.shopping.merchant.conversions.v1.UpdateConversionSourceRequest;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * Base stub class for the ConversionSourcesService 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
+ * ConversionSourcesServiceStubSettings.Builder conversionSourcesServiceSettingsBuilder =
+ * ConversionSourcesServiceStubSettings.newBuilder();
+ * conversionSourcesServiceSettingsBuilder
+ * .createConversionSourceSettings()
+ * .setRetrySettings(
+ * conversionSourcesServiceSettingsBuilder
+ * .createConversionSourceSettings()
+ * .getRetrySettings()
+ * .toBuilder()
+ * .setInitialRetryDelayDuration(Duration.ofSeconds(1))
+ * .setInitialRpcTimeoutDuration(Duration.ofSeconds(5))
+ * .setMaxAttempts(5)
+ * .setMaxRetryDelayDuration(Duration.ofSeconds(30))
+ * .setMaxRpcTimeoutDuration(Duration.ofSeconds(60))
+ * .setRetryDelayMultiplier(1.3)
+ * .setRpcTimeoutMultiplier(1.5)
+ * .setTotalTimeoutDuration(Duration.ofSeconds(300))
+ * .build());
+ * ConversionSourcesServiceStubSettings conversionSourcesServiceSettings =
+ * conversionSourcesServiceSettingsBuilder.build();
+ * }
+ *
+ * Please refer to the [Client Side Retry
+ * Guide](https://github.com/googleapis/google-cloud-java/blob/main/docs/client_retries.md) for
+ * additional support in setting retries.
+ */
+@Generated("by gapic-generator-java")
+public class ConversionSourcesServiceStubSettings
+ extends StubSettings