public abstract class DataChatServiceClient
Reference documentation and code samples for the Data Analytics API with Gemini v1beta API class DataChatServiceClient.
DataChatService client wrapper, for convenient use.
Derived Types
Namespace
Google.Cloud.GeminiDataAnalytics.V1BetaAssembly
Google.Cloud.GeminiDataAnalytics.V1Beta.dll
Remarks
Service to ask a natural language question on top of BigQuery and LookerStudio datasources to get back streamed responses of various kinds to help provide a rich conversational answer.
Properties
DefaultEndpoint
public static string DefaultEndpoint { get; }
The default endpoint for the DataChatService service, which is a host of "geminidataanalytics.googleapis.com" and a port of 443.
Property Value | |
---|---|
Type | Description |
string |
DefaultScopes
public static IReadOnlyList<string> DefaultScopes { get; }
The default DataChatService scopes.
Property Value | |
---|---|
Type | Description |
IReadOnlyListstring |
The default DataChatService scopes are:
GrpcClient
public virtual DataChatService.DataChatServiceClient GrpcClient { get; }
The underlying gRPC DataChatService client
Property Value | |
---|---|
Type | Description |
DataChatServiceDataChatServiceClient |
LocationsClient
public virtual LocationsClient LocationsClient { get; }
The LocationsClient associated with this client.
Property Value | |
---|---|
Type | Description |
LocationsClient |
ServiceMetadata
public static ServiceMetadata ServiceMetadata { get; }
The service metadata associated with this client type.
Property Value | |
---|---|
Type | Description |
ServiceMetadata |
Methods
Chat(ChatRequest, CallSettings)
public virtual DataChatServiceClient.ChatStream Chat(ChatRequest request, CallSettings callSettings = null)
Answers a data question by generating a stream of [Message]s.
Parameters | |
---|---|
Name | Description |
request |
ChatRequest The request object containing all of the parameters for the API call. |
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
DataChatServiceClientChatStream |
The server stream. |
// Create client
DataChatServiceClient dataChatServiceClient = DataChatServiceClient.Create();
// Initialize request argument(s)
ChatRequest request = new ChatRequest
{
Messages = { new Message(), },
Parent = "",
InlineContext = new Context(),
};
// Make the request, returning a streaming response
using DataChatServiceClient.ChatStream response = dataChatServiceClient.Chat(request);
// Read streaming responses from server until complete
// Note that C# 8 code can use await foreach
AsyncResponseStream<Message> responseStream = response.GetResponseStream();
while (await responseStream.MoveNextAsync())
{
Message responseItem = responseStream.Current;
// Do something with streamed response
}
// The response stream has completed
Create()
public static DataChatServiceClient Create()
Synchronously creates a DataChatServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use DataChatServiceClientBuilder.
Returns | |
---|---|
Type | Description |
DataChatServiceClient |
The created DataChatServiceClient. |
CreateAsync(CancellationToken)
public static Task<DataChatServiceClient> CreateAsync(CancellationToken cancellationToken = default)
Asynchronously creates a DataChatServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use DataChatServiceClientBuilder.
Parameter | |
---|---|
Name | Description |
cancellationToken |
CancellationToken The CancellationToken to use while creating the client. |
Returns | |
---|---|
Type | Description |
TaskDataChatServiceClient |
The task representing the created DataChatServiceClient. |
CreateConversation(LocationName, Conversation, string, CallSettings)
public virtual Conversation CreateConversation(LocationName parent, Conversation conversation, string conversationId, CallSettings callSettings = null)
Creates a new conversation to persist the conversation history. Each conversation will have multiple messages associated with it.
Parameters | |
---|---|
Name | Description |
parent |
LocationName Required. Parent value for CreateConversationRequest.
Format: |
conversation |
Conversation Required. The conversation to create. |
conversationId |
string Optional. The conversation id of the conversation to create. |
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Conversation |
The RPC response. |
// Create client
DataChatServiceClient dataChatServiceClient = DataChatServiceClient.Create();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
Conversation conversation = new Conversation();
string conversationId = "";
// Make the request
Conversation response = dataChatServiceClient.CreateConversation(parent, conversation, conversationId);
CreateConversation(CreateConversationRequest, CallSettings)
public virtual Conversation CreateConversation(CreateConversationRequest request, CallSettings callSettings = null)
Creates a new conversation to persist the conversation history. Each conversation will have multiple messages associated with it.
Parameters | |
---|---|
Name | Description |
request |
CreateConversationRequest The request object containing all of the parameters for the API call. |
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Conversation |
The RPC response. |
// Create client
DataChatServiceClient dataChatServiceClient = DataChatServiceClient.Create();
// Initialize request argument(s)
CreateConversationRequest request = new CreateConversationRequest
{
ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
ConversationId = "",
Conversation = new Conversation(),
RequestId = "",
};
// Make the request
Conversation response = dataChatServiceClient.CreateConversation(request);
CreateConversation(string, Conversation, string, CallSettings)
public virtual Conversation CreateConversation(string parent, Conversation conversation, string conversationId, CallSettings callSettings = null)
Creates a new conversation to persist the conversation history. Each conversation will have multiple messages associated with it.
Parameters | |
---|---|
Name | Description |
parent |
string Required. Parent value for CreateConversationRequest.
Format: |
conversation |
Conversation Required. The conversation to create. |
conversationId |
string Optional. The conversation id of the conversation to create. |
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Conversation |
The RPC response. |
// Create client
DataChatServiceClient dataChatServiceClient = DataChatServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
Conversation conversation = new Conversation();
string conversationId = "";
// Make the request
Conversation response = dataChatServiceClient.CreateConversation(parent, conversation, conversationId);
CreateConversationAsync(LocationName, Conversation, string, CallSettings)
public virtual Task<Conversation> CreateConversationAsync(LocationName parent, Conversation conversation, string conversationId, CallSettings callSettings = null)
Creates a new conversation to persist the conversation history. Each conversation will have multiple messages associated with it.
Parameters | |
---|---|
Name | Description |
parent |
LocationName Required. Parent value for CreateConversationRequest.
Format: |
conversation |
Conversation Required. The conversation to create. |
conversationId |
string Optional. The conversation id of the conversation to create. |
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
TaskConversation |
A Task containing the RPC response. |
// Create client
DataChatServiceClient dataChatServiceClient = await DataChatServiceClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
Conversation conversation = new Conversation();
string conversationId = "";
// Make the request
Conversation response = await dataChatServiceClient.CreateConversationAsync(parent, conversation, conversationId);
CreateConversationAsync(LocationName, Conversation, string, CancellationToken)
public virtual Task<Conversation> CreateConversationAsync(LocationName parent, Conversation conversation, string conversationId, CancellationToken cancellationToken)
Creates a new conversation to persist the conversation history. Each conversation will have multiple messages associated with it.
Parameters | |
---|---|
Name | Description |
parent |
LocationName Required. Parent value for CreateConversationRequest.
Format: |
conversation |
Conversation Required. The conversation to create. |
conversationId |
string Optional. The conversation id of the conversation to create. |
cancellationToken |
CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
TaskConversation |
A Task containing the RPC response. |
// Create client
DataChatServiceClient dataChatServiceClient = await DataChatServiceClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
Conversation conversation = new Conversation();
string conversationId = "";
// Make the request
Conversation response = await dataChatServiceClient.CreateConversationAsync(parent, conversation, conversationId);
CreateConversationAsync(CreateConversationRequest, CallSettings)
public virtual Task<Conversation> CreateConversationAsync(CreateConversationRequest request, CallSettings callSettings = null)
Creates a new conversation to persist the conversation history. Each conversation will have multiple messages associated with it.
Parameters | |
---|---|
Name | Description |
request |
CreateConversationRequest The request object containing all of the parameters for the API call. |
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
TaskConversation |
A Task containing the RPC response. |
// Create client
DataChatServiceClient dataChatServiceClient = await DataChatServiceClient.CreateAsync();
// Initialize request argument(s)
CreateConversationRequest request = new CreateConversationRequest
{
ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
ConversationId = "",
Conversation = new Conversation(),
RequestId = "",
};
// Make the request
Conversation response = await dataChatServiceClient.CreateConversationAsync(request);
CreateConversationAsync(CreateConversationRequest, CancellationToken)
public virtual Task<Conversation> CreateConversationAsync(CreateConversationRequest request, CancellationToken cancellationToken)
Creates a new conversation to persist the conversation history. Each conversation will have multiple messages associated with it.
Parameters | |
---|---|
Name | Description |
request |
CreateConversationRequest The request object containing all of the parameters for the API call. |
cancellationToken |
CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
TaskConversation |
A Task containing the RPC response. |
// Create client
DataChatServiceClient dataChatServiceClient = await DataChatServiceClient.CreateAsync();
// Initialize request argument(s)
CreateConversationRequest request = new CreateConversationRequest
{
ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
ConversationId = "",
Conversation = new Conversation(),
RequestId = "",
};
// Make the request
Conversation response = await dataChatServiceClient.CreateConversationAsync(request);
CreateConversationAsync(string, Conversation, string, CallSettings)
public virtual Task<Conversation> CreateConversationAsync(string parent, Conversation conversation, string conversationId, CallSettings callSettings = null)
Creates a new conversation to persist the conversation history. Each conversation will have multiple messages associated with it.
Parameters | |
---|---|
Name | Description |
parent |
string Required. Parent value for CreateConversationRequest.
Format: |
conversation |
Conversation Required. The conversation to create. |
conversationId |
string Optional. The conversation id of the conversation to create. |
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
TaskConversation |
A Task containing the RPC response. |
// Create client
DataChatServiceClient dataChatServiceClient = await DataChatServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
Conversation conversation = new Conversation();
string conversationId = "";
// Make the request
Conversation response = await dataChatServiceClient.CreateConversationAsync(parent, conversation, conversationId);
CreateConversationAsync(string, Conversation, string, CancellationToken)
public virtual Task<Conversation> CreateConversationAsync(string parent, Conversation conversation, string conversationId, CancellationToken cancellationToken)
Creates a new conversation to persist the conversation history. Each conversation will have multiple messages associated with it.
Parameters | |
---|---|
Name | Description |
parent |
string Required. Parent value for CreateConversationRequest.
Format: |
conversation |
Conversation Required. The conversation to create. |
conversationId |
string Optional. The conversation id of the conversation to create. |
cancellationToken |
CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
TaskConversation |
A Task containing the RPC response. |
// Create client
DataChatServiceClient dataChatServiceClient = await DataChatServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
Conversation conversation = new Conversation();
string conversationId = "";
// Make the request
Conversation response = await dataChatServiceClient.CreateConversationAsync(parent, conversation, conversationId);
GetConversation(ConversationName, CallSettings)
public virtual Conversation GetConversation(ConversationName name, CallSettings callSettings = null)
Gets details of a single conversation using conversation id and parent.
Parameters | |
---|---|
Name | Description |
name |
ConversationName Required. Name of the resource.
Format:
|
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Conversation |
The RPC response. |
// Create client
DataChatServiceClient dataChatServiceClient = DataChatServiceClient.Create();
// Initialize request argument(s)
ConversationName name = ConversationName.FromProjectLocationConversation("[PROJECT]", "[LOCATION]", "[CONVERSATION]");
// Make the request
Conversation response = dataChatServiceClient.GetConversation(name);
GetConversation(GetConversationRequest, CallSettings)
public virtual Conversation GetConversation(GetConversationRequest request, CallSettings callSettings = null)
Gets details of a single conversation using conversation id and parent.
Parameters | |
---|---|
Name | Description |
request |
GetConversationRequest The request object containing all of the parameters for the API call. |
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Conversation |
The RPC response. |
// Create client
DataChatServiceClient dataChatServiceClient = DataChatServiceClient.Create();
// Initialize request argument(s)
GetConversationRequest request = new GetConversationRequest
{
ConversationName = ConversationName.FromProjectLocationConversation("[PROJECT]", "[LOCATION]", "[CONVERSATION]"),
};
// Make the request
Conversation response = dataChatServiceClient.GetConversation(request);
GetConversation(string, CallSettings)
public virtual Conversation GetConversation(string name, CallSettings callSettings = null)
Gets details of a single conversation using conversation id and parent.
Parameters | |
---|---|
Name | Description |
name |
string Required. Name of the resource.
Format:
|
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Conversation |
The RPC response. |
// Create client
DataChatServiceClient dataChatServiceClient = DataChatServiceClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/conversations/[CONVERSATION]";
// Make the request
Conversation response = dataChatServiceClient.GetConversation(name);
GetConversationAsync(ConversationName, CallSettings)
public virtual Task<Conversation> GetConversationAsync(ConversationName name, CallSettings callSettings = null)
Gets details of a single conversation using conversation id and parent.
Parameters | |
---|---|
Name | Description |
name |
ConversationName Required. Name of the resource.
Format:
|
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
TaskConversation |
A Task containing the RPC response. |
// Create client
DataChatServiceClient dataChatServiceClient = await DataChatServiceClient.CreateAsync();
// Initialize request argument(s)
ConversationName name = ConversationName.FromProjectLocationConversation("[PROJECT]", "[LOCATION]", "[CONVERSATION]");
// Make the request
Conversation response = await dataChatServiceClient.GetConversationAsync(name);
GetConversationAsync(ConversationName, CancellationToken)
public virtual Task<Conversation> GetConversationAsync(ConversationName name, CancellationToken cancellationToken)
Gets details of a single conversation using conversation id and parent.
Parameters | |
---|---|
Name | Description |
name |
ConversationName Required. Name of the resource.
Format:
|
cancellationToken |
CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
TaskConversation |
A Task containing the RPC response. |
// Create client
DataChatServiceClient dataChatServiceClient = await DataChatServiceClient.CreateAsync();
// Initialize request argument(s)
ConversationName name = ConversationName.FromProjectLocationConversation("[PROJECT]", "[LOCATION]", "[CONVERSATION]");
// Make the request
Conversation response = await dataChatServiceClient.GetConversationAsync(name);
GetConversationAsync(GetConversationRequest, CallSettings)
public virtual Task<Conversation> GetConversationAsync(GetConversationRequest request, CallSettings callSettings = null)
Gets details of a single conversation using conversation id and parent.
Parameters | |
---|---|
Name | Description |
request |
GetConversationRequest The request object containing all of the parameters for the API call. |
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
TaskConversation |
A Task containing the RPC response. |
// Create client
DataChatServiceClient dataChatServiceClient = await DataChatServiceClient.CreateAsync();
// Initialize request argument(s)
GetConversationRequest request = new GetConversationRequest
{
ConversationName = ConversationName.FromProjectLocationConversation("[PROJECT]", "[LOCATION]", "[CONVERSATION]"),
};
// Make the request
Conversation response = await dataChatServiceClient.GetConversationAsync(request);
GetConversationAsync(GetConversationRequest, CancellationToken)
public virtual Task<Conversation> GetConversationAsync(GetConversationRequest request, CancellationToken cancellationToken)
Gets details of a single conversation using conversation id and parent.
Parameters | |
---|---|
Name | Description |
request |
GetConversationRequest The request object containing all of the parameters for the API call. |
cancellationToken |
CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
TaskConversation |
A Task containing the RPC response. |
// Create client
DataChatServiceClient dataChatServiceClient = await DataChatServiceClient.CreateAsync();
// Initialize request argument(s)
GetConversationRequest request = new GetConversationRequest
{
ConversationName = ConversationName.FromProjectLocationConversation("[PROJECT]", "[LOCATION]", "[CONVERSATION]"),
};
// Make the request
Conversation response = await dataChatServiceClient.GetConversationAsync(request);
GetConversationAsync(string, CallSettings)
public virtual Task<Conversation> GetConversationAsync(string name, CallSettings callSettings = null)
Gets details of a single conversation using conversation id and parent.
Parameters | |
---|---|
Name | Description |
name |
string Required. Name of the resource.
Format:
|
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
TaskConversation |
A Task containing the RPC response. |
// Create client
DataChatServiceClient dataChatServiceClient = await DataChatServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/conversations/[CONVERSATION]";
// Make the request
Conversation response = await dataChatServiceClient.GetConversationAsync(name);
GetConversationAsync(string, CancellationToken)
public virtual Task<Conversation> GetConversationAsync(string name, CancellationToken cancellationToken)
Gets details of a single conversation using conversation id and parent.
Parameters | |
---|---|
Name | Description |
name |
string Required. Name of the resource.
Format:
|
cancellationToken |
CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
TaskConversation |
A Task containing the RPC response. |
// Create client
DataChatServiceClient dataChatServiceClient = await DataChatServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/conversations/[CONVERSATION]";
// Make the request
Conversation response = await dataChatServiceClient.GetConversationAsync(name);
ListConversations(LocationName, string, int?, CallSettings)
public virtual PagedEnumerable<ListConversationsResponse, Conversation> ListConversations(LocationName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Lists all conversations for a given parent.
Parameters | |
---|---|
Name | Description |
parent |
LocationName Required. Parent value for ListConversationsRequest.
Format: |
pageToken |
string The token returned from the previous request. A value of |
pageSize |
int The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedEnumerableListConversationsResponseConversation |
A pageable sequence of Conversation resources. |
// Create client
DataChatServiceClient dataChatServiceClient = DataChatServiceClient.Create();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
// Make the request
PagedEnumerable<ListConversationsResponse, Conversation> response = dataChatServiceClient.ListConversations(parent);
// Iterate over all response items, lazily performing RPCs as required
foreach (Conversation item in response)
{
// Do something with each item
Console.WriteLine(item);
}
// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListConversationsResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Conversation item in page)
{
// Do something with each item
Console.WriteLine(item);
}
}
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Conversation> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Conversation item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListConversations(ListConversationsRequest, CallSettings)
public virtual PagedEnumerable<ListConversationsResponse, Conversation> ListConversations(ListConversationsRequest request, CallSettings callSettings = null)
Lists all conversations for a given parent.
Parameters | |
---|---|
Name | Description |
request |
ListConversationsRequest The request object containing all of the parameters for the API call. |
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedEnumerableListConversationsResponseConversation |
A pageable sequence of Conversation resources. |
// Create client
DataChatServiceClient dataChatServiceClient = DataChatServiceClient.Create();
// Initialize request argument(s)
ListConversationsRequest request = new ListConversationsRequest
{
ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
Filter = "",
};
// Make the request
PagedEnumerable<ListConversationsResponse, Conversation> response = dataChatServiceClient.ListConversations(request);
// Iterate over all response items, lazily performing RPCs as required
foreach (Conversation item in response)
{
// Do something with each item
Console.WriteLine(item);
}
// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListConversationsResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Conversation item in page)
{
// Do something with each item
Console.WriteLine(item);
}
}
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Conversation> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Conversation item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListConversations(string, string, int?, CallSettings)
public virtual PagedEnumerable<ListConversationsResponse, Conversation> ListConversations(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Lists all conversations for a given parent.
Parameters | |
---|---|
Name | Description |
parent |
string Required. Parent value for ListConversationsRequest.
Format: |
pageToken |
string The token returned from the previous request. A value of |
pageSize |
int The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedEnumerableListConversationsResponseConversation |
A pageable sequence of Conversation resources. |
// Create client
DataChatServiceClient dataChatServiceClient = DataChatServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
// Make the request
PagedEnumerable<ListConversationsResponse, Conversation> response = dataChatServiceClient.ListConversations(parent);
// Iterate over all response items, lazily performing RPCs as required
foreach (Conversation item in response)
{
// Do something with each item
Console.WriteLine(item);
}
// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListConversationsResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Conversation item in page)
{
// Do something with each item
Console.WriteLine(item);
}
}
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Conversation> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Conversation item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListConversationsAsync(LocationName, string, int?, CallSettings)
public virtual PagedAsyncEnumerable<ListConversationsResponse, Conversation> ListConversationsAsync(LocationName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Lists all conversations for a given parent.
Parameters | |
---|---|
Name | Description |
parent |
LocationName Required. Parent value for ListConversationsRequest.
Format: |
pageToken |
string The token returned from the previous request. A value of |
pageSize |
int The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedAsyncEnumerableListConversationsResponseConversation |
A pageable asynchronous sequence of Conversation resources. |
// Create client
DataChatServiceClient dataChatServiceClient = await DataChatServiceClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
// Make the request
PagedAsyncEnumerable<ListConversationsResponse, Conversation> response = dataChatServiceClient.ListConversationsAsync(parent);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Conversation item) =>
{
// Do something with each item
Console.WriteLine(item);
});
// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListConversationsResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Conversation item in page)
{
// Do something with each item
Console.WriteLine(item);
}
});
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Conversation> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Conversation item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListConversationsAsync(ListConversationsRequest, CallSettings)
public virtual PagedAsyncEnumerable<ListConversationsResponse, Conversation> ListConversationsAsync(ListConversationsRequest request, CallSettings callSettings = null)
Lists all conversations for a given parent.
Parameters | |
---|---|
Name | Description |
request |
ListConversationsRequest The request object containing all of the parameters for the API call. |
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedAsyncEnumerableListConversationsResponseConversation |
A pageable asynchronous sequence of Conversation resources. |
// Create client
DataChatServiceClient dataChatServiceClient = await DataChatServiceClient.CreateAsync();
// Initialize request argument(s)
ListConversationsRequest request = new ListConversationsRequest
{
ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
Filter = "",
};
// Make the request
PagedAsyncEnumerable<ListConversationsResponse, Conversation> response = dataChatServiceClient.ListConversationsAsync(request);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Conversation item) =>
{
// Do something with each item
Console.WriteLine(item);
});
// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListConversationsResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Conversation item in page)
{
// Do something with each item
Console.WriteLine(item);
}
});
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Conversation> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Conversation item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListConversationsAsync(string, string, int?, CallSettings)
public virtual PagedAsyncEnumerable<ListConversationsResponse, Conversation> ListConversationsAsync(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Lists all conversations for a given parent.
Parameters | |
---|---|
Name | Description |
parent |
string Required. Parent value for ListConversationsRequest.
Format: |
pageToken |
string The token returned from the previous request. A value of |
pageSize |
int The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedAsyncEnumerableListConversationsResponseConversation |
A pageable asynchronous sequence of Conversation resources. |
// Create client
DataChatServiceClient dataChatServiceClient = await DataChatServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
// Make the request
PagedAsyncEnumerable<ListConversationsResponse, Conversation> response = dataChatServiceClient.ListConversationsAsync(parent);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Conversation item) =>
{
// Do something with each item
Console.WriteLine(item);
});
// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListConversationsResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Conversation item in page)
{
// Do something with each item
Console.WriteLine(item);
}
});
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Conversation> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Conversation item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListMessages(ConversationName, string, int?, CallSettings)
public virtual PagedEnumerable<ListMessagesResponse, StorageMessage> ListMessages(ConversationName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Lists all messages for a given conversation.
Parameters | |
---|---|
Name | Description |
parent |
ConversationName Required. The conversation to list messages under.
Format:
|
pageToken |
string The token returned from the previous request. A value of |
pageSize |
int The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedEnumerableListMessagesResponseStorageMessage |
A pageable sequence of StorageMessage resources. |
// Create client
DataChatServiceClient dataChatServiceClient = DataChatServiceClient.Create();
// Initialize request argument(s)
ConversationName parent = ConversationName.FromProjectLocationConversation("[PROJECT]", "[LOCATION]", "[CONVERSATION]");
// Make the request
PagedEnumerable<ListMessagesResponse, StorageMessage> response = dataChatServiceClient.ListMessages(parent);
// Iterate over all response items, lazily performing RPCs as required
foreach (StorageMessage item in response)
{
// Do something with each item
Console.WriteLine(item);
}
// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListMessagesResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (StorageMessage item in page)
{
// Do something with each item
Console.WriteLine(item);
}
}
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<StorageMessage> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (StorageMessage item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListMessages(ListMessagesRequest, CallSettings)
public virtual PagedEnumerable<ListMessagesResponse, StorageMessage> ListMessages(ListMessagesRequest request, CallSettings callSettings = null)
Lists all messages for a given conversation.
Parameters | |
---|---|
Name | Description |
request |
ListMessagesRequest The request object containing all of the parameters for the API call. |
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedEnumerableListMessagesResponseStorageMessage |
A pageable sequence of StorageMessage resources. |
// Create client
DataChatServiceClient dataChatServiceClient = DataChatServiceClient.Create();
// Initialize request argument(s)
ListMessagesRequest request = new ListMessagesRequest
{
ParentAsConversationName = ConversationName.FromProjectLocationConversation("[PROJECT]", "[LOCATION]", "[CONVERSATION]"),
Filter = "",
};
// Make the request
PagedEnumerable<ListMessagesResponse, StorageMessage> response = dataChatServiceClient.ListMessages(request);
// Iterate over all response items, lazily performing RPCs as required
foreach (StorageMessage item in response)
{
// Do something with each item
Console.WriteLine(item);
}
// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListMessagesResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (StorageMessage item in page)
{
// Do something with each item
Console.WriteLine(item);
}
}
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<StorageMessage> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (StorageMessage item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListMessages(string, string, int?, CallSettings)
public virtual PagedEnumerable<ListMessagesResponse, StorageMessage> ListMessages(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Lists all messages for a given conversation.
Parameters | |
---|---|
Name | Description |
parent |
string Required. The conversation to list messages under.
Format:
|
pageToken |
string The token returned from the previous request. A value of |
pageSize |
int The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedEnumerableListMessagesResponseStorageMessage |
A pageable sequence of StorageMessage resources. |
// Create client
DataChatServiceClient dataChatServiceClient = DataChatServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]/conversations/[CONVERSATION]";
// Make the request
PagedEnumerable<ListMessagesResponse, StorageMessage> response = dataChatServiceClient.ListMessages(parent);
// Iterate over all response items, lazily performing RPCs as required
foreach (StorageMessage item in response)
{
// Do something with each item
Console.WriteLine(item);
}
// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListMessagesResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (StorageMessage item in page)
{
// Do something with each item
Console.WriteLine(item);
}
}
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<StorageMessage> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (StorageMessage item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListMessagesAsync(ConversationName, string, int?, CallSettings)
public virtual PagedAsyncEnumerable<ListMessagesResponse, StorageMessage> ListMessagesAsync(ConversationName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Lists all messages for a given conversation.
Parameters | |
---|---|
Name | Description |
parent |
ConversationName Required. The conversation to list messages under.
Format:
|
pageToken |
string The token returned from the previous request. A value of |
pageSize |
int The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedAsyncEnumerableListMessagesResponseStorageMessage |
A pageable asynchronous sequence of StorageMessage resources. |
// Create client
DataChatServiceClient dataChatServiceClient = await DataChatServiceClient.CreateAsync();
// Initialize request argument(s)
ConversationName parent = ConversationName.FromProjectLocationConversation("[PROJECT]", "[LOCATION]", "[CONVERSATION]");
// Make the request
PagedAsyncEnumerable<ListMessagesResponse, StorageMessage> response = dataChatServiceClient.ListMessagesAsync(parent);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((StorageMessage item) =>
{
// Do something with each item
Console.WriteLine(item);
});
// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListMessagesResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (StorageMessage item in page)
{
// Do something with each item
Console.WriteLine(item);
}
});
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<StorageMessage> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (StorageMessage item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListMessagesAsync(ListMessagesRequest, CallSettings)
public virtual PagedAsyncEnumerable<ListMessagesResponse, StorageMessage> ListMessagesAsync(ListMessagesRequest request, CallSettings callSettings = null)
Lists all messages for a given conversation.
Parameters | |
---|---|
Name | Description |
request |
ListMessagesRequest The request object containing all of the parameters for the API call. |
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedAsyncEnumerableListMessagesResponseStorageMessage |
A pageable asynchronous sequence of StorageMessage resources. |
// Create client
DataChatServiceClient dataChatServiceClient = await DataChatServiceClient.CreateAsync();
// Initialize request argument(s)
ListMessagesRequest request = new ListMessagesRequest
{
ParentAsConversationName = ConversationName.FromProjectLocationConversation("[PROJECT]", "[LOCATION]", "[CONVERSATION]"),
Filter = "",
};
// Make the request
PagedAsyncEnumerable<ListMessagesResponse, StorageMessage> response = dataChatServiceClient.ListMessagesAsync(request);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((StorageMessage item) =>
{
// Do something with each item
Console.WriteLine(item);
});
// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListMessagesResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (StorageMessage item in page)
{
// Do something with each item
Console.WriteLine(item);
}
});
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<StorageMessage> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (StorageMessage item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ListMessagesAsync(string, string, int?, CallSettings)
public virtual PagedAsyncEnumerable<ListMessagesResponse, StorageMessage> ListMessagesAsync(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Lists all messages for a given conversation.
Parameters | |
---|---|
Name | Description |
parent |
string Required. The conversation to list messages under.
Format:
|
pageToken |
string The token returned from the previous request. A value of |
pageSize |
int The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedAsyncEnumerableListMessagesResponseStorageMessage |
A pageable asynchronous sequence of StorageMessage resources. |
// Create client
DataChatServiceClient dataChatServiceClient = await DataChatServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]/conversations/[CONVERSATION]";
// Make the request
PagedAsyncEnumerable<ListMessagesResponse, StorageMessage> response = dataChatServiceClient.ListMessagesAsync(parent);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((StorageMessage item) =>
{
// Do something with each item
Console.WriteLine(item);
});
// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListMessagesResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (StorageMessage item in page)
{
// Do something with each item
Console.WriteLine(item);
}
});
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<StorageMessage> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (StorageMessage item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ShutdownDefaultChannelsAsync()
public static Task ShutdownDefaultChannelsAsync()
Shuts down any channels automatically created by Create() and CreateAsync(CancellationToken). Channels which weren't automatically created are not affected.
Returns | |
---|---|
Type | Description |
Task |
A task representing the asynchronous shutdown operation. |
After calling this method, further calls to Create() and CreateAsync(CancellationToken) will create new channels, which could in turn be shut down by another call to this method.