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. + */ +@BetaApi +@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+ */ + public final UnaryCallablefuture = + * conversionSourcesServiceClient.createConversionSourceCallable().futureCall(request); + * // Do something. + * ConversionSource 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 (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. Format: + * accounts/{account}/conversionSources/{conversion_source} + * @param updateMask Required. 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+ */ + public final UnaryCallablefuture = + * conversionSourcesServiceClient.updateConversionSourceCallable().futureCall(request); + * // Do something. + * ConversionSource 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 (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+ */ + public final UnaryCallablefuture = + * conversionSourcesServiceClient.deleteConversionSourceCallable().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 (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+ */ + public final UnaryCallablefuture = + * conversionSourcesServiceClient.undeleteConversionSourceCallable().futureCall(request); + * // Do something. + * ConversionSource 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 (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+ */ + public final UnaryCallablefuture = + * conversionSourcesServiceClient.getConversionSourceCallable().futureCall(request); + * // Do something. + * ConversionSource 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 (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+ */ + public final UnaryCallablefuture = + * conversionSourcesServiceClient.listConversionSourcesPagedCallable().futureCall(request); + * // Do something. + * for (ConversionSource 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 (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 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 createConversionSource 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 + * ConversionSourcesServiceSettings.Builder conversionSourcesServiceSettingsBuilder = + * ConversionSourcesServiceSettings.newBuilder(); + * conversionSourcesServiceSettingsBuilder + * .createConversionSourceSettings() + * .setRetrySettings( + * conversionSourcesServiceSettingsBuilder + * .createConversionSourceSettings() + * .getRetrySettings() + * .toBuilder() + * .setTotalTimeout(Duration.ofSeconds(30)) + * .build()); + * ConversionSourcesServiceSettings conversionSourcesServiceSettings = + * conversionSourcesServiceSettingsBuilder.build(); + * }+ */ +@BetaApi +@Generated("by gapic-generator-java") +public class ConversionSourcesServiceSettings + 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.
+ *
+ * ======================= 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.
+ */
+@BetaApi
+@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 total timeout of createConversionSource to 30 seconds:
+ *
+ * Note: This method does not support applying settings to streaming methods.
+ */
+ public Builder applyToAllUnaryMethods(
+ ApiFunction This class is for advanced usage.
+ */
+@BetaApi
+@Generated("by gapic-generator-java")
+public class GrpcConversionSourcesServiceCallableFactory implements GrpcStubCallableFactory {
+
+ @Override
+ public This class is for advanced usage and reflects the underlying API directly.
+ */
+@BetaApi
+@Generated("by gapic-generator-java")
+public class GrpcConversionSourcesServiceStub extends ConversionSourcesServiceStub {
+ private static final MethodDescriptor This class is for advanced usage.
+ */
+@BetaApi
+@Generated("by gapic-generator-java")
+public class HttpJsonConversionSourcesServiceCallableFactory
+ implements HttpJsonStubCallableFactory This class is for advanced usage and reflects the underlying API directly.
+ */
+@BetaApi
+@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.v1beta;
+
+import javax.annotation.Generated;
diff --git a/java-shopping-merchant-conversions/google-shopping-merchant-conversions/src/main/java/com/google/shopping/merchant/conversions/v1beta/stub/ConversionSourcesServiceStub.java b/java-shopping-merchant-conversions/google-shopping-merchant-conversions/src/main/java/com/google/shopping/merchant/conversions/v1beta/stub/ConversionSourcesServiceStub.java
new file mode 100644
index 000000000000..11df202a912e
--- /dev/null
+++ b/java-shopping-merchant-conversions/google-shopping-merchant-conversions/src/main/java/com/google/shopping/merchant/conversions/v1beta/stub/ConversionSourcesServiceStub.java
@@ -0,0 +1,81 @@
+/*
+ * 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.conversions.v1beta.stub;
+
+import static com.google.shopping.merchant.conversions.v1beta.ConversionSourcesServiceClient.ListConversionSourcesPagedResponse;
+
+import com.google.api.core.BetaApi;
+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.v1beta.ConversionSource;
+import com.google.shopping.merchant.conversions.v1beta.CreateConversionSourceRequest;
+import com.google.shopping.merchant.conversions.v1beta.DeleteConversionSourceRequest;
+import com.google.shopping.merchant.conversions.v1beta.GetConversionSourceRequest;
+import com.google.shopping.merchant.conversions.v1beta.ListConversionSourcesRequest;
+import com.google.shopping.merchant.conversions.v1beta.ListConversionSourcesResponse;
+import com.google.shopping.merchant.conversions.v1beta.UndeleteConversionSourceRequest;
+import com.google.shopping.merchant.conversions.v1beta.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()
+ * .setTotalTimeout(Duration.ofSeconds(30))
+ * .build());
+ * ConversionSourcesServiceStubSettings conversionSourcesServiceSettings =
+ * conversionSourcesServiceSettingsBuilder.build();
+ * }
+ */
+@BetaApi
+@Generated("by gapic-generator-java")
+public class ConversionSourcesServiceStubSettings
+ extends StubSettings