All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.google.cloud.dialogflow.cx.v3beta1.ToolsClient Maven / Gradle / Ivy

Go to download

provides a new way of designing agents, taking a state machine approach to agent design. This gives you clear and explicit control over a conversation, a better end-user experience, and a better development workflow.

The newest version!
/*
 * 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.cloud.dialogflow.cx.v3beta1;

import com.google.api.core.ApiFuture;
import com.google.api.core.ApiFutures;
import com.google.api.core.BetaApi;
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.httpjson.longrunning.OperationsClient;
import com.google.api.gax.longrunning.OperationFuture;
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.OperationCallable;
import com.google.api.gax.rpc.PageContext;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.cloud.dialogflow.cx.v3beta1.stub.ToolsStub;
import com.google.cloud.dialogflow.cx.v3beta1.stub.ToolsStubSettings;
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.longrunning.Operation;
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 [Tools][google.cloud.dialogflow.cx.v3beta1.Tool].
 *
 * 

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 (ToolsClient toolsClient = ToolsClient.create()) {
 *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
 *   Tool tool = Tool.newBuilder().build();
 *   Tool response = toolsClient.createTool(parent, tool);
 * }
 * }
* *

Note: close() needs to be called on the ToolsClient object to clean up resources such as * threads. In the example above, try-with-resources is used, which automatically calls close(). * *

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Methods
MethodDescriptionMethod Variants

CreateTool

Creates a [Tool][google.cloud.dialogflow.cx.v3beta1.Tool] in the specified agent.

*

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

*
    *
  • createTool(CreateToolRequest request) *

*

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

*
    *
  • createTool(AgentName parent, Tool tool) *

  • createTool(String parent, Tool tool) *

*

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

*
    *
  • createToolCallable() *

*

ListTools

Returns a list of [Tools][google.cloud.dialogflow.cx.v3beta1.Tool] in the specified agent.

*

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

*
    *
  • listTools(ListToolsRequest request) *

*

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

*
    *
  • listTools(AgentName parent) *

  • listTools(String parent) *

*

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

*
    *
  • listToolsPagedCallable() *

  • listToolsCallable() *

*

ExportTools

Exports the selected tools.

*

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

*
    *
  • exportToolsAsync(ExportToolsRequest request) *

*

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

*
    *
  • exportToolsOperationCallable() *

  • exportToolsCallable() *

*

GetTool

Retrieves the specified [Tool][google.cloud.dialogflow.cx.v3beta1.Tool].

*

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

*
    *
  • getTool(GetToolRequest request) *

*

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

*
    *
  • getTool(ToolName name) *

  • getTool(String name) *

*

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

*
    *
  • getToolCallable() *

*

UpdateTool

Update the specified [Tool][google.cloud.dialogflow.cx.v3beta1.Tool].

*

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

*
    *
  • updateTool(UpdateToolRequest request) *

*

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

*
    *
  • updateTool(Tool tool, FieldMask updateMask) *

*

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

*
    *
  • updateToolCallable() *

*

DeleteTool

Deletes a specified [Tool][google.cloud.dialogflow.cx.v3beta1.Tool].

*

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

*
    *
  • deleteTool(DeleteToolRequest request) *

*

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

*
    *
  • deleteTool(ToolName name) *

  • deleteTool(String name) *

*

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

*
    *
  • deleteToolCallable() *

*

ListLocations

Lists information about the supported locations for this service.

*

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

*
    *
  • listLocations(ListLocationsRequest request) *

*

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

*
    *
  • listLocationsPagedCallable() *

  • listLocationsCallable() *

*

GetLocation

Gets information about a location.

*

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

*
    *
  • getLocation(GetLocationRequest request) *

*

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

*
    *
  • getLocationCallable() *

*
* *

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 ToolsSettings 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
 * ToolsSettings toolsSettings =
 *     ToolsSettings.newBuilder()
 *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
 *         .build();
 * ToolsClient toolsClient = ToolsClient.create(toolsSettings);
 * }
* *

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
 * ToolsSettings toolsSettings = ToolsSettings.newBuilder().setEndpoint(myEndpoint).build();
 * ToolsClient toolsClient = ToolsClient.create(toolsSettings);
 * }
* *

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
 * ToolsSettings toolsSettings = ToolsSettings.newHttpJsonBuilder().build();
 * ToolsClient toolsClient = ToolsClient.create(toolsSettings);
 * }
* *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ @BetaApi @Generated("by gapic-generator-java") public class ToolsClient implements BackgroundResource { private final ToolsSettings settings; private final ToolsStub stub; private final OperationsClient httpJsonOperationsClient; private final com.google.longrunning.OperationsClient operationsClient; /** Constructs an instance of ToolsClient with default settings. */ public static final ToolsClient create() throws IOException { return create(ToolsSettings.newBuilder().build()); } /** * Constructs an instance of ToolsClient, 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 ToolsClient create(ToolsSettings settings) throws IOException { return new ToolsClient(settings); } /** * Constructs an instance of ToolsClient, using the given stub for making calls. This is for * advanced usage - prefer using create(ToolsSettings). */ public static final ToolsClient create(ToolsStub stub) { return new ToolsClient(stub); } /** * Constructs an instance of ToolsClient, 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 ToolsClient(ToolsSettings settings) throws IOException { this.settings = settings; this.stub = ((ToolsStubSettings) settings.getStubSettings()).createStub(); this.operationsClient = com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); } protected ToolsClient(ToolsStub stub) { this.settings = null; this.stub = stub; this.operationsClient = com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); } public final ToolsSettings getSettings() { return settings; } public ToolsStub getStub() { return stub; } /** * Returns the OperationsClient that can be used to query the status of a long-running operation * returned by another API method call. */ public final com.google.longrunning.OperationsClient getOperationsClient() { return operationsClient; } /** * Returns the OperationsClient that can be used to query the status of a long-running operation * returned by another API method call. */ @BetaApi public final OperationsClient getHttpJsonOperationsClient() { return httpJsonOperationsClient; } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a [Tool][google.cloud.dialogflow.cx.v3beta1.Tool] 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 (ToolsClient toolsClient = ToolsClient.create()) {
   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
   *   Tool tool = Tool.newBuilder().build();
   *   Tool response = toolsClient.createTool(parent, tool);
   * }
   * }
* * @param parent Required. The agent to create a Tool for. Format: * `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>`. * @param tool Required. The Tool to be created. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Tool createTool(AgentName parent, Tool tool) { CreateToolRequest request = CreateToolRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setTool(tool) .build(); return createTool(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a [Tool][google.cloud.dialogflow.cx.v3beta1.Tool] 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 (ToolsClient toolsClient = ToolsClient.create()) {
   *   String parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString();
   *   Tool tool = Tool.newBuilder().build();
   *   Tool response = toolsClient.createTool(parent, tool);
   * }
   * }
* * @param parent Required. The agent to create a Tool for. Format: * `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>`. * @param tool Required. The Tool to be created. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Tool createTool(String parent, Tool tool) { CreateToolRequest request = CreateToolRequest.newBuilder().setParent(parent).setTool(tool).build(); return createTool(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a [Tool][google.cloud.dialogflow.cx.v3beta1.Tool] 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 (ToolsClient toolsClient = ToolsClient.create()) {
   *   CreateToolRequest request =
   *       CreateToolRequest.newBuilder()
   *           .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
   *           .setTool(Tool.newBuilder().build())
   *           .build();
   *   Tool response = toolsClient.createTool(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 Tool createTool(CreateToolRequest request) { return createToolCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a [Tool][google.cloud.dialogflow.cx.v3beta1.Tool] 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 (ToolsClient toolsClient = ToolsClient.create()) {
   *   CreateToolRequest request =
   *       CreateToolRequest.newBuilder()
   *           .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
   *           .setTool(Tool.newBuilder().build())
   *           .build();
   *   ApiFuture future = toolsClient.createToolCallable().futureCall(request);
   *   // Do something.
   *   Tool response = future.get();
   * }
   * }
*/ public final UnaryCallable createToolCallable() { return stub.createToolCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns a list of [Tools][google.cloud.dialogflow.cx.v3beta1.Tool] 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 (ToolsClient toolsClient = ToolsClient.create()) {
   *   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
   *   for (Tool element : toolsClient.listTools(parent).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
* * @param parent Required. The agent to list the Tools from. Format: * `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListToolsPagedResponse listTools(AgentName parent) { ListToolsRequest request = ListToolsRequest.newBuilder().setParent(parent == null ? null : parent.toString()).build(); return listTools(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns a list of [Tools][google.cloud.dialogflow.cx.v3beta1.Tool] 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 (ToolsClient toolsClient = ToolsClient.create()) {
   *   String parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString();
   *   for (Tool element : toolsClient.listTools(parent).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
* * @param parent Required. The agent to list the Tools from. Format: * `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListToolsPagedResponse listTools(String parent) { ListToolsRequest request = ListToolsRequest.newBuilder().setParent(parent).build(); return listTools(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns a list of [Tools][google.cloud.dialogflow.cx.v3beta1.Tool] 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 (ToolsClient toolsClient = ToolsClient.create()) {
   *   ListToolsRequest request =
   *       ListToolsRequest.newBuilder()
   *           .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   for (Tool element : toolsClient.listTools(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 ListToolsPagedResponse listTools(ListToolsRequest request) { return listToolsPagedCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns a list of [Tools][google.cloud.dialogflow.cx.v3beta1.Tool] 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 (ToolsClient toolsClient = ToolsClient.create()) {
   *   ListToolsRequest request =
   *       ListToolsRequest.newBuilder()
   *           .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   ApiFuture future = toolsClient.listToolsPagedCallable().futureCall(request);
   *   // Do something.
   *   for (Tool element : future.get().iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
*/ public final UnaryCallable listToolsPagedCallable() { return stub.listToolsPagedCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns a list of [Tools][google.cloud.dialogflow.cx.v3beta1.Tool] 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 (ToolsClient toolsClient = ToolsClient.create()) {
   *   ListToolsRequest request =
   *       ListToolsRequest.newBuilder()
   *           .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   while (true) {
   *     ListToolsResponse response = toolsClient.listToolsCallable().call(request);
   *     for (Tool element : response.getToolsList()) {
   *       // doThingsWith(element);
   *     }
   *     String nextPageToken = response.getNextPageToken();
   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
   *       request = request.toBuilder().setPageToken(nextPageToken).build();
   *     } else {
   *       break;
   *     }
   *   }
   * }
   * }
*/ public final UnaryCallable listToolsCallable() { return stub.listToolsCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Exports the selected tools. * *

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 (ToolsClient toolsClient = ToolsClient.create()) {
   *   ExportToolsRequest request =
   *       ExportToolsRequest.newBuilder()
   *           .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
   *           .addAllTools(new ArrayList())
   *           .build();
   *   ExportToolsResponse response = toolsClient.exportToolsAsync(request).get();
   * }
   * }
* * @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 OperationFuture exportToolsAsync( ExportToolsRequest request) { return exportToolsOperationCallable().futureCall(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Exports the selected tools. * *

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 (ToolsClient toolsClient = ToolsClient.create()) {
   *   ExportToolsRequest request =
   *       ExportToolsRequest.newBuilder()
   *           .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
   *           .addAllTools(new ArrayList())
   *           .build();
   *   OperationFuture future =
   *       toolsClient.exportToolsOperationCallable().futureCall(request);
   *   // Do something.
   *   ExportToolsResponse response = future.get();
   * }
   * }
*/ public final OperationCallable exportToolsOperationCallable() { return stub.exportToolsOperationCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Exports the selected tools. * *

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 (ToolsClient toolsClient = ToolsClient.create()) {
   *   ExportToolsRequest request =
   *       ExportToolsRequest.newBuilder()
   *           .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
   *           .addAllTools(new ArrayList())
   *           .build();
   *   ApiFuture future = toolsClient.exportToolsCallable().futureCall(request);
   *   // Do something.
   *   Operation response = future.get();
   * }
   * }
*/ public final UnaryCallable exportToolsCallable() { return stub.exportToolsCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified [Tool][google.cloud.dialogflow.cx.v3beta1.Tool]. * *

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 (ToolsClient toolsClient = ToolsClient.create()) {
   *   ToolName name = ToolName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TOOL]");
   *   Tool response = toolsClient.getTool(name);
   * }
   * }
* * @param name Required. The name of the Tool. Format: * `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/tools/<ToolID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Tool getTool(ToolName name) { GetToolRequest request = GetToolRequest.newBuilder().setName(name == null ? null : name.toString()).build(); return getTool(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified [Tool][google.cloud.dialogflow.cx.v3beta1.Tool]. * *

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 (ToolsClient toolsClient = ToolsClient.create()) {
   *   String name = ToolName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TOOL]").toString();
   *   Tool response = toolsClient.getTool(name);
   * }
   * }
* * @param name Required. The name of the Tool. Format: * `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/tools/<ToolID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Tool getTool(String name) { GetToolRequest request = GetToolRequest.newBuilder().setName(name).build(); return getTool(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified [Tool][google.cloud.dialogflow.cx.v3beta1.Tool]. * *

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 (ToolsClient toolsClient = ToolsClient.create()) {
   *   GetToolRequest request =
   *       GetToolRequest.newBuilder()
   *           .setName(ToolName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TOOL]").toString())
   *           .build();
   *   Tool response = toolsClient.getTool(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 Tool getTool(GetToolRequest request) { return getToolCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves the specified [Tool][google.cloud.dialogflow.cx.v3beta1.Tool]. * *

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 (ToolsClient toolsClient = ToolsClient.create()) {
   *   GetToolRequest request =
   *       GetToolRequest.newBuilder()
   *           .setName(ToolName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TOOL]").toString())
   *           .build();
   *   ApiFuture future = toolsClient.getToolCallable().futureCall(request);
   *   // Do something.
   *   Tool response = future.get();
   * }
   * }
*/ public final UnaryCallable getToolCallable() { return stub.getToolCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Update the specified [Tool][google.cloud.dialogflow.cx.v3beta1.Tool]. * *

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 (ToolsClient toolsClient = ToolsClient.create()) {
   *   Tool tool = Tool.newBuilder().build();
   *   FieldMask updateMask = FieldMask.newBuilder().build();
   *   Tool response = toolsClient.updateTool(tool, updateMask);
   * }
   * }
* * @param tool Required. The Tool to be updated. * @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 Tool updateTool(Tool tool, FieldMask updateMask) { UpdateToolRequest request = UpdateToolRequest.newBuilder().setTool(tool).setUpdateMask(updateMask).build(); return updateTool(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Update the specified [Tool][google.cloud.dialogflow.cx.v3beta1.Tool]. * *

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 (ToolsClient toolsClient = ToolsClient.create()) {
   *   UpdateToolRequest request =
   *       UpdateToolRequest.newBuilder()
   *           .setTool(Tool.newBuilder().build())
   *           .setUpdateMask(FieldMask.newBuilder().build())
   *           .build();
   *   Tool response = toolsClient.updateTool(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 Tool updateTool(UpdateToolRequest request) { return updateToolCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Update the specified [Tool][google.cloud.dialogflow.cx.v3beta1.Tool]. * *

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 (ToolsClient toolsClient = ToolsClient.create()) {
   *   UpdateToolRequest request =
   *       UpdateToolRequest.newBuilder()
   *           .setTool(Tool.newBuilder().build())
   *           .setUpdateMask(FieldMask.newBuilder().build())
   *           .build();
   *   ApiFuture future = toolsClient.updateToolCallable().futureCall(request);
   *   // Do something.
   *   Tool response = future.get();
   * }
   * }
*/ public final UnaryCallable updateToolCallable() { return stub.updateToolCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a specified [Tool][google.cloud.dialogflow.cx.v3beta1.Tool]. * *

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 (ToolsClient toolsClient = ToolsClient.create()) {
   *   ToolName name = ToolName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TOOL]");
   *   toolsClient.deleteTool(name);
   * }
   * }
* * @param name Required. The name of the Tool to be deleted. Format: * `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/tools/<ToolID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final void deleteTool(ToolName name) { DeleteToolRequest request = DeleteToolRequest.newBuilder().setName(name == null ? null : name.toString()).build(); deleteTool(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a specified [Tool][google.cloud.dialogflow.cx.v3beta1.Tool]. * *

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 (ToolsClient toolsClient = ToolsClient.create()) {
   *   String name = ToolName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TOOL]").toString();
   *   toolsClient.deleteTool(name);
   * }
   * }
* * @param name Required. The name of the Tool to be deleted. Format: * `projects/<ProjectID>/locations/<LocationID>/agents/<AgentID>/tools/<ToolID>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final void deleteTool(String name) { DeleteToolRequest request = DeleteToolRequest.newBuilder().setName(name).build(); deleteTool(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a specified [Tool][google.cloud.dialogflow.cx.v3beta1.Tool]. * *

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 (ToolsClient toolsClient = ToolsClient.create()) {
   *   DeleteToolRequest request =
   *       DeleteToolRequest.newBuilder()
   *           .setName(ToolName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TOOL]").toString())
   *           .setForce(true)
   *           .build();
   *   toolsClient.deleteTool(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 deleteTool(DeleteToolRequest request) { deleteToolCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a specified [Tool][google.cloud.dialogflow.cx.v3beta1.Tool]. * *

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 (ToolsClient toolsClient = ToolsClient.create()) {
   *   DeleteToolRequest request =
   *       DeleteToolRequest.newBuilder()
   *           .setName(ToolName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TOOL]").toString())
   *           .setForce(true)
   *           .build();
   *   ApiFuture future = toolsClient.deleteToolCallable().futureCall(request);
   *   // Do something.
   *   future.get();
   * }
   * }
*/ public final UnaryCallable deleteToolCallable() { return stub.deleteToolCallable(); } // 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 (ToolsClient toolsClient = ToolsClient.create()) {
   *   ListLocationsRequest request =
   *       ListLocationsRequest.newBuilder()
   *           .setName("name3373707")
   *           .setFilter("filter-1274492040")
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   for (Location element : toolsClient.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 (ToolsClient toolsClient = ToolsClient.create()) {
   *   ListLocationsRequest request =
   *       ListLocationsRequest.newBuilder()
   *           .setName("name3373707")
   *           .setFilter("filter-1274492040")
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   ApiFuture future = toolsClient.listLocationsPagedCallable().futureCall(request);
   *   // Do something.
   *   for (Location element : future.get().iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
*/ public final UnaryCallable listLocationsPagedCallable() { return stub.listLocationsPagedCallable(); } // 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 (ToolsClient toolsClient = ToolsClient.create()) {
   *   ListLocationsRequest request =
   *       ListLocationsRequest.newBuilder()
   *           .setName("name3373707")
   *           .setFilter("filter-1274492040")
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   while (true) {
   *     ListLocationsResponse response = toolsClient.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 listLocationsCallable() { return stub.listLocationsCallable(); } // 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 (ToolsClient toolsClient = ToolsClient.create()) {
   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
   *   Location response = toolsClient.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 (ToolsClient toolsClient = ToolsClient.create()) {
   *   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
   *   ApiFuture future = toolsClient.getLocationCallable().futureCall(request);
   *   // Do something.
   *   Location response = future.get();
   * }
   * }
*/ public final UnaryCallable getLocationCallable() { return stub.getLocationCallable(); } @Override public final void close() { stub.close(); } @Override public void shutdown() { stub.shutdown(); } @Override public boolean isShutdown() { return stub.isShutdown(); } @Override public boolean isTerminated() { return stub.isTerminated(); } @Override public void shutdownNow() { stub.shutdownNow(); } @Override public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { return stub.awaitTermination(duration, unit); } public static class ListToolsPagedResponse extends AbstractPagedListResponse< ListToolsRequest, ListToolsResponse, Tool, ListToolsPage, ListToolsFixedSizeCollection> { public static ApiFuture createAsync( PageContext context, ApiFuture futureResponse) { ApiFuture futurePage = ListToolsPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( futurePage, input -> new ListToolsPagedResponse(input), MoreExecutors.directExecutor()); } private ListToolsPagedResponse(ListToolsPage page) { super(page, ListToolsFixedSizeCollection.createEmptyCollection()); } } public static class ListToolsPage extends AbstractPage { private ListToolsPage( PageContext context, ListToolsResponse response) { super(context, response); } private static ListToolsPage createEmptyPage() { return new ListToolsPage(null, null); } @Override protected ListToolsPage createPage( PageContext context, ListToolsResponse response) { return new ListToolsPage(context, response); } @Override public ApiFuture createPageAsync( PageContext context, ApiFuture futureResponse) { return super.createPageAsync(context, futureResponse); } } public static class ListToolsFixedSizeCollection extends AbstractFixedSizeCollection< ListToolsRequest, ListToolsResponse, Tool, ListToolsPage, ListToolsFixedSizeCollection> { private ListToolsFixedSizeCollection(List pages, int collectionSize) { super(pages, collectionSize); } private static ListToolsFixedSizeCollection createEmptyCollection() { return new ListToolsFixedSizeCollection(null, 0); } @Override protected ListToolsFixedSizeCollection createCollection( List pages, int collectionSize) { return new ListToolsFixedSizeCollection(pages, collectionSize); } } public static class ListLocationsPagedResponse extends AbstractPagedListResponse< ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage, ListLocationsFixedSizeCollection> { public static ApiFuture createAsync( PageContext context, ApiFuture futureResponse) { ApiFuture futurePage = ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( futurePage, input -> new ListLocationsPagedResponse(input), MoreExecutors.directExecutor()); } private ListLocationsPagedResponse(ListLocationsPage page) { super(page, ListLocationsFixedSizeCollection.createEmptyCollection()); } } public static class ListLocationsPage extends AbstractPage< ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> { private ListLocationsPage( PageContext context, ListLocationsResponse response) { super(context, response); } private static ListLocationsPage createEmptyPage() { return new ListLocationsPage(null, null); } @Override protected ListLocationsPage createPage( PageContext context, ListLocationsResponse response) { return new ListLocationsPage(context, response); } @Override public ApiFuture createPageAsync( PageContext context, ApiFuture futureResponse) { return super.createPageAsync(context, futureResponse); } } public static class ListLocationsFixedSizeCollection extends AbstractFixedSizeCollection< ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage, ListLocationsFixedSizeCollection> { private ListLocationsFixedSizeCollection(List pages, int collectionSize) { super(pages, collectionSize); } private static ListLocationsFixedSizeCollection createEmptyCollection() { return new ListLocationsFixedSizeCollection(null, 0); } @Override protected ListLocationsFixedSizeCollection createCollection( List pages, int collectionSize) { return new ListLocationsFixedSizeCollection(pages, collectionSize); } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy