Class DataChatServiceClient (0.1.0)

GitHub RepositoryProduct ReferenceRPC Documentation

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 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()

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()

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 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.

Inheritance

java.lang.Object > DataChatServiceClient

Static Methods

create()

public static final DataChatServiceClient create()

Constructs an instance of DataChatServiceClient with default settings.

Returns
Type Description
DataChatServiceClient
Exceptions
Type Description
IOException

create(DataChatServiceSettings settings)

public static final DataChatServiceClient create(DataChatServiceSettings settings)

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.

Parameter
Name Description
settings DataChatServiceSettings
Returns
Type Description
DataChatServiceClient
Exceptions
Type Description
IOException

create(DataChatServiceStub stub)

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).

Parameter
Name Description
stub DataChatServiceStub
Returns
Type Description
DataChatServiceClient

Constructors

DataChatServiceClient(DataChatServiceSettings settings)

protected DataChatServiceClient(DataChatServiceSettings settings)

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.

Parameter
Name Description
settings DataChatServiceSettings

DataChatServiceClient(DataChatServiceStub stub)

protected DataChatServiceClient(DataChatServiceStub stub)
Parameter
Name Description
stub DataChatServiceStub

Methods

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
Name Description
duration long
unit TimeUnit
Returns
Type Description
boolean
Exceptions
Type Description
InterruptedException

chatCallable()

public final ServerStreamingCallable<ChatRequest,Message> chatCallable()

Answers a data question by generating a stream of 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.
   }
 }
 
Returns
Type Description
ServerStreamingCallable<ChatRequest,Message>

close()

public final void close()

createConversation(CreateConversationRequest request)

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);
 }
 
Parameter
Name Description
request CreateConversationRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
Conversation

createConversation(LocationName parent, Conversation conversation, String conversationId)

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
Name Description
parent LocationName

Required. Parent value for CreateConversationRequest. Format: projects/{project}/locations/{location}

conversation Conversation

Required. The conversation to create.

conversationId String

Optional. The conversation id of the conversation to create. Must be unique within the parent. The allowed format is: ^a-z?$. If not provided, the server will auto-generate a value for the id.

Returns
Type Description
Conversation

createConversation(String parent, Conversation conversation, String conversationId)

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
Name Description
parent String

Required. Parent value for CreateConversationRequest. Format: projects/{project}/locations/{location}

conversation Conversation

Required. The conversation to create.

conversationId String

Optional. The conversation id of the conversation to create. Must be unique within the parent. The allowed format is: ^a-z?$. If not provided, the server will auto-generate a value for the id.

Returns
Type Description
Conversation

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();
 }
 
Returns
Type Description
UnaryCallable<CreateConversationRequest,Conversation>

getConversation(ConversationName name)

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);
 }
 
Parameter
Name Description
name ConversationName

Required. Name of the resource. Format: projects/{project}/locations/{location}/conversations/{conversation}

Returns
Type Description
Conversation

getConversation(GetConversationRequest request)

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);
 }
 
Parameter
Name Description
request GetConversationRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
Conversation

getConversation(String name)

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);
 }
 
Parameter
Name Description
name String

Required. Name of the resource. Format: projects/{project}/locations/{location}/conversations/{conversation}

Returns
Type Description
Conversation

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();
 }
 
Returns
Type Description
UnaryCallable<GetConversationRequest,Conversation>

getLocation(GetLocationRequest request)

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);
 }
 
Parameter
Name Description
request com.google.cloud.location.GetLocationRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
com.google.cloud.location.Location

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();
 }
 
Returns
Type Description
UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location>

getSettings()

public final DataChatServiceSettings getSettings()
Returns
Type Description
DataChatServiceSettings

getStub()

public DataChatServiceStub getStub()
Returns
Type Description
DataChatServiceStub

isShutdown()

public boolean isShutdown()
Returns
Type Description
boolean

isTerminated()

public boolean isTerminated()
Returns
Type Description
boolean

listConversations(ListConversationsRequest request)

public final DataChatServiceClient.ListConversationsPagedResponse listConversations(ListConversationsRequest request)

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);
   }
 }
 
Parameter
Name Description
request ListConversationsRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
DataChatServiceClient.ListConversationsPagedResponse

listConversations(LocationName parent)

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);
   }
 }
 
Parameter
Name Description
parent LocationName

Required. Parent value for ListConversationsRequest. Format: projects/{project}/locations/{location}

Returns
Type Description
DataChatServiceClient.ListConversationsPagedResponse

listConversations(String parent)

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);
   }
 }
 
Parameter
Name Description
parent String

Required. Parent value for ListConversationsRequest. Format: projects/{project}/locations/{location}

Returns
Type Description
DataChatServiceClient.ListConversationsPagedResponse

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;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<ListConversationsRequest,ListConversationsResponse>

listConversationsPagedCallable()

public final UnaryCallable<ListConversationsRequest,DataChatServiceClient.ListConversationsPagedResponse> 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);
   }
 }
 
Returns
Type Description
UnaryCallable<ListConversationsRequest,ListConversationsPagedResponse>

listLocations(ListLocationsRequest request)

public final DataChatServiceClient.ListLocationsPagedResponse listLocations(ListLocationsRequest request)

Lists information about the supported locations for this service.

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);
   }
 }
 
Parameter
Name Description
request com.google.cloud.location.ListLocationsRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
DataChatServiceClient.ListLocationsPagedResponse

listLocationsCallable()

public final UnaryCallable<ListLocationsRequest,ListLocationsResponse> listLocationsCallable()

Lists information about the supported locations for this service.

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;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse>

listLocationsPagedCallable()

public final UnaryCallable<ListLocationsRequest,DataChatServiceClient.ListLocationsPagedResponse> listLocationsPagedCallable()

Lists information about the supported locations for this service.

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);
   }
 }
 
Returns
Type Description
UnaryCallable<com.google.cloud.location.ListLocationsRequest,ListLocationsPagedResponse>

listMessages(ConversationName parent)

public final DataChatServiceClient.ListMessagesPagedResponse listMessages(ConversationName 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()) {
   ConversationName parent = ConversationName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]");
   for (StorageMessage element : dataChatServiceClient.listMessages(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent ConversationName

Required. The conversation to list messages under. Format: projects/{project}/locations/{location}/conversations/{conversation_id}

Returns
Type Description
DataChatServiceClient.ListMessagesPagedResponse

listMessages(ListMessagesRequest request)

public final DataChatServiceClient.ListMessagesPagedResponse listMessages(ListMessagesRequest request)

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);
   }
 }
 
Parameter
Name Description
request ListMessagesRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
DataChatServiceClient.ListMessagesPagedResponse

listMessages(String parent)

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);
   }
 }
 
Parameter
Name Description
parent String

Required. The conversation to list messages under. Format: projects/{project}/locations/{location}/conversations/{conversation_id}

Returns
Type Description
DataChatServiceClient.ListMessagesPagedResponse

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;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<ListMessagesRequest,ListMessagesResponse>

listMessagesPagedCallable()

public final UnaryCallable<ListMessagesRequest,DataChatServiceClient.ListMessagesPagedResponse> 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);
   }
 }
 
Returns
Type Description
UnaryCallable<ListMessagesRequest,ListMessagesPagedResponse>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()