Class DataChatServiceClient

java.lang.Object
com.google.cloud.geminidataanalytics.v1beta.DataChatServiceClient
All Implemented Interfaces:
BackgroundResource, AutoCloseable

@BetaApi @Generated("by gapic-generator-java") public class DataChatServiceClient extends Object implements BackgroundResource
Service Description: Service to ask a natural language question on top of BigQuery and Looker Studio datasources to get back streamed responses of various kinds to help provide a rich conversational answer.

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:


 // 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 (DataChatServiceClient dataChatServiceClient = DataChatServiceClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   Conversation conversation = Conversation.newBuilder().build();
   String conversationId = "conversationId-1676095234";
   Conversation response =
       dataChatServiceClient.createConversation(parent, conversation, conversationId);
 }
 

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

Methods
Method Description Method Variants

Chat

Answers a data question by generating a stream of [Message][google.cloud.geminidataanalytics.v1alpha.Message] objects.

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

  • chatCallable()

CreateConversation

Creates a new conversation to persist the conversation history. Each conversation will have multiple messages associated with it.

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

  • createConversation(CreateConversationRequest request)

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

  • createConversation(LocationName parent, Conversation conversation, String conversationId)

  • createConversation(String parent, Conversation conversation, String conversationId)

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

  • createConversationCallable()

DeleteConversation

Deletes a conversation.

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

  • deleteConversation(DeleteConversationRequest request)

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

  • deleteConversation(ConversationName name)

  • deleteConversation(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.

  • deleteConversationCallable()

GetConversation

Gets details of a single conversation by using conversation id and parent.

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

  • getConversation(GetConversationRequest request)

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

  • getConversation(ConversationName name)

  • getConversation(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.

  • getConversationCallable()

ListConversations

Lists all conversations for a given parent.

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

  • listConversations(ListConversationsRequest request)

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

  • listConversations(LocationName parent)

  • listConversations(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.

  • listConversationsPagedCallable()

  • listConversationsCallable()

ListMessages

Lists all messages for a given conversation.

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

  • listMessages(ListMessagesRequest request)

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

  • listMessages(ConversationName parent)

  • listMessages(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.

  • listMessagesPagedCallable()

  • listMessagesCallable()

QueryData

Queries data from a natural language user query.

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

  • queryData(QueryDataRequest request)

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

  • queryDataCallable()

ListLocations

Lists information about the supported locations for this service.This method can be called in two ways:

* **List all public locations:** Use the path `GET /v1/locations`.* **List project-visible locations:** Use the path`GET /v1/projects/{project_id}/locations`. This may include publiclocations as well as private or other locations specifically visibleto the project.

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 DataChatServiceSettings to create(). For example:

To customize credentials:


 // 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
 DataChatServiceSettings dataChatServiceSettings =
     DataChatServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 DataChatServiceClient dataChatServiceClient =
     DataChatServiceClient.create(dataChatServiceSettings);
 

To customize the endpoint:


 // 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
 DataChatServiceSettings dataChatServiceSettings =
     DataChatServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 DataChatServiceClient dataChatServiceClient =
     DataChatServiceClient.create(dataChatServiceSettings);
 

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:


 // 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
 DataChatServiceSettings dataChatServiceSettings =
     DataChatServiceSettings.newHttpJsonBuilder().build();
 DataChatServiceClient dataChatServiceClient =
     DataChatServiceClient.create(dataChatServiceSettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

  • Constructor Details

    • DataChatServiceClient

      protected DataChatServiceClient(DataChatServiceSettings settings) throws IOException
      Constructs an instance of DataChatServiceClient, 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.
      Throws:
      IOException
    • DataChatServiceClient

      protected DataChatServiceClient(DataChatServiceStub stub)
  • Method Details

    • create

      public static final DataChatServiceClient create() throws IOException
      Constructs an instance of DataChatServiceClient with default settings.
      Throws:
      IOException
    • create

      public static final DataChatServiceClient create(DataChatServiceSettings settings) throws IOException
      Constructs an instance of DataChatServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
      Throws:
      IOException
    • create

      public static final DataChatServiceClient create(DataChatServiceStub stub)
      Constructs an instance of DataChatServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(DataChatServiceSettings).
    • getSettings

      public final DataChatServiceSettings getSettings()
    • getStub

      public DataChatServiceStub getStub()
    • chatCallable

      public final ServerStreamingCallable<ChatRequest,Message> chatCallable()
      Answers a data question by generating a stream of [Message][google.cloud.geminidataanalytics.v1alpha.Message] objects.

      Sample 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 (DataChatServiceClient dataChatServiceClient = DataChatServiceClient.create()) {
         ChatRequest request =
             ChatRequest.newBuilder()
                 .setProject(ProjectName.of("[PROJECT]").toString())
                 .setParent("parent-995424086")
                 .addAllMessages(new ArrayList<Message>())
                 .build();
         ServerStream<Message> stream = dataChatServiceClient.chatCallable().call(request);
         for (Message response : stream) {
           // Do something when a response is received.
         }
       }
       
    • createConversation

      public final Conversation createConversation(LocationName parent, Conversation conversation, String conversationId)
      Creates a new conversation to persist the conversation history. Each conversation will have multiple messages associated with it.

      Sample 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 (DataChatServiceClient dataChatServiceClient = DataChatServiceClient.create()) {
         LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
         Conversation conversation = Conversation.newBuilder().build();
         String conversationId = "conversationId-1676095234";
         Conversation response =
             dataChatServiceClient.createConversation(parent, conversation, conversationId);
       }
       
      Parameters:
      parent - Required. Parent value for CreateConversationRequest. Format: `projects/{project}/locations/{location}`
      conversation - Required. The conversation to create.
      conversationId - Optional. The conversation id of the conversation to create. Must be unique within the parent. The allowed format is: `^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$`. If not provided, the server will auto-generate a value for the id.
      Throws:
      ApiException - if the remote call fails
    • createConversation

      public final Conversation createConversation(String parent, Conversation conversation, String conversationId)
      Creates a new conversation to persist the conversation history. Each conversation will have multiple messages associated with it.

      Sample 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 (DataChatServiceClient dataChatServiceClient = DataChatServiceClient.create()) {
         String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
         Conversation conversation = Conversation.newBuilder().build();
         String conversationId = "conversationId-1676095234";
         Conversation response =
             dataChatServiceClient.createConversation(parent, conversation, conversationId);
       }
       
      Parameters:
      parent - Required. Parent value for CreateConversationRequest. Format: `projects/{project}/locations/{location}`
      conversation - Required. The conversation to create.
      conversationId - Optional. The conversation id of the conversation to create. Must be unique within the parent. The allowed format is: `^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$`. If not provided, the server will auto-generate a value for the id.
      Throws:
      ApiException - if the remote call fails
    • createConversation

      public final Conversation createConversation(CreateConversationRequest request)
      Creates a new conversation to persist the conversation history. Each conversation will have multiple messages associated with it.

      Sample 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 (DataChatServiceClient dataChatServiceClient = DataChatServiceClient.create()) {
         CreateConversationRequest request =
             CreateConversationRequest.newBuilder()
                 .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                 .setConversationId("conversationId-1676095234")
                 .setConversation(Conversation.newBuilder().build())
                 .setRequestId("requestId693933066")
                 .build();
         Conversation response = dataChatServiceClient.createConversation(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • createConversationCallable

      public final UnaryCallable<CreateConversationRequest,Conversation> createConversationCallable()
      Creates a new conversation to persist the conversation history. Each conversation will have multiple messages associated with it.

      Sample 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 (DataChatServiceClient dataChatServiceClient = DataChatServiceClient.create()) {
         CreateConversationRequest request =
             CreateConversationRequest.newBuilder()
                 .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                 .setConversationId("conversationId-1676095234")
                 .setConversation(Conversation.newBuilder().build())
                 .setRequestId("requestId693933066")
                 .build();
         ApiFuture<Conversation> future =
             dataChatServiceClient.createConversationCallable().futureCall(request);
         // Do something.
         Conversation response = future.get();
       }
       
    • deleteConversation

      public final void deleteConversation(ConversationName name)
      Deletes a conversation.

      Sample 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 (DataChatServiceClient dataChatServiceClient = DataChatServiceClient.create()) {
         ConversationName name = ConversationName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]");
         dataChatServiceClient.deleteConversation(name);
       }
       
      Parameters:
      name - Required. Name of the resource. Format: `projects/{project}/locations/{location}/conversations/{conversation}`
      Throws:
      ApiException - if the remote call fails
    • deleteConversation

      public final void deleteConversation(String name)
      Deletes a conversation.

      Sample 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 (DataChatServiceClient dataChatServiceClient = DataChatServiceClient.create()) {
         String name = ConversationName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]").toString();
         dataChatServiceClient.deleteConversation(name);
       }
       
      Parameters:
      name - Required. Name of the resource. Format: `projects/{project}/locations/{location}/conversations/{conversation}`
      Throws:
      ApiException - if the remote call fails
    • deleteConversation

      public final void deleteConversation(DeleteConversationRequest request)
      Deletes a conversation.

      Sample 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 (DataChatServiceClient dataChatServiceClient = DataChatServiceClient.create()) {
         DeleteConversationRequest request =
             DeleteConversationRequest.newBuilder()
                 .setName(ConversationName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]").toString())
                 .build();
         dataChatServiceClient.deleteConversation(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • deleteConversationCallable

      public final UnaryCallable<DeleteConversationRequest,com.google.protobuf.Empty> deleteConversationCallable()
      Deletes a conversation.

      Sample 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 (DataChatServiceClient dataChatServiceClient = DataChatServiceClient.create()) {
         DeleteConversationRequest request =
             DeleteConversationRequest.newBuilder()
                 .setName(ConversationName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]").toString())
                 .build();
         ApiFuture<Empty> future =
             dataChatServiceClient.deleteConversationCallable().futureCall(request);
         // Do something.
         future.get();
       }
       
    • getConversation

      public final Conversation getConversation(ConversationName name)
      Gets details of a single conversation by using conversation id and parent.

      Sample 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 (DataChatServiceClient dataChatServiceClient = DataChatServiceClient.create()) {
         ConversationName name = ConversationName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]");
         Conversation response = dataChatServiceClient.getConversation(name);
       }
       
      Parameters:
      name - Required. Name of the resource. Format: `projects/{project}/locations/{location}/conversations/{conversation}`
      Throws:
      ApiException - if the remote call fails
    • getConversation

      public final Conversation getConversation(String name)
      Gets details of a single conversation by using conversation id and parent.

      Sample 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 (DataChatServiceClient dataChatServiceClient = DataChatServiceClient.create()) {
         String name = ConversationName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]").toString();
         Conversation response = dataChatServiceClient.getConversation(name);
       }
       
      Parameters:
      name - Required. Name of the resource. Format: `projects/{project}/locations/{location}/conversations/{conversation}`
      Throws:
      ApiException - if the remote call fails
    • getConversation

      public final Conversation getConversation(GetConversationRequest request)
      Gets details of a single conversation by using conversation id and parent.

      Sample 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 (DataChatServiceClient dataChatServiceClient = DataChatServiceClient.create()) {
         GetConversationRequest request =
             GetConversationRequest.newBuilder()
                 .setName(ConversationName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]").toString())
                 .build();
         Conversation response = dataChatServiceClient.getConversation(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • getConversationCallable

      public final UnaryCallable<GetConversationRequest,Conversation> getConversationCallable()
      Gets details of a single conversation by using conversation id and parent.

      Sample 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 (DataChatServiceClient dataChatServiceClient = DataChatServiceClient.create()) {
         GetConversationRequest request =
             GetConversationRequest.newBuilder()
                 .setName(ConversationName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]").toString())
                 .build();
         ApiFuture<Conversation> future =
             dataChatServiceClient.getConversationCallable().futureCall(request);
         // Do something.
         Conversation response = future.get();
       }
       
    • listConversations

      public final DataChatServiceClient.ListConversationsPagedResponse listConversations(LocationName parent)
      Lists all conversations for a given parent.

      Sample 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 (DataChatServiceClient dataChatServiceClient = DataChatServiceClient.create()) {
         LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
         for (Conversation element : dataChatServiceClient.listConversations(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. Parent value for ListConversationsRequest. Format: `projects/{project}/locations/{location}`
      Throws:
      ApiException - if the remote call fails
    • listConversations

      public final DataChatServiceClient.ListConversationsPagedResponse listConversations(String parent)
      Lists all conversations for a given parent.

      Sample 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 (DataChatServiceClient dataChatServiceClient = DataChatServiceClient.create()) {
         String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
         for (Conversation element : dataChatServiceClient.listConversations(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. Parent value for ListConversationsRequest. Format: `projects/{project}/locations/{location}`
      Throws:
      ApiException - if the remote call fails
    • listConversations

      Lists all conversations for a given parent.

      Sample 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 (DataChatServiceClient dataChatServiceClient = DataChatServiceClient.create()) {
         ListConversationsRequest request =
             ListConversationsRequest.newBuilder()
                 .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .setFilter("filter-1274492040")
                 .build();
         for (Conversation element : dataChatServiceClient.listConversations(request).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • listConversationsPagedCallable

      Lists all conversations for a given parent.

      Sample 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 (DataChatServiceClient dataChatServiceClient = DataChatServiceClient.create()) {
         ListConversationsRequest request =
             ListConversationsRequest.newBuilder()
                 .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .setFilter("filter-1274492040")
                 .build();
         ApiFuture<Conversation> future =
             dataChatServiceClient.listConversationsPagedCallable().futureCall(request);
         // Do something.
         for (Conversation element : future.get().iterateAll()) {
           // doThingsWith(element);
         }
       }
       
    • listConversationsCallable

      public final UnaryCallable<ListConversationsRequest,ListConversationsResponse> listConversationsCallable()
      Lists all conversations for a given parent.

      Sample 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 (DataChatServiceClient dataChatServiceClient = DataChatServiceClient.create()) {
         ListConversationsRequest request =
             ListConversationsRequest.newBuilder()
                 .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .setFilter("filter-1274492040")
                 .build();
         while (true) {
           ListConversationsResponse response =
               dataChatServiceClient.listConversationsCallable().call(request);
           for (Conversation element : response.getConversationsList()) {
             // doThingsWith(element);
           }
           String nextPageToken = response.getNextPageToken();
           if (!Strings.isNullOrEmpty(nextPageToken)) {
             request = request.toBuilder().setPageToken(nextPageToken).build();
           } else {
             break;
           }
         }
       }
       
    • listMessages

      Lists all messages for a given conversation.

      Sample 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 (DataChatServiceClient dataChatServiceClient = DataChatServiceClient.create()) {
         ConversationName parent = ConversationName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]");
         for (StorageMessage element : dataChatServiceClient.listMessages(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The conversation to list messages under. Format: `projects/{project}/locations/{location}/conversations/{conversation_id}`
      Throws:
      ApiException - if the remote call fails
    • listMessages

      public final DataChatServiceClient.ListMessagesPagedResponse listMessages(String parent)
      Lists all messages for a given conversation.

      Sample 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 (DataChatServiceClient dataChatServiceClient = DataChatServiceClient.create()) {
         String parent = ConversationName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]").toString();
         for (StorageMessage element : dataChatServiceClient.listMessages(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The conversation to list messages under. Format: `projects/{project}/locations/{location}/conversations/{conversation_id}`
      Throws:
      ApiException - if the remote call fails
    • listMessages

      Lists all messages for a given conversation.

      Sample 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 (DataChatServiceClient dataChatServiceClient = DataChatServiceClient.create()) {
         ListMessagesRequest request =
             ListMessagesRequest.newBuilder()
                 .setParent(
                     ConversationName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .setFilter("filter-1274492040")
                 .build();
         for (StorageMessage element : dataChatServiceClient.listMessages(request).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • listMessagesPagedCallable

      Lists all messages for a given conversation.

      Sample 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 (DataChatServiceClient dataChatServiceClient = DataChatServiceClient.create()) {
         ListMessagesRequest request =
             ListMessagesRequest.newBuilder()
                 .setParent(
                     ConversationName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .setFilter("filter-1274492040")
                 .build();
         ApiFuture<StorageMessage> future =
             dataChatServiceClient.listMessagesPagedCallable().futureCall(request);
         // Do something.
         for (StorageMessage element : future.get().iterateAll()) {
           // doThingsWith(element);
         }
       }
       
    • listMessagesCallable

      public final UnaryCallable<ListMessagesRequest,ListMessagesResponse> listMessagesCallable()
      Lists all messages for a given conversation.

      Sample 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 (DataChatServiceClient dataChatServiceClient = DataChatServiceClient.create()) {
         ListMessagesRequest request =
             ListMessagesRequest.newBuilder()
                 .setParent(
                     ConversationName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .setFilter("filter-1274492040")
                 .build();
         while (true) {
           ListMessagesResponse response = dataChatServiceClient.listMessagesCallable().call(request);
           for (StorageMessage element : response.getMessagesList()) {
             // doThingsWith(element);
           }
           String nextPageToken = response.getNextPageToken();
           if (!Strings.isNullOrEmpty(nextPageToken)) {
             request = request.toBuilder().setPageToken(nextPageToken).build();
           } else {
             break;
           }
         }
       }
       
    • queryData

      public final QueryDataResponse queryData(QueryDataRequest request)
      Queries data from a natural language user query.

      Sample 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 (DataChatServiceClient dataChatServiceClient = DataChatServiceClient.create()) {
         QueryDataRequest request =
             QueryDataRequest.newBuilder()
                 .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                 .setPrompt("prompt-979805852")
                 .setContext(QueryDataContext.newBuilder().build())
                 .setGenerationOptions(GenerationOptions.newBuilder().build())
                 .build();
         QueryDataResponse response = dataChatServiceClient.queryData(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • queryDataCallable

      public final UnaryCallable<QueryDataRequest,QueryDataResponse> queryDataCallable()
      Queries data from a natural language user query.

      Sample 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 (DataChatServiceClient dataChatServiceClient = DataChatServiceClient.create()) {
         QueryDataRequest request =
             QueryDataRequest.newBuilder()
                 .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                 .setPrompt("prompt-979805852")
                 .setContext(QueryDataContext.newBuilder().build())
                 .setGenerationOptions(GenerationOptions.newBuilder().build())
                 .build();
         ApiFuture<QueryDataResponse> future =
             dataChatServiceClient.queryDataCallable().futureCall(request);
         // Do something.
         QueryDataResponse response = future.get();
       }
       
    • listLocations

      Lists information about the supported locations for this service.This method can be called in two ways:

      * **List all public locations:** Use the path `GET /v1/locations`.* **List project-visible locations:** Use the path`GET /v1/projects/{project_id}/locations`. This may include publiclocations as well as private or other locations specifically visibleto the project.

      Sample 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 (DataChatServiceClient dataChatServiceClient = DataChatServiceClient.create()) {
         ListLocationsRequest request =
             ListLocationsRequest.newBuilder()
                 .setName("name3373707")
                 .setFilter("filter-1274492040")
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         for (Location element : dataChatServiceClient.listLocations(request).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • listLocationsPagedCallable

      Lists information about the supported locations for this service.This method can be called in two ways:

      * **List all public locations:** Use the path `GET /v1/locations`.* **List project-visible locations:** Use the path`GET /v1/projects/{project_id}/locations`. This may include publiclocations as well as private or other locations specifically visibleto the project.

      Sample 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 (DataChatServiceClient dataChatServiceClient = DataChatServiceClient.create()) {
         ListLocationsRequest request =
             ListLocationsRequest.newBuilder()
                 .setName("name3373707")
                 .setFilter("filter-1274492040")
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         ApiFuture<Location> future =
             dataChatServiceClient.listLocationsPagedCallable().futureCall(request);
         // Do something.
         for (Location element : future.get().iterateAll()) {
           // doThingsWith(element);
         }
       }
       
    • listLocationsCallable

      public final UnaryCallable<ListLocationsRequest,ListLocationsResponse> listLocationsCallable()
      Lists information about the supported locations for this service.This method can be called in two ways:

      * **List all public locations:** Use the path `GET /v1/locations`.* **List project-visible locations:** Use the path`GET /v1/projects/{project_id}/locations`. This may include publiclocations as well as private or other locations specifically visibleto the project.

      Sample 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 (DataChatServiceClient dataChatServiceClient = DataChatServiceClient.create()) {
         ListLocationsRequest request =
             ListLocationsRequest.newBuilder()
                 .setName("name3373707")
                 .setFilter("filter-1274492040")
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         while (true) {
           ListLocationsResponse response =
               dataChatServiceClient.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;
           }
         }
       }
       
    • getLocation

      public final Location getLocation(GetLocationRequest request)
      Gets information about a location.

      Sample 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 (DataChatServiceClient dataChatServiceClient = DataChatServiceClient.create()) {
         GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
         Location response = dataChatServiceClient.getLocation(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • getLocationCallable

      public final UnaryCallable<GetLocationRequest,Location> getLocationCallable()
      Gets information about a location.

      Sample 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 (DataChatServiceClient dataChatServiceClient = DataChatServiceClient.create()) {
         GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
         ApiFuture<Location> future = dataChatServiceClient.getLocationCallable().futureCall(request);
         // Do something.
         Location response = future.get();
       }
       
    • close

      public final void close()
      Specified by:
      close in interface AutoCloseable
    • shutdown

      public void shutdown()
      Specified by:
      shutdown in interface BackgroundResource
    • isShutdown

      public boolean isShutdown()
      Specified by:
      isShutdown in interface BackgroundResource
    • isTerminated

      public boolean isTerminated()
      Specified by:
      isTerminated in interface BackgroundResource
    • shutdownNow

      public void shutdownNow()
      Specified by:
      shutdownNow in interface BackgroundResource
    • awaitTermination

      public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
      Specified by:
      awaitTermination in interface BackgroundResource
      Throws:
      InterruptedException