diff --git a/java-dialogflow-cx/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/GeneratorsClient.java b/java-dialogflow-cx/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/GeneratorsClient.java new file mode 100644 index 000000000000..428583b6686b --- /dev/null +++ b/java-dialogflow-cx/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/GeneratorsClient.java @@ -0,0 +1,1129 @@ +/* + * Copyright 2023 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.cloud.dialogflow.cx.v3; + +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.dialogflow.cx.v3.stub.GeneratorsStub; +import com.google.cloud.dialogflow.cx.v3.stub.GeneratorsStubSettings; +import com.google.cloud.location.GetLocationRequest; +import com.google.cloud.location.ListLocationsRequest; +import com.google.cloud.location.ListLocationsResponse; +import com.google.cloud.location.Location; +import com.google.common.util.concurrent.MoreExecutors; +import com.google.protobuf.Empty; +import com.google.protobuf.FieldMask; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Service Description: Service for managing [Generators][google.cloud.dialogflow.cx.v3.Generator] + * + *
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 (GeneratorsClient generatorsClient = GeneratorsClient.create()) { + * GeneratorName name = GeneratorName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[GENERATOR]"); + * Generator response = generatorsClient.getGenerator(name); + * } + * }+ * + *
Note: close() needs to be called on the GeneratorsClient object to clean up resources such as + * threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *
The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *
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 GeneratorsSettings 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 + * GeneratorsSettings generatorsSettings = + * GeneratorsSettings.newBuilder() + * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + * .build(); + * GeneratorsClient generatorsClient = GeneratorsClient.create(generatorsSettings); + * }+ * + *
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 + * GeneratorsSettings generatorsSettings = + * GeneratorsSettings.newBuilder().setEndpoint(myEndpoint).build(); + * GeneratorsClient generatorsClient = GeneratorsClient.create(generatorsSettings); + * }+ * + *
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 + * GeneratorsSettings generatorsSettings = GeneratorsSettings.newHttpJsonBuilder().build(); + * GeneratorsClient generatorsClient = GeneratorsClient.create(generatorsSettings); + * }+ * + *
Please refer to the GitHub repository's samples for more quickstart code snippets. + */ +@Generated("by gapic-generator-java") +public class GeneratorsClient implements BackgroundResource { + private final GeneratorsSettings settings; + private final GeneratorsStub stub; + + /** Constructs an instance of GeneratorsClient with default settings. */ + public static final GeneratorsClient create() throws IOException { + return create(GeneratorsSettings.newBuilder().build()); + } + + /** + * Constructs an instance of GeneratorsClient, 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 GeneratorsClient create(GeneratorsSettings settings) throws IOException { + return new GeneratorsClient(settings); + } + + /** + * Constructs an instance of GeneratorsClient, using the given stub for making calls. This is for + * advanced usage - prefer using create(GeneratorsSettings). + */ + public static final GeneratorsClient create(GeneratorsStub stub) { + return new GeneratorsClient(stub); + } + + /** + * Constructs an instance of GeneratorsClient, 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 GeneratorsClient(GeneratorsSettings settings) throws IOException { + this.settings = settings; + this.stub = ((GeneratorsStubSettings) settings.getStubSettings()).createStub(); + } + + protected GeneratorsClient(GeneratorsStub stub) { + this.settings = null; + this.stub = stub; + } + + public final GeneratorsSettings getSettings() { + return settings; + } + + public GeneratorsStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns the list of all generators in the specified agent. + * + *
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 (GeneratorsClient generatorsClient = GeneratorsClient.create()) { + * AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]"); + * for (Generator element : generatorsClient.listGenerators(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * + * @param parent Required. The agent to list all generators for. Format: `projects/<Project + * ID>/locations/<Location ID>/agents/<Agent ID>`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListGeneratorsPagedResponse listGenerators(AgentName parent) { + ListGeneratorsRequest request = + ListGeneratorsRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .build(); + return listGenerators(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns the list of all generators in the specified agent. + * + *
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 (GeneratorsClient generatorsClient = GeneratorsClient.create()) { + * String parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString(); + * for (Generator element : generatorsClient.listGenerators(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * + * @param parent Required. The agent to list all generators for. Format: `projects/<Project + * ID>/locations/<Location ID>/agents/<Agent ID>`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListGeneratorsPagedResponse listGenerators(String parent) { + ListGeneratorsRequest request = ListGeneratorsRequest.newBuilder().setParent(parent).build(); + return listGenerators(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns the list of all generators in the specified agent. + * + *
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 (GeneratorsClient generatorsClient = GeneratorsClient.create()) { + * ListGeneratorsRequest request = + * ListGeneratorsRequest.newBuilder() + * .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString()) + * .setLanguageCode("languageCode-2092349083") + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * for (Generator element : generatorsClient.listGenerators(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 ListGeneratorsPagedResponse listGenerators(ListGeneratorsRequest request) { + return listGeneratorsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns the list of all generators in the specified agent. + * + *
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 (GeneratorsClient generatorsClient = GeneratorsClient.create()) { + * ListGeneratorsRequest request = + * ListGeneratorsRequest.newBuilder() + * .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString()) + * .setLanguageCode("languageCode-2092349083") + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * generatorsClient.listGeneratorsPagedCallable().futureCall(request); + * // Do something. + * for (Generator 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 (GeneratorsClient generatorsClient = GeneratorsClient.create()) { + * ListGeneratorsRequest request = + * ListGeneratorsRequest.newBuilder() + * .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString()) + * .setLanguageCode("languageCode-2092349083") + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * while (true) { + * ListGeneratorsResponse response = generatorsClient.listGeneratorsCallable().call(request); + * for (Generator element : response.getGeneratorsList()) { + * // doThingsWith(element); + * } + * String nextPageToken = response.getNextPageToken(); + * if (!Strings.isNullOrEmpty(nextPageToken)) { + * request = request.toBuilder().setPageToken(nextPageToken).build(); + * } else { + * break; + * } + * } + * } + * }+ */ + public final UnaryCallable
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 (GeneratorsClient generatorsClient = GeneratorsClient.create()) { + * GeneratorName name = GeneratorName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[GENERATOR]"); + * Generator response = generatorsClient.getGenerator(name); + * } + * }+ * + * @param name Required. The name of the generator. Format: `projects/<Project + * ID>/locations/<Location ID>/agents/<Agent ID>/generators/<Generator + * ID>`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Generator getGenerator(GeneratorName name) { + GetGeneratorRequest request = + GetGeneratorRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return getGenerator(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Retrieves the specified generator. + * + *
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 (GeneratorsClient generatorsClient = GeneratorsClient.create()) { + * String name = + * GeneratorName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[GENERATOR]").toString(); + * Generator response = generatorsClient.getGenerator(name); + * } + * }+ * + * @param name Required. The name of the generator. Format: `projects/<Project + * ID>/locations/<Location ID>/agents/<Agent ID>/generators/<Generator + * ID>`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Generator getGenerator(String name) { + GetGeneratorRequest request = GetGeneratorRequest.newBuilder().setName(name).build(); + return getGenerator(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Retrieves the specified generator. + * + *
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 (GeneratorsClient generatorsClient = GeneratorsClient.create()) { + * GetGeneratorRequest request = + * GetGeneratorRequest.newBuilder() + * .setName( + * GeneratorName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[GENERATOR]").toString()) + * .setLanguageCode("languageCode-2092349083") + * .build(); + * Generator response = generatorsClient.getGenerator(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 Generator getGenerator(GetGeneratorRequest request) { + return getGeneratorCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Retrieves the specified generator. + * + *
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 (GeneratorsClient generatorsClient = GeneratorsClient.create()) { + * GetGeneratorRequest request = + * GetGeneratorRequest.newBuilder() + * .setName( + * GeneratorName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[GENERATOR]").toString()) + * .setLanguageCode("languageCode-2092349083") + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = generatorsClient.getGeneratorCallable().futureCall(request); + * // Do something. + * Generator 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 (GeneratorsClient generatorsClient = GeneratorsClient.create()) { + * AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]"); + * Generator generator = Generator.newBuilder().build(); + * Generator response = generatorsClient.createGenerator(parent, generator); + * } + * }+ * + * @param parent Required. The agent to create a generator for. Format: `projects/<Project + * ID>/locations/<Location ID>/agents/<Agent ID>`. + * @param generator Required. The generator to create. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Generator createGenerator(AgentName parent, Generator generator) { + CreateGeneratorRequest request = + CreateGeneratorRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .setGenerator(generator) + .build(); + return createGenerator(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a generator in the specified agent. + * + *
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 (GeneratorsClient generatorsClient = GeneratorsClient.create()) { + * String parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString(); + * Generator generator = Generator.newBuilder().build(); + * Generator response = generatorsClient.createGenerator(parent, generator); + * } + * }+ * + * @param parent Required. The agent to create a generator for. Format: `projects/<Project + * ID>/locations/<Location ID>/agents/<Agent ID>`. + * @param generator Required. The generator to create. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Generator createGenerator(String parent, Generator generator) { + CreateGeneratorRequest request = + CreateGeneratorRequest.newBuilder().setParent(parent).setGenerator(generator).build(); + return createGenerator(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a generator in the specified agent. + * + *
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 (GeneratorsClient generatorsClient = GeneratorsClient.create()) { + * CreateGeneratorRequest request = + * CreateGeneratorRequest.newBuilder() + * .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString()) + * .setGenerator(Generator.newBuilder().build()) + * .setLanguageCode("languageCode-2092349083") + * .build(); + * Generator response = generatorsClient.createGenerator(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 Generator createGenerator(CreateGeneratorRequest request) { + return createGeneratorCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a generator in the specified agent. + * + *
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 (GeneratorsClient generatorsClient = GeneratorsClient.create()) { + * CreateGeneratorRequest request = + * CreateGeneratorRequest.newBuilder() + * .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString()) + * .setGenerator(Generator.newBuilder().build()) + * .setLanguageCode("languageCode-2092349083") + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = generatorsClient.createGeneratorCallable().futureCall(request); + * // Do something. + * Generator 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 (GeneratorsClient generatorsClient = GeneratorsClient.create()) { + * Generator generator = Generator.newBuilder().build(); + * FieldMask updateMask = FieldMask.newBuilder().build(); + * Generator response = generatorsClient.updateGenerator(generator, updateMask); + * } + * }+ * + * @param generator Required. The generator to update. + * @param updateMask The mask to control which fields get updated. If the mask is not present, all + * fields will be updated. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Generator updateGenerator(Generator generator, FieldMask updateMask) { + UpdateGeneratorRequest request = + UpdateGeneratorRequest.newBuilder() + .setGenerator(generator) + .setUpdateMask(updateMask) + .build(); + return updateGenerator(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Update the specified generator. + * + *
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 (GeneratorsClient generatorsClient = GeneratorsClient.create()) { + * UpdateGeneratorRequest request = + * UpdateGeneratorRequest.newBuilder() + * .setGenerator(Generator.newBuilder().build()) + * .setLanguageCode("languageCode-2092349083") + * .setUpdateMask(FieldMask.newBuilder().build()) + * .build(); + * Generator response = generatorsClient.updateGenerator(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 Generator updateGenerator(UpdateGeneratorRequest request) { + return updateGeneratorCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Update the specified generator. + * + *
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 (GeneratorsClient generatorsClient = GeneratorsClient.create()) { + * UpdateGeneratorRequest request = + * UpdateGeneratorRequest.newBuilder() + * .setGenerator(Generator.newBuilder().build()) + * .setLanguageCode("languageCode-2092349083") + * .setUpdateMask(FieldMask.newBuilder().build()) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = generatorsClient.updateGeneratorCallable().futureCall(request); + * // Do something. + * Generator 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 (GeneratorsClient generatorsClient = GeneratorsClient.create()) { + * GeneratorName name = GeneratorName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[GENERATOR]"); + * generatorsClient.deleteGenerator(name); + * } + * }+ * + * @param name Required. The name of the generator to delete. Format: `projects/<Project + * ID>/locations/<Location ID>/agents/<Agent ID>/generators/<Generator + * ID>`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteGenerator(GeneratorName name) { + DeleteGeneratorRequest request = + DeleteGeneratorRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + deleteGenerator(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes the specified generators. + * + *
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 (GeneratorsClient generatorsClient = GeneratorsClient.create()) { + * String name = + * GeneratorName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[GENERATOR]").toString(); + * generatorsClient.deleteGenerator(name); + * } + * }+ * + * @param name Required. The name of the generator to delete. Format: `projects/<Project + * ID>/locations/<Location ID>/agents/<Agent ID>/generators/<Generator + * ID>`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteGenerator(String name) { + DeleteGeneratorRequest request = DeleteGeneratorRequest.newBuilder().setName(name).build(); + deleteGenerator(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes the specified generators. + * + *
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 (GeneratorsClient generatorsClient = GeneratorsClient.create()) { + * DeleteGeneratorRequest request = + * DeleteGeneratorRequest.newBuilder() + * .setName( + * GeneratorName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[GENERATOR]").toString()) + * .setForce(true) + * .build(); + * generatorsClient.deleteGenerator(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 deleteGenerator(DeleteGeneratorRequest request) { + deleteGeneratorCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes the specified generators. + * + *
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 (GeneratorsClient generatorsClient = GeneratorsClient.create()) { + * DeleteGeneratorRequest request = + * DeleteGeneratorRequest.newBuilder() + * .setName( + * GeneratorName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[GENERATOR]").toString()) + * .setForce(true) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = generatorsClient.deleteGeneratorCallable().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 (GeneratorsClient generatorsClient = GeneratorsClient.create()) { + * ListLocationsRequest request = + * ListLocationsRequest.newBuilder() + * .setName("name3373707") + * .setFilter("filter-1274492040") + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * for (Location element : generatorsClient.listLocations(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 ListLocationsPagedResponse listLocations(ListLocationsRequest request) { + return listLocationsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *
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 (GeneratorsClient generatorsClient = GeneratorsClient.create()) { + * ListLocationsRequest request = + * ListLocationsRequest.newBuilder() + * .setName("name3373707") + * .setFilter("filter-1274492040") + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * generatorsClient.listLocationsPagedCallable().futureCall(request); + * // Do something. + * for (Location 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 (GeneratorsClient generatorsClient = GeneratorsClient.create()) { + * ListLocationsRequest request = + * ListLocationsRequest.newBuilder() + * .setName("name3373707") + * .setFilter("filter-1274492040") + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * while (true) { + * ListLocationsResponse response = generatorsClient.listLocationsCallable().call(request); + * for (Location element : response.getLocationsList()) { + * // doThingsWith(element); + * } + * String nextPageToken = response.getNextPageToken(); + * if (!Strings.isNullOrEmpty(nextPageToken)) { + * request = request.toBuilder().setPageToken(nextPageToken).build(); + * } else { + * break; + * } + * } + * } + * }+ */ + public final UnaryCallable
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 (GeneratorsClient generatorsClient = GeneratorsClient.create()) { + * GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + * Location response = generatorsClient.getLocation(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 Location getLocation(GetLocationRequest request) { + return getLocationCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *
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 (GeneratorsClient generatorsClient = GeneratorsClient.create()) { + * GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + * ApiFuture+ */ + public final UnaryCallablefuture = generatorsClient.getLocationCallable().futureCall(request); + * // Do something. + * Location response = future.get(); + * } + * }
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 getGenerator 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 + * GeneratorsSettings.Builder generatorsSettingsBuilder = GeneratorsSettings.newBuilder(); + * generatorsSettingsBuilder + * .getGeneratorSettings() + * .setRetrySettings( + * generatorsSettingsBuilder + * .getGeneratorSettings() + * .getRetrySettings() + * .toBuilder() + * .setTotalTimeout(Duration.ofSeconds(30)) + * .build()); + * GeneratorsSettings generatorsSettings = generatorsSettingsBuilder.build(); + * }+ */ +@Generated("by gapic-generator-java") +public class GeneratorsSettings extends ClientSettings
Note: This method does not support applying settings to streaming methods.
+ */
+ public Builder applyToAllUnaryMethods(
+ ApiFunction ======================= GeneratorsClient =======================
+ *
+ * Service Description: Service for managing
+ * [Generators][google.cloud.dialogflow.cx.v3.Generator]
+ *
+ * Sample for GeneratorsClient:
+ *
+ * ======================= IntentsClient =======================
*
* Service Description: Service for managing [Intents][google.cloud.dialogflow.cx.v3.Intent].
diff --git a/java-dialogflow-cx/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GeneratorsStub.java b/java-dialogflow-cx/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GeneratorsStub.java
new file mode 100644
index 000000000000..d80ce509c4e9
--- /dev/null
+++ b/java-dialogflow-cx/google-cloud-dialogflow-cx/src/main/java/com/google/cloud/dialogflow/cx/v3/stub/GeneratorsStub.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2023 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.cloud.dialogflow.cx.v3.stub;
+
+import static com.google.cloud.dialogflow.cx.v3.GeneratorsClient.ListGeneratorsPagedResponse;
+import static com.google.cloud.dialogflow.cx.v3.GeneratorsClient.ListLocationsPagedResponse;
+
+import com.google.api.gax.core.BackgroundResource;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.cloud.dialogflow.cx.v3.CreateGeneratorRequest;
+import com.google.cloud.dialogflow.cx.v3.DeleteGeneratorRequest;
+import com.google.cloud.dialogflow.cx.v3.Generator;
+import com.google.cloud.dialogflow.cx.v3.GetGeneratorRequest;
+import com.google.cloud.dialogflow.cx.v3.ListGeneratorsRequest;
+import com.google.cloud.dialogflow.cx.v3.ListGeneratorsResponse;
+import com.google.cloud.dialogflow.cx.v3.UpdateGeneratorRequest;
+import com.google.cloud.location.GetLocationRequest;
+import com.google.cloud.location.ListLocationsRequest;
+import com.google.cloud.location.ListLocationsResponse;
+import com.google.cloud.location.Location;
+import com.google.protobuf.Empty;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * Base stub class for the Generators service API.
+ *
+ * This class is for advanced usage and reflects the underlying API directly.
+ */
+@Generated("by gapic-generator-java")
+public abstract class GeneratorsStub 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 getGenerator to 30 seconds:
+ *
+ * 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 GrpcGeneratorsCallableFactory implements GrpcStubCallableFactory {
+
+ @Override
+ public This class is for advanced usage and reflects the underlying API directly.
+ */
+@Generated("by gapic-generator-java")
+public class GrpcGeneratorsStub extends GeneratorsStub {
+ private static final MethodDescriptor This class is for advanced usage.
+ */
+@Generated("by gapic-generator-java")
+@BetaApi
+public class HttpJsonGeneratorsCallableFactory
+ implements HttpJsonStubCallableFactory This class is for advanced usage and reflects the underlying API directly.
+ */
+@Generated("by gapic-generator-java")
+@BetaApi
+public class HttpJsonGeneratorsStub extends GeneratorsStub {
+ 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 (GeneratorsClient generatorsClient = GeneratorsClient.create()) {
+ * GeneratorName name = GeneratorName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[GENERATOR]");
+ * Generator response = generatorsClient.getGenerator(name);
+ * }
+ * }
+ *
*
+ *
+ *
+ * {@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
+ * GeneratorsStubSettings.Builder generatorsSettingsBuilder = GeneratorsStubSettings.newBuilder();
+ * generatorsSettingsBuilder
+ * .getGeneratorSettings()
+ * .setRetrySettings(
+ * generatorsSettingsBuilder
+ * .getGeneratorSettings()
+ * .getRetrySettings()
+ * .toBuilder()
+ * .setTotalTimeout(Duration.ofSeconds(30))
+ * .build());
+ * GeneratorsStubSettings generatorsSettings = generatorsSettingsBuilder.build();
+ * }
+ */
+@Generated("by gapic-generator-java")
+public class GeneratorsStubSettings extends StubSettings