Class AgentsClient
Agents client wrapper, for convenient use.
Namespace: Google.Cloud.Dialogflow.V2
Assembly: Google.Cloud.Dialogflow.V2.dll
Syntax
public abstract class AgentsClient
Remarks
Service for managing [Agents][google.cloud.dialogflow.v2.Agent].
Properties
DefaultEndpoint
The default endpoint for the Agents service, which is a host of "dialogflow.googleapis.com" and a port of 443.
Declaration
public static string DefaultEndpoint { get; }
Property Value
Type | Description |
---|---|
string |
DefaultScopes
The default Agents scopes.
Declaration
public static IReadOnlyList<string> DefaultScopes { get; }
Property Value
Type | Description |
---|---|
IReadOnlyList<string> |
Remarks
The default Agents scopes are:
- https://www.googleapis.com/auth/cloud-platform
- https://www.googleapis.com/auth/dialogflow
ExportAgentOperationsClient
The long-running operations client for ExportAgent
.
Declaration
public virtual OperationsClient ExportAgentOperationsClient { get; }
Property Value
Type | Description |
---|---|
OperationsClient |
GrpcClient
The underlying gRPC Agents client
Declaration
public virtual Agents.AgentsClient GrpcClient { get; }
Property Value
Type | Description |
---|---|
Agents.AgentsClient |
ImportAgentOperationsClient
The long-running operations client for ImportAgent
.
Declaration
public virtual OperationsClient ImportAgentOperationsClient { get; }
Property Value
Type | Description |
---|---|
OperationsClient |
LocationsClient
The Google.Cloud.Location.LocationsClient associated with this client.
Declaration
public virtual LocationsClient LocationsClient { get; }
Property Value
Type | Description |
---|---|
LocationsClient |
RestoreAgentOperationsClient
The long-running operations client for RestoreAgent
.
Declaration
public virtual OperationsClient RestoreAgentOperationsClient { get; }
Property Value
Type | Description |
---|---|
OperationsClient |
ServiceMetadata
The service metadata associated with this client type.
Declaration
public static ServiceMetadata ServiceMetadata { get; }
Property Value
Type | Description |
---|---|
ServiceMetadata |
TrainAgentOperationsClient
The long-running operations client for TrainAgent
.
Declaration
public virtual OperationsClient TrainAgentOperationsClient { get; }
Property Value
Type | Description |
---|---|
OperationsClient |
Methods
Create()
Synchronously creates a AgentsClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use AgentsClientBuilder.
Declaration
public static AgentsClient Create()
Returns
Type | Description |
---|---|
AgentsClient | The created AgentsClient. |
CreateAsync(CancellationToken)
Asynchronously creates a AgentsClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use AgentsClientBuilder.
Declaration
public static Task<AgentsClient> CreateAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | The CancellationToken to use while creating the client. |
Returns
Type | Description |
---|---|
Task<AgentsClient> | The task representing the created AgentsClient. |
DeleteAgent(LocationName, CallSettings)
Deletes the specified agent.
Declaration
public virtual void DeleteAgent(LocationName parent, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
LocationName | parent | Required. The project that the agent to delete is associated with.
Format: |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Sample code
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
// Make the request
agentsClient.DeleteAgent(parent);
DeleteAgent(ProjectName, CallSettings)
Deletes the specified agent.
Declaration
public virtual void DeleteAgent(ProjectName parent, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
ProjectName | parent | Required. The project that the agent to delete is associated with.
Format: |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Sample code
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
// Make the request
agentsClient.DeleteAgent(parent);
DeleteAgent(DeleteAgentRequest, CallSettings)
Deletes the specified agent.
Declaration
public virtual void DeleteAgent(DeleteAgentRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
DeleteAgentRequest | request | The request object containing all of the parameters for the API call. |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Sample code
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
DeleteAgentRequest request = new DeleteAgentRequest
{
ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
};
// Make the request
agentsClient.DeleteAgent(request);
DeleteAgent(string, CallSettings)
Deletes the specified agent.
Declaration
public virtual void DeleteAgent(string parent, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
string | parent | Required. The project that the agent to delete is associated with.
Format: |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Sample code
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
// Make the request
agentsClient.DeleteAgent(parent);
DeleteAgentAsync(LocationName, CallSettings)
Deletes the specified agent.
Declaration
public virtual Task DeleteAgentAsync(LocationName parent, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
LocationName | parent | Required. The project that the agent to delete is associated with.
Format: |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Task | A Task containing the RPC response. |
Sample code
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
// Make the request
await agentsClient.DeleteAgentAsync(parent);
DeleteAgentAsync(LocationName, CancellationToken)
Deletes the specified agent.
Declaration
public virtual Task DeleteAgentAsync(LocationName parent, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
LocationName | parent | Required. The project that the agent to delete is associated with.
Format: |
CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
Type | Description |
---|---|
Task | A Task containing the RPC response. |
Sample code
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
// Make the request
await agentsClient.DeleteAgentAsync(parent);
DeleteAgentAsync(ProjectName, CallSettings)
Deletes the specified agent.
Declaration
public virtual Task DeleteAgentAsync(ProjectName parent, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
ProjectName | parent | Required. The project that the agent to delete is associated with.
Format: |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Task | A Task containing the RPC response. |
Sample code
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
// Make the request
await agentsClient.DeleteAgentAsync(parent);
DeleteAgentAsync(ProjectName, CancellationToken)
Deletes the specified agent.
Declaration
public virtual Task DeleteAgentAsync(ProjectName parent, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
ProjectName | parent | Required. The project that the agent to delete is associated with.
Format: |
CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
Type | Description |
---|---|
Task | A Task containing the RPC response. |
Sample code
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
// Make the request
await agentsClient.DeleteAgentAsync(parent);
DeleteAgentAsync(DeleteAgentRequest, CallSettings)
Deletes the specified agent.
Declaration
public virtual Task DeleteAgentAsync(DeleteAgentRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
DeleteAgentRequest | request | 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 |
---|---|
Task | A Task containing the RPC response. |
Sample code
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
DeleteAgentRequest request = new DeleteAgentRequest
{
ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
};
// Make the request
await agentsClient.DeleteAgentAsync(request);
DeleteAgentAsync(DeleteAgentRequest, CancellationToken)
Deletes the specified agent.
Declaration
public virtual Task DeleteAgentAsync(DeleteAgentRequest request, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
DeleteAgentRequest | request | The request object containing all of the parameters for the API call. |
CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
Type | Description |
---|---|
Task | A Task containing the RPC response. |
Sample code
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
DeleteAgentRequest request = new DeleteAgentRequest
{
ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
};
// Make the request
await agentsClient.DeleteAgentAsync(request);
DeleteAgentAsync(string, CallSettings)
Deletes the specified agent.
Declaration
public virtual Task DeleteAgentAsync(string parent, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
string | parent | Required. The project that the agent to delete is associated with.
Format: |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Task | A Task containing the RPC response. |
Sample code
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
// Make the request
await agentsClient.DeleteAgentAsync(parent);
DeleteAgentAsync(string, CancellationToken)
Deletes the specified agent.
Declaration
public virtual Task DeleteAgentAsync(string parent, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
string | parent | Required. The project that the agent to delete is associated with.
Format: |
CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
Type | Description |
---|---|
Task | A Task containing the RPC response. |
Sample code
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
// Make the request
await agentsClient.DeleteAgentAsync(parent);
ExportAgent(LocationName, CallSettings)
Exports the specified agent to a ZIP file.
This method is a long-running
operation.
The returned Operation
type has the following method-specific fields:
metadata
: An empty Struct messageresponse
: [ExportAgentResponse][google.cloud.dialogflow.v2.ExportAgentResponse]
Declaration
public virtual Operation<ExportAgentResponse, Struct> ExportAgent(LocationName parent, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
LocationName | parent | Required. The project that the agent to export is associated with.
Format: |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Operation<ExportAgentResponse, Struct> | The RPC response. |
Sample code
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
// Make the request
Operation<ExportAgentResponse, Struct> response = agentsClient.ExportAgent(parent);
// Poll until the returned long-running operation is complete
Operation<ExportAgentResponse, Struct> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
ExportAgentResponse result = completedResponse.Result;
// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<ExportAgentResponse, Struct> retrievedResponse = agentsClient.PollOnceExportAgent(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
ExportAgentResponse retrievedResult = retrievedResponse.Result;
}
ExportAgent(ProjectName, CallSettings)
Exports the specified agent to a ZIP file.
This method is a long-running
operation.
The returned Operation
type has the following method-specific fields:
metadata
: An empty Struct messageresponse
: [ExportAgentResponse][google.cloud.dialogflow.v2.ExportAgentResponse]
Declaration
public virtual Operation<ExportAgentResponse, Struct> ExportAgent(ProjectName parent, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
ProjectName | parent | Required. The project that the agent to export is associated with.
Format: |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Operation<ExportAgentResponse, Struct> | The RPC response. |
Sample code
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
// Make the request
Operation<ExportAgentResponse, Struct> response = agentsClient.ExportAgent(parent);
// Poll until the returned long-running operation is complete
Operation<ExportAgentResponse, Struct> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
ExportAgentResponse result = completedResponse.Result;
// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<ExportAgentResponse, Struct> retrievedResponse = agentsClient.PollOnceExportAgent(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
ExportAgentResponse retrievedResult = retrievedResponse.Result;
}
ExportAgent(ExportAgentRequest, CallSettings)
Exports the specified agent to a ZIP file.
This method is a long-running
operation.
The returned Operation
type has the following method-specific fields:
metadata
: An empty Struct messageresponse
: [ExportAgentResponse][google.cloud.dialogflow.v2.ExportAgentResponse]
Declaration
public virtual Operation<ExportAgentResponse, Struct> ExportAgent(ExportAgentRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
ExportAgentRequest | request | 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 |
---|---|
Operation<ExportAgentResponse, Struct> | The RPC response. |
Sample code
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
ExportAgentRequest request = new ExportAgentRequest
{
ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
AgentUri = "",
};
// Make the request
Operation<ExportAgentResponse, Struct> response = agentsClient.ExportAgent(request);
// Poll until the returned long-running operation is complete
Operation<ExportAgentResponse, Struct> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
ExportAgentResponse result = completedResponse.Result;
// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<ExportAgentResponse, Struct> retrievedResponse = agentsClient.PollOnceExportAgent(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
ExportAgentResponse retrievedResult = retrievedResponse.Result;
}
ExportAgent(string, CallSettings)
Exports the specified agent to a ZIP file.
This method is a long-running
operation.
The returned Operation
type has the following method-specific fields:
metadata
: An empty Struct messageresponse
: [ExportAgentResponse][google.cloud.dialogflow.v2.ExportAgentResponse]
Declaration
public virtual Operation<ExportAgentResponse, Struct> ExportAgent(string parent, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
string | parent | Required. The project that the agent to export is associated with.
Format: |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Operation<ExportAgentResponse, Struct> | The RPC response. |
Sample code
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
// Make the request
Operation<ExportAgentResponse, Struct> response = agentsClient.ExportAgent(parent);
// Poll until the returned long-running operation is complete
Operation<ExportAgentResponse, Struct> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
ExportAgentResponse result = completedResponse.Result;
// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<ExportAgentResponse, Struct> retrievedResponse = agentsClient.PollOnceExportAgent(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
ExportAgentResponse retrievedResult = retrievedResponse.Result;
}
ExportAgentAsync(LocationName, CallSettings)
Exports the specified agent to a ZIP file.
This method is a long-running
operation.
The returned Operation
type has the following method-specific fields:
metadata
: An empty Struct messageresponse
: [ExportAgentResponse][google.cloud.dialogflow.v2.ExportAgentResponse]
Declaration
public virtual Task<Operation<ExportAgentResponse, Struct>> ExportAgentAsync(LocationName parent, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
LocationName | parent | Required. The project that the agent to export is associated with.
Format: |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Task<Operation<ExportAgentResponse, Struct>> | A Task containing the RPC response. |
Sample code
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
// Make the request
Operation<ExportAgentResponse, Struct> response = await agentsClient.ExportAgentAsync(parent);
// Poll until the returned long-running operation is complete
Operation<ExportAgentResponse, Struct> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
ExportAgentResponse result = completedResponse.Result;
// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<ExportAgentResponse, Struct> retrievedResponse = await agentsClient.PollOnceExportAgentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
ExportAgentResponse retrievedResult = retrievedResponse.Result;
}
ExportAgentAsync(LocationName, CancellationToken)
Exports the specified agent to a ZIP file.
This method is a long-running
operation.
The returned Operation
type has the following method-specific fields:
metadata
: An empty Struct messageresponse
: [ExportAgentResponse][google.cloud.dialogflow.v2.ExportAgentResponse]
Declaration
public virtual Task<Operation<ExportAgentResponse, Struct>> ExportAgentAsync(LocationName parent, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
LocationName | parent | Required. The project that the agent to export is associated with.
Format: |
CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
Type | Description |
---|---|
Task<Operation<ExportAgentResponse, Struct>> | A Task containing the RPC response. |
Sample code
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
// Make the request
Operation<ExportAgentResponse, Struct> response = await agentsClient.ExportAgentAsync(parent);
// Poll until the returned long-running operation is complete
Operation<ExportAgentResponse, Struct> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
ExportAgentResponse result = completedResponse.Result;
// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<ExportAgentResponse, Struct> retrievedResponse = await agentsClient.PollOnceExportAgentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
ExportAgentResponse retrievedResult = retrievedResponse.Result;
}
ExportAgentAsync(ProjectName, CallSettings)
Exports the specified agent to a ZIP file.
This method is a long-running
operation.
The returned Operation
type has the following method-specific fields:
metadata
: An empty Struct messageresponse
: [ExportAgentResponse][google.cloud.dialogflow.v2.ExportAgentResponse]
Declaration
public virtual Task<Operation<ExportAgentResponse, Struct>> ExportAgentAsync(ProjectName parent, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
ProjectName | parent | Required. The project that the agent to export is associated with.
Format: |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Task<Operation<ExportAgentResponse, Struct>> | A Task containing the RPC response. |
Sample code
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
// Make the request
Operation<ExportAgentResponse, Struct> response = await agentsClient.ExportAgentAsync(parent);
// Poll until the returned long-running operation is complete
Operation<ExportAgentResponse, Struct> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
ExportAgentResponse result = completedResponse.Result;
// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<ExportAgentResponse, Struct> retrievedResponse = await agentsClient.PollOnceExportAgentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
ExportAgentResponse retrievedResult = retrievedResponse.Result;
}
ExportAgentAsync(ProjectName, CancellationToken)
Exports the specified agent to a ZIP file.
This method is a long-running
operation.
The returned Operation
type has the following method-specific fields:
metadata
: An empty Struct messageresponse
: [ExportAgentResponse][google.cloud.dialogflow.v2.ExportAgentResponse]
Declaration
public virtual Task<Operation<ExportAgentResponse, Struct>> ExportAgentAsync(ProjectName parent, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
ProjectName | parent | Required. The project that the agent to export is associated with.
Format: |
CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
Type | Description |
---|---|
Task<Operation<ExportAgentResponse, Struct>> | A Task containing the RPC response. |
Sample code
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
// Make the request
Operation<ExportAgentResponse, Struct> response = await agentsClient.ExportAgentAsync(parent);
// Poll until the returned long-running operation is complete
Operation<ExportAgentResponse, Struct> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
ExportAgentResponse result = completedResponse.Result;
// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<ExportAgentResponse, Struct> retrievedResponse = await agentsClient.PollOnceExportAgentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
ExportAgentResponse retrievedResult = retrievedResponse.Result;
}
ExportAgentAsync(ExportAgentRequest, CallSettings)
Exports the specified agent to a ZIP file.
This method is a long-running
operation.
The returned Operation
type has the following method-specific fields:
metadata
: An empty Struct messageresponse
: [ExportAgentResponse][google.cloud.dialogflow.v2.ExportAgentResponse]
Declaration
public virtual Task<Operation<ExportAgentResponse, Struct>> ExportAgentAsync(ExportAgentRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
ExportAgentRequest | request | 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 |
---|---|
Task<Operation<ExportAgentResponse, Struct>> | A Task containing the RPC response. |
Sample code
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
ExportAgentRequest request = new ExportAgentRequest
{
ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
AgentUri = "",
};
// Make the request
Operation<ExportAgentResponse, Struct> response = await agentsClient.ExportAgentAsync(request);
// Poll until the returned long-running operation is complete
Operation<ExportAgentResponse, Struct> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
ExportAgentResponse result = completedResponse.Result;
// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<ExportAgentResponse, Struct> retrievedResponse = await agentsClient.PollOnceExportAgentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
ExportAgentResponse retrievedResult = retrievedResponse.Result;
}
ExportAgentAsync(ExportAgentRequest, CancellationToken)
Exports the specified agent to a ZIP file.
This method is a long-running
operation.
The returned Operation
type has the following method-specific fields:
metadata
: An empty Struct messageresponse
: [ExportAgentResponse][google.cloud.dialogflow.v2.ExportAgentResponse]
Declaration
public virtual Task<Operation<ExportAgentResponse, Struct>> ExportAgentAsync(ExportAgentRequest request, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
ExportAgentRequest | request | The request object containing all of the parameters for the API call. |
CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
Type | Description |
---|---|
Task<Operation<ExportAgentResponse, Struct>> | A Task containing the RPC response. |
Sample code
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
ExportAgentRequest request = new ExportAgentRequest
{
ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
AgentUri = "",
};
// Make the request
Operation<ExportAgentResponse, Struct> response = await agentsClient.ExportAgentAsync(request);
// Poll until the returned long-running operation is complete
Operation<ExportAgentResponse, Struct> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
ExportAgentResponse result = completedResponse.Result;
// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<ExportAgentResponse, Struct> retrievedResponse = await agentsClient.PollOnceExportAgentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
ExportAgentResponse retrievedResult = retrievedResponse.Result;
}
ExportAgentAsync(string, CallSettings)
Exports the specified agent to a ZIP file.
This method is a long-running
operation.
The returned Operation
type has the following method-specific fields:
metadata
: An empty Struct messageresponse
: [ExportAgentResponse][google.cloud.dialogflow.v2.ExportAgentResponse]
Declaration
public virtual Task<Operation<ExportAgentResponse, Struct>> ExportAgentAsync(string parent, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
string | parent | Required. The project that the agent to export is associated with.
Format: |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Task<Operation<ExportAgentResponse, Struct>> | A Task containing the RPC response. |
Sample code
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
// Make the request
Operation<ExportAgentResponse, Struct> response = await agentsClient.ExportAgentAsync(parent);
// Poll until the returned long-running operation is complete
Operation<ExportAgentResponse, Struct> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
ExportAgentResponse result = completedResponse.Result;
// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<ExportAgentResponse, Struct> retrievedResponse = await agentsClient.PollOnceExportAgentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
ExportAgentResponse retrievedResult = retrievedResponse.Result;
}
ExportAgentAsync(string, CancellationToken)
Exports the specified agent to a ZIP file.
This method is a long-running
operation.
The returned Operation
type has the following method-specific fields:
metadata
: An empty Struct messageresponse
: [ExportAgentResponse][google.cloud.dialogflow.v2.ExportAgentResponse]
Declaration
public virtual Task<Operation<ExportAgentResponse, Struct>> ExportAgentAsync(string parent, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
string | parent | Required. The project that the agent to export is associated with.
Format: |
CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
Type | Description |
---|---|
Task<Operation<ExportAgentResponse, Struct>> | A Task containing the RPC response. |
Sample code
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
// Make the request
Operation<ExportAgentResponse, Struct> response = await agentsClient.ExportAgentAsync(parent);
// Poll until the returned long-running operation is complete
Operation<ExportAgentResponse, Struct> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
ExportAgentResponse result = completedResponse.Result;
// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<ExportAgentResponse, Struct> retrievedResponse = await agentsClient.PollOnceExportAgentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
ExportAgentResponse retrievedResult = retrievedResponse.Result;
}
GetAgent(LocationName, CallSettings)
Retrieves the specified agent.
Declaration
public virtual Agent GetAgent(LocationName parent, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
LocationName | parent | Required. The project that the agent to fetch is associated with.
Format: |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Agent | The RPC response. |
Sample code
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
// Make the request
Agent response = agentsClient.GetAgent(parent);
GetAgent(ProjectName, CallSettings)
Retrieves the specified agent.
Declaration
public virtual Agent GetAgent(ProjectName parent, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
ProjectName | parent | Required. The project that the agent to fetch is associated with.
Format: |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Agent | The RPC response. |
Sample code
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
// Make the request
Agent response = agentsClient.GetAgent(parent);
GetAgent(GetAgentRequest, CallSettings)
Retrieves the specified agent.
Declaration
public virtual Agent GetAgent(GetAgentRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
GetAgentRequest | request | 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 |
---|---|
Agent | The RPC response. |
Sample code
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
GetAgentRequest request = new GetAgentRequest
{
ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
};
// Make the request
Agent response = agentsClient.GetAgent(request);
GetAgent(string, CallSettings)
Retrieves the specified agent.
Declaration
public virtual Agent GetAgent(string parent, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
string | parent | Required. The project that the agent to fetch is associated with.
Format: |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Agent | The RPC response. |
Sample code
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
// Make the request
Agent response = agentsClient.GetAgent(parent);
GetAgentAsync(LocationName, CallSettings)
Retrieves the specified agent.
Declaration
public virtual Task<Agent> GetAgentAsync(LocationName parent, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
LocationName | parent | Required. The project that the agent to fetch is associated with.
Format: |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Task<Agent> | A Task containing the RPC response. |
Sample code
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
// Make the request
Agent response = await agentsClient.GetAgentAsync(parent);
GetAgentAsync(LocationName, CancellationToken)
Retrieves the specified agent.
Declaration
public virtual Task<Agent> GetAgentAsync(LocationName parent, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
LocationName | parent | Required. The project that the agent to fetch is associated with.
Format: |
CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
Type | Description |
---|---|
Task<Agent> | A Task containing the RPC response. |
Sample code
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
// Make the request
Agent response = await agentsClient.GetAgentAsync(parent);
GetAgentAsync(ProjectName, CallSettings)
Retrieves the specified agent.
Declaration
public virtual Task<Agent> GetAgentAsync(ProjectName parent, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
ProjectName | parent | Required. The project that the agent to fetch is associated with.
Format: |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Task<Agent> | A Task containing the RPC response. |
Sample code
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
// Make the request
Agent response = await agentsClient.GetAgentAsync(parent);
GetAgentAsync(ProjectName, CancellationToken)
Retrieves the specified agent.
Declaration
public virtual Task<Agent> GetAgentAsync(ProjectName parent, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
ProjectName | parent | Required. The project that the agent to fetch is associated with.
Format: |
CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
Type | Description |
---|---|
Task<Agent> | A Task containing the RPC response. |
Sample code
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
// Make the request
Agent response = await agentsClient.GetAgentAsync(parent);
GetAgentAsync(GetAgentRequest, CallSettings)
Retrieves the specified agent.
Declaration
public virtual Task<Agent> GetAgentAsync(GetAgentRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
GetAgentRequest | request | 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 |
---|---|
Task<Agent> | A Task containing the RPC response. |
Sample code
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
GetAgentRequest request = new GetAgentRequest
{
ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
};
// Make the request
Agent response = await agentsClient.GetAgentAsync(request);
GetAgentAsync(GetAgentRequest, CancellationToken)
Retrieves the specified agent.
Declaration
public virtual Task<Agent> GetAgentAsync(GetAgentRequest request, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
GetAgentRequest | request | The request object containing all of the parameters for the API call. |
CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
Type | Description |
---|---|
Task<Agent> | A Task containing the RPC response. |
Sample code
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
GetAgentRequest request = new GetAgentRequest
{
ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
};
// Make the request
Agent response = await agentsClient.GetAgentAsync(request);
GetAgentAsync(string, CallSettings)
Retrieves the specified agent.
Declaration
public virtual Task<Agent> GetAgentAsync(string parent, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
string | parent | Required. The project that the agent to fetch is associated with.
Format: |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Task<Agent> | A Task containing the RPC response. |
Sample code
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
// Make the request
Agent response = await agentsClient.GetAgentAsync(parent);
GetAgentAsync(string, CancellationToken)
Retrieves the specified agent.
Declaration
public virtual Task<Agent> GetAgentAsync(string parent, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
string | parent | Required. The project that the agent to fetch is associated with.
Format: |
CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
Type | Description |
---|---|
Task<Agent> | A Task containing the RPC response. |
Sample code
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
// Make the request
Agent response = await agentsClient.GetAgentAsync(parent);
GetValidationResult(GetValidationResultRequest, CallSettings)
Gets agent validation result. Agent validation is performed during training time and is updated automatically when training is completed.
Declaration
public virtual ValidationResult GetValidationResult(GetValidationResultRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
GetValidationResultRequest | request | 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 |
---|---|
ValidationResult | The RPC response. |
Sample code
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
GetValidationResultRequest request = new GetValidationResultRequest
{
ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
LanguageCode = "",
};
// Make the request
ValidationResult response = agentsClient.GetValidationResult(request);
GetValidationResultAsync(GetValidationResultRequest, CallSettings)
Gets agent validation result. Agent validation is performed during training time and is updated automatically when training is completed.
Declaration
public virtual Task<ValidationResult> GetValidationResultAsync(GetValidationResultRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
GetValidationResultRequest | request | 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 |
---|---|
Task<ValidationResult> | A Task containing the RPC response. |
Sample code
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
GetValidationResultRequest request = new GetValidationResultRequest
{
ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
LanguageCode = "",
};
// Make the request
ValidationResult response = await agentsClient.GetValidationResultAsync(request);
GetValidationResultAsync(GetValidationResultRequest, CancellationToken)
Gets agent validation result. Agent validation is performed during training time and is updated automatically when training is completed.
Declaration
public virtual Task<ValidationResult> GetValidationResultAsync(GetValidationResultRequest request, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
GetValidationResultRequest | request | The request object containing all of the parameters for the API call. |
CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
Type | Description |
---|---|
Task<ValidationResult> | A Task containing the RPC response. |
Sample code
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
GetValidationResultRequest request = new GetValidationResultRequest
{
ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
LanguageCode = "",
};
// Make the request
ValidationResult response = await agentsClient.GetValidationResultAsync(request);
ImportAgent(ImportAgentRequest, CallSettings)
Imports the specified agent from a ZIP file.
Uploads new intents and entity types without deleting the existing ones. Intents and entity types with the same name are replaced with the new versions from [ImportAgentRequest][google.cloud.dialogflow.v2.ImportAgentRequest]. After the import, the imported draft agent will be trained automatically (unless disabled in agent settings). However, once the import is done, training may not be completed yet. Please call [TrainAgent][google.cloud.dialogflow.v2.Agents.TrainAgent] and wait for the operation it returns in order to train explicitly.
This method is a long-running
operation.
The returned Operation
type has the following method-specific fields:
metadata
: An empty Struct messageresponse
: An Empty message
The operation only tracks when importing is complete, not when it is done training.
Note: You should always train an agent prior to sending it queries. See the training documentation.
Declaration
public virtual Operation<Empty, Struct> ImportAgent(ImportAgentRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
ImportAgentRequest | request | 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 |
---|---|
Operation<Empty, Struct> | The RPC response. |
Sample code
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
ImportAgentRequest request = new ImportAgentRequest
{
ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
AgentUri = "",
};
// Make the request
Operation<Empty, Struct> response = agentsClient.ImportAgent(request);
// Poll until the returned long-running operation is complete
Operation<Empty, Struct> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Empty result = completedResponse.Result;
// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Empty, Struct> retrievedResponse = agentsClient.PollOnceImportAgent(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
Empty retrievedResult = retrievedResponse.Result;
}
ImportAgentAsync(ImportAgentRequest, CallSettings)
Imports the specified agent from a ZIP file.
Uploads new intents and entity types without deleting the existing ones. Intents and entity types with the same name are replaced with the new versions from [ImportAgentRequest][google.cloud.dialogflow.v2.ImportAgentRequest]. After the import, the imported draft agent will be trained automatically (unless disabled in agent settings). However, once the import is done, training may not be completed yet. Please call [TrainAgent][google.cloud.dialogflow.v2.Agents.TrainAgent] and wait for the operation it returns in order to train explicitly.
This method is a long-running
operation.
The returned Operation
type has the following method-specific fields:
metadata
: An empty Struct messageresponse
: An Empty message
The operation only tracks when importing is complete, not when it is done training.
Note: You should always train an agent prior to sending it queries. See the training documentation.
Declaration
public virtual Task<Operation<Empty, Struct>> ImportAgentAsync(ImportAgentRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
ImportAgentRequest | request | 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 |
---|---|
Task<Operation<Empty, Struct>> | A Task containing the RPC response. |
Sample code
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
ImportAgentRequest request = new ImportAgentRequest
{
ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
AgentUri = "",
};
// Make the request
Operation<Empty, Struct> response = await agentsClient.ImportAgentAsync(request);
// Poll until the returned long-running operation is complete
Operation<Empty, Struct> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Empty result = completedResponse.Result;
// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Empty, Struct> retrievedResponse = await agentsClient.PollOnceImportAgentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
Empty retrievedResult = retrievedResponse.Result;
}
ImportAgentAsync(ImportAgentRequest, CancellationToken)
Imports the specified agent from a ZIP file.
Uploads new intents and entity types without deleting the existing ones. Intents and entity types with the same name are replaced with the new versions from [ImportAgentRequest][google.cloud.dialogflow.v2.ImportAgentRequest]. After the import, the imported draft agent will be trained automatically (unless disabled in agent settings). However, once the import is done, training may not be completed yet. Please call [TrainAgent][google.cloud.dialogflow.v2.Agents.TrainAgent] and wait for the operation it returns in order to train explicitly.
This method is a long-running
operation.
The returned Operation
type has the following method-specific fields:
metadata
: An empty Struct messageresponse
: An Empty message
The operation only tracks when importing is complete, not when it is done training.
Note: You should always train an agent prior to sending it queries. See the training documentation.
Declaration
public virtual Task<Operation<Empty, Struct>> ImportAgentAsync(ImportAgentRequest request, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
ImportAgentRequest | request | The request object containing all of the parameters for the API call. |
CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
Type | Description |
---|---|
Task<Operation<Empty, Struct>> | A Task containing the RPC response. |
Sample code
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
ImportAgentRequest request = new ImportAgentRequest
{
ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
AgentUri = "",
};
// Make the request
Operation<Empty, Struct> response = await agentsClient.ImportAgentAsync(request);
// Poll until the returned long-running operation is complete
Operation<Empty, Struct> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Empty result = completedResponse.Result;
// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Empty, Struct> retrievedResponse = await agentsClient.PollOnceImportAgentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
Empty retrievedResult = retrievedResponse.Result;
}
PollOnceExportAgent(string, CallSettings)
Poll an operation once, using an operationName
from a previous invocation of ExportAgent
.
Declaration
public virtual Operation<ExportAgentResponse, Struct> PollOnceExportAgent(string operationName, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
string | operationName | The name of a previously invoked operation. Must not be |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Operation<ExportAgentResponse, Struct> | The result of polling the operation. |
PollOnceExportAgentAsync(string, CallSettings)
Asynchronously poll an operation once, using an operationName
from a previous invocation of
ExportAgent
.
Declaration
public virtual Task<Operation<ExportAgentResponse, Struct>> PollOnceExportAgentAsync(string operationName, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
string | operationName | The name of a previously invoked operation. Must not be |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Task<Operation<ExportAgentResponse, Struct>> | A task representing the result of polling the operation. |
PollOnceImportAgent(string, CallSettings)
Poll an operation once, using an operationName
from a previous invocation of ImportAgent
.
Declaration
public virtual Operation<Empty, Struct> PollOnceImportAgent(string operationName, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
string | operationName | The name of a previously invoked operation. Must not be |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Operation<Empty, Struct> | The result of polling the operation. |
PollOnceImportAgentAsync(string, CallSettings)
Asynchronously poll an operation once, using an operationName
from a previous invocation of
ImportAgent
.
Declaration
public virtual Task<Operation<Empty, Struct>> PollOnceImportAgentAsync(string operationName, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
string | operationName | The name of a previously invoked operation. Must not be |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Task<Operation<Empty, Struct>> | A task representing the result of polling the operation. |
PollOnceRestoreAgent(string, CallSettings)
Poll an operation once, using an operationName
from a previous invocation of RestoreAgent
.
Declaration
public virtual Operation<Empty, Struct> PollOnceRestoreAgent(string operationName, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
string | operationName | The name of a previously invoked operation. Must not be |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Operation<Empty, Struct> | The result of polling the operation. |
PollOnceRestoreAgentAsync(string, CallSettings)
Asynchronously poll an operation once, using an operationName
from a previous invocation of
RestoreAgent
.
Declaration
public virtual Task<Operation<Empty, Struct>> PollOnceRestoreAgentAsync(string operationName, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
string | operationName | The name of a previously invoked operation. Must not be |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Task<Operation<Empty, Struct>> | A task representing the result of polling the operation. |
PollOnceTrainAgent(string, CallSettings)
Poll an operation once, using an operationName
from a previous invocation of TrainAgent
.
Declaration
public virtual Operation<Empty, Struct> PollOnceTrainAgent(string operationName, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
string | operationName | The name of a previously invoked operation. Must not be |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Operation<Empty, Struct> | The result of polling the operation. |
PollOnceTrainAgentAsync(string, CallSettings)
Asynchronously poll an operation once, using an operationName
from a previous invocation of
TrainAgent
.
Declaration
public virtual Task<Operation<Empty, Struct>> PollOnceTrainAgentAsync(string operationName, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
string | operationName | The name of a previously invoked operation. Must not be |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Task<Operation<Empty, Struct>> | A task representing the result of polling the operation. |
RestoreAgent(RestoreAgentRequest, CallSettings)
Restores the specified agent from a ZIP file.
Replaces the current agent version with a new one. All the intents and entity types in the older version are deleted. After the restore, the restored draft agent will be trained automatically (unless disabled in agent settings). However, once the restore is done, training may not be completed yet. Please call [TrainAgent][google.cloud.dialogflow.v2.Agents.TrainAgent] and wait for the operation it returns in order to train explicitly.
This method is a long-running
operation.
The returned Operation
type has the following method-specific fields:
metadata
: An empty Struct messageresponse
: An Empty message
The operation only tracks when restoring is complete, not when it is done training.
Note: You should always train an agent prior to sending it queries. See the training documentation.
Declaration
public virtual Operation<Empty, Struct> RestoreAgent(RestoreAgentRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
RestoreAgentRequest | request | 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 |
---|---|
Operation<Empty, Struct> | The RPC response. |
Sample code
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
RestoreAgentRequest request = new RestoreAgentRequest
{
ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
AgentUri = "",
};
// Make the request
Operation<Empty, Struct> response = agentsClient.RestoreAgent(request);
// Poll until the returned long-running operation is complete
Operation<Empty, Struct> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Empty result = completedResponse.Result;
// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Empty, Struct> retrievedResponse = agentsClient.PollOnceRestoreAgent(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
Empty retrievedResult = retrievedResponse.Result;
}
RestoreAgentAsync(RestoreAgentRequest, CallSettings)
Restores the specified agent from a ZIP file.
Replaces the current agent version with a new one. All the intents and entity types in the older version are deleted. After the restore, the restored draft agent will be trained automatically (unless disabled in agent settings). However, once the restore is done, training may not be completed yet. Please call [TrainAgent][google.cloud.dialogflow.v2.Agents.TrainAgent] and wait for the operation it returns in order to train explicitly.
This method is a long-running
operation.
The returned Operation
type has the following method-specific fields:
metadata
: An empty Struct messageresponse
: An Empty message
The operation only tracks when restoring is complete, not when it is done training.
Note: You should always train an agent prior to sending it queries. See the training documentation.
Declaration
public virtual Task<Operation<Empty, Struct>> RestoreAgentAsync(RestoreAgentRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
RestoreAgentRequest | request | 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 |
---|---|
Task<Operation<Empty, Struct>> | A Task containing the RPC response. |
Sample code
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
RestoreAgentRequest request = new RestoreAgentRequest
{
ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
AgentUri = "",
};
// Make the request
Operation<Empty, Struct> response = await agentsClient.RestoreAgentAsync(request);
// Poll until the returned long-running operation is complete
Operation<Empty, Struct> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Empty result = completedResponse.Result;
// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Empty, Struct> retrievedResponse = await agentsClient.PollOnceRestoreAgentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
Empty retrievedResult = retrievedResponse.Result;
}
RestoreAgentAsync(RestoreAgentRequest, CancellationToken)
Restores the specified agent from a ZIP file.
Replaces the current agent version with a new one. All the intents and entity types in the older version are deleted. After the restore, the restored draft agent will be trained automatically (unless disabled in agent settings). However, once the restore is done, training may not be completed yet. Please call [TrainAgent][google.cloud.dialogflow.v2.Agents.TrainAgent] and wait for the operation it returns in order to train explicitly.
This method is a long-running
operation.
The returned Operation
type has the following method-specific fields:
metadata
: An empty Struct messageresponse
: An Empty message
The operation only tracks when restoring is complete, not when it is done training.
Note: You should always train an agent prior to sending it queries. See the training documentation.
Declaration
public virtual Task<Operation<Empty, Struct>> RestoreAgentAsync(RestoreAgentRequest request, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
RestoreAgentRequest | request | The request object containing all of the parameters for the API call. |
CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
Type | Description |
---|---|
Task<Operation<Empty, Struct>> | A Task containing the RPC response. |
Sample code
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
RestoreAgentRequest request = new RestoreAgentRequest
{
ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
AgentUri = "",
};
// Make the request
Operation<Empty, Struct> response = await agentsClient.RestoreAgentAsync(request);
// Poll until the returned long-running operation is complete
Operation<Empty, Struct> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Empty result = completedResponse.Result;
// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Empty, Struct> retrievedResponse = await agentsClient.PollOnceRestoreAgentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
Empty retrievedResult = retrievedResponse.Result;
}
SearchAgents(LocationName, string, int?, CallSettings)
Returns the list of agents.
Since there is at most one conversational agent per project, this method is useful primarily for listing all agents across projects the caller has access to. One can achieve that with a wildcard project collection id "-". Refer to List Sub-Collections.
Declaration
public virtual PagedEnumerable<SearchAgentsResponse, Agent> SearchAgents(LocationName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
LocationName | parent | Required. The project to list agents from.
Format: |
string | pageToken | The token returned from the previous request. A value of |
int? | pageSize | 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 |
---|---|
PagedEnumerable<SearchAgentsResponse, Agent> | A pageable sequence of Agent resources. |
Sample code
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
// Make the request
PagedEnumerable<SearchAgentsResponse, Agent> response = agentsClient.SearchAgents(parent);
// Iterate over all response items, lazily performing RPCs as required
foreach (Agent 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 (SearchAgentsResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Agent 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<Agent> 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 (Agent 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;
SearchAgents(ProjectName, string, int?, CallSettings)
Returns the list of agents.
Since there is at most one conversational agent per project, this method is useful primarily for listing all agents across projects the caller has access to. One can achieve that with a wildcard project collection id "-". Refer to List Sub-Collections.
Declaration
public virtual PagedEnumerable<SearchAgentsResponse, Agent> SearchAgents(ProjectName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
ProjectName | parent | Required. The project to list agents from.
Format: |
string | pageToken | The token returned from the previous request. A value of |
int? | pageSize | 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 |
---|---|
PagedEnumerable<SearchAgentsResponse, Agent> | A pageable sequence of Agent resources. |
Sample code
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
// Make the request
PagedEnumerable<SearchAgentsResponse, Agent> response = agentsClient.SearchAgents(parent);
// Iterate over all response items, lazily performing RPCs as required
foreach (Agent 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 (SearchAgentsResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Agent 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<Agent> 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 (Agent 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;
SearchAgents(SearchAgentsRequest, CallSettings)
Returns the list of agents.
Since there is at most one conversational agent per project, this method is useful primarily for listing all agents across projects the caller has access to. One can achieve that with a wildcard project collection id "-". Refer to List Sub-Collections.
Declaration
public virtual PagedEnumerable<SearchAgentsResponse, Agent> SearchAgents(SearchAgentsRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
SearchAgentsRequest | request | 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 |
---|---|
PagedEnumerable<SearchAgentsResponse, Agent> | A pageable sequence of Agent resources. |
Sample code
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
SearchAgentsRequest request = new SearchAgentsRequest
{
ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
};
// Make the request
PagedEnumerable<SearchAgentsResponse, Agent> response = agentsClient.SearchAgents(request);
// Iterate over all response items, lazily performing RPCs as required
foreach (Agent 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 (SearchAgentsResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Agent 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<Agent> 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 (Agent 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;
SearchAgents(string, string, int?, CallSettings)
Returns the list of agents.
Since there is at most one conversational agent per project, this method is useful primarily for listing all agents across projects the caller has access to. One can achieve that with a wildcard project collection id "-". Refer to List Sub-Collections.
Declaration
public virtual PagedEnumerable<SearchAgentsResponse, Agent> SearchAgents(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
string | parent | Required. The project to list agents from.
Format: |
string | pageToken | The token returned from the previous request. A value of |
int? | pageSize | 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 |
---|---|
PagedEnumerable<SearchAgentsResponse, Agent> | A pageable sequence of Agent resources. |
Sample code
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
// Make the request
PagedEnumerable<SearchAgentsResponse, Agent> response = agentsClient.SearchAgents(parent);
// Iterate over all response items, lazily performing RPCs as required
foreach (Agent 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 (SearchAgentsResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Agent 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<Agent> 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 (Agent 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;
SearchAgentsAsync(LocationName, string, int?, CallSettings)
Returns the list of agents.
Since there is at most one conversational agent per project, this method is useful primarily for listing all agents across projects the caller has access to. One can achieve that with a wildcard project collection id "-". Refer to List Sub-Collections.
Declaration
public virtual PagedAsyncEnumerable<SearchAgentsResponse, Agent> SearchAgentsAsync(LocationName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
LocationName | parent | Required. The project to list agents from.
Format: |
string | pageToken | The token returned from the previous request. A value of |
int? | pageSize | 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 |
---|---|
PagedAsyncEnumerable<SearchAgentsResponse, Agent> | A pageable asynchronous sequence of Agent resources. |
Sample code
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
// Make the request
PagedAsyncEnumerable<SearchAgentsResponse, Agent> response = agentsClient.SearchAgentsAsync(parent);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Agent 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((SearchAgentsResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Agent 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<Agent> 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 (Agent 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;
SearchAgentsAsync(ProjectName, string, int?, CallSettings)
Returns the list of agents.
Since there is at most one conversational agent per project, this method is useful primarily for listing all agents across projects the caller has access to. One can achieve that with a wildcard project collection id "-". Refer to List Sub-Collections.
Declaration
public virtual PagedAsyncEnumerable<SearchAgentsResponse, Agent> SearchAgentsAsync(ProjectName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
ProjectName | parent | Required. The project to list agents from.
Format: |
string | pageToken | The token returned from the previous request. A value of |
int? | pageSize | 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 |
---|---|
PagedAsyncEnumerable<SearchAgentsResponse, Agent> | A pageable asynchronous sequence of Agent resources. |
Sample code
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
// Make the request
PagedAsyncEnumerable<SearchAgentsResponse, Agent> response = agentsClient.SearchAgentsAsync(parent);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Agent 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((SearchAgentsResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Agent 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<Agent> 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 (Agent 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;
SearchAgentsAsync(SearchAgentsRequest, CallSettings)
Returns the list of agents.
Since there is at most one conversational agent per project, this method is useful primarily for listing all agents across projects the caller has access to. One can achieve that with a wildcard project collection id "-". Refer to List Sub-Collections.
Declaration
public virtual PagedAsyncEnumerable<SearchAgentsResponse, Agent> SearchAgentsAsync(SearchAgentsRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
SearchAgentsRequest | request | 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 |
---|---|
PagedAsyncEnumerable<SearchAgentsResponse, Agent> | A pageable asynchronous sequence of Agent resources. |
Sample code
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
SearchAgentsRequest request = new SearchAgentsRequest
{
ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
};
// Make the request
PagedAsyncEnumerable<SearchAgentsResponse, Agent> response = agentsClient.SearchAgentsAsync(request);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Agent 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((SearchAgentsResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Agent 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<Agent> 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 (Agent 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;
SearchAgentsAsync(string, string, int?, CallSettings)
Returns the list of agents.
Since there is at most one conversational agent per project, this method is useful primarily for listing all agents across projects the caller has access to. One can achieve that with a wildcard project collection id "-". Refer to List Sub-Collections.
Declaration
public virtual PagedAsyncEnumerable<SearchAgentsResponse, Agent> SearchAgentsAsync(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
string | parent | Required. The project to list agents from.
Format: |
string | pageToken | The token returned from the previous request. A value of |
int? | pageSize | 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 |
---|---|
PagedAsyncEnumerable<SearchAgentsResponse, Agent> | A pageable asynchronous sequence of Agent resources. |
Sample code
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
// Make the request
PagedAsyncEnumerable<SearchAgentsResponse, Agent> response = agentsClient.SearchAgentsAsync(parent);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Agent 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((SearchAgentsResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Agent 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<Agent> 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 (Agent 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;
SetAgent(Agent, CallSettings)
Creates/updates the specified agent.
Note: You should always train an agent prior to sending it queries. See the training documentation.
Declaration
public virtual Agent SetAgent(Agent agent, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
Agent | agent | Required. The agent to update. |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Agent | The RPC response. |
Sample code
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
Agent agent = new Agent();
// Make the request
Agent response = agentsClient.SetAgent(agent);
SetAgent(SetAgentRequest, CallSettings)
Creates/updates the specified agent.
Note: You should always train an agent prior to sending it queries. See the training documentation.
Declaration
public virtual Agent SetAgent(SetAgentRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
SetAgentRequest | request | 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 |
---|---|
Agent | The RPC response. |
Sample code
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
SetAgentRequest request = new SetAgentRequest
{
Agent = new Agent(),
UpdateMask = new FieldMask(),
};
// Make the request
Agent response = agentsClient.SetAgent(request);
SetAgentAsync(Agent, CallSettings)
Creates/updates the specified agent.
Note: You should always train an agent prior to sending it queries. See the training documentation.
Declaration
public virtual Task<Agent> SetAgentAsync(Agent agent, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
Agent | agent | Required. The agent to update. |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Task<Agent> | A Task containing the RPC response. |
Sample code
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
Agent agent = new Agent();
// Make the request
Agent response = await agentsClient.SetAgentAsync(agent);
SetAgentAsync(Agent, CancellationToken)
Creates/updates the specified agent.
Note: You should always train an agent prior to sending it queries. See the training documentation.
Declaration
public virtual Task<Agent> SetAgentAsync(Agent agent, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
Agent | agent | Required. The agent to update. |
CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
Type | Description |
---|---|
Task<Agent> | A Task containing the RPC response. |
Sample code
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
Agent agent = new Agent();
// Make the request
Agent response = await agentsClient.SetAgentAsync(agent);
SetAgentAsync(SetAgentRequest, CallSettings)
Creates/updates the specified agent.
Note: You should always train an agent prior to sending it queries. See the training documentation.
Declaration
public virtual Task<Agent> SetAgentAsync(SetAgentRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
SetAgentRequest | request | 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 |
---|---|
Task<Agent> | A Task containing the RPC response. |
Sample code
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
SetAgentRequest request = new SetAgentRequest
{
Agent = new Agent(),
UpdateMask = new FieldMask(),
};
// Make the request
Agent response = await agentsClient.SetAgentAsync(request);
SetAgentAsync(SetAgentRequest, CancellationToken)
Creates/updates the specified agent.
Note: You should always train an agent prior to sending it queries. See the training documentation.
Declaration
public virtual Task<Agent> SetAgentAsync(SetAgentRequest request, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
SetAgentRequest | request | The request object containing all of the parameters for the API call. |
CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
Type | Description |
---|---|
Task<Agent> | A Task containing the RPC response. |
Sample code
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
SetAgentRequest request = new SetAgentRequest
{
Agent = new Agent(),
UpdateMask = new FieldMask(),
};
// Make the request
Agent response = await agentsClient.SetAgentAsync(request);
ShutdownDefaultChannelsAsync()
Shuts down any channels automatically created by Create() and CreateAsync(CancellationToken). Channels which weren't automatically created are not affected.
Declaration
public static Task ShutdownDefaultChannelsAsync()
Returns
Type | Description |
---|---|
Task | A task representing the asynchronous shutdown operation. |
Remarks
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.
TrainAgent(LocationName, CallSettings)
Trains the specified agent.
This method is a long-running
operation.
The returned Operation
type has the following method-specific fields:
metadata
: An empty Struct messageresponse
: An Empty message
Note: You should always train an agent prior to sending it queries. See the training documentation.
Declaration
public virtual Operation<Empty, Struct> TrainAgent(LocationName parent, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
LocationName | parent | Required. The project that the agent to train is associated with.
Format: |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Operation<Empty, Struct> | The RPC response. |
Sample code
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
// Make the request
Operation<Empty, Struct> response = agentsClient.TrainAgent(parent);
// Poll until the returned long-running operation is complete
Operation<Empty, Struct> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Empty result = completedResponse.Result;
// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Empty, Struct> retrievedResponse = agentsClient.PollOnceTrainAgent(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
Empty retrievedResult = retrievedResponse.Result;
}
TrainAgent(ProjectName, CallSettings)
Trains the specified agent.
This method is a long-running
operation.
The returned Operation
type has the following method-specific fields:
metadata
: An empty Struct messageresponse
: An Empty message
Note: You should always train an agent prior to sending it queries. See the training documentation.
Declaration
public virtual Operation<Empty, Struct> TrainAgent(ProjectName parent, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
ProjectName | parent | Required. The project that the agent to train is associated with.
Format: |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Operation<Empty, Struct> | The RPC response. |
Sample code
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
// Make the request
Operation<Empty, Struct> response = agentsClient.TrainAgent(parent);
// Poll until the returned long-running operation is complete
Operation<Empty, Struct> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Empty result = completedResponse.Result;
// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Empty, Struct> retrievedResponse = agentsClient.PollOnceTrainAgent(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
Empty retrievedResult = retrievedResponse.Result;
}
TrainAgent(TrainAgentRequest, CallSettings)
Trains the specified agent.
This method is a long-running
operation.
The returned Operation
type has the following method-specific fields:
metadata
: An empty Struct messageresponse
: An Empty message
Note: You should always train an agent prior to sending it queries. See the training documentation.
Declaration
public virtual Operation<Empty, Struct> TrainAgent(TrainAgentRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
TrainAgentRequest | request | 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 |
---|---|
Operation<Empty, Struct> | The RPC response. |
Sample code
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
TrainAgentRequest request = new TrainAgentRequest
{
ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
};
// Make the request
Operation<Empty, Struct> response = agentsClient.TrainAgent(request);
// Poll until the returned long-running operation is complete
Operation<Empty, Struct> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Empty result = completedResponse.Result;
// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Empty, Struct> retrievedResponse = agentsClient.PollOnceTrainAgent(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
Empty retrievedResult = retrievedResponse.Result;
}
TrainAgent(string, CallSettings)
Trains the specified agent.
This method is a long-running
operation.
The returned Operation
type has the following method-specific fields:
metadata
: An empty Struct messageresponse
: An Empty message
Note: You should always train an agent prior to sending it queries. See the training documentation.
Declaration
public virtual Operation<Empty, Struct> TrainAgent(string parent, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
string | parent | Required. The project that the agent to train is associated with.
Format: |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Operation<Empty, Struct> | The RPC response. |
Sample code
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
// Make the request
Operation<Empty, Struct> response = agentsClient.TrainAgent(parent);
// Poll until the returned long-running operation is complete
Operation<Empty, Struct> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Empty result = completedResponse.Result;
// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Empty, Struct> retrievedResponse = agentsClient.PollOnceTrainAgent(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
Empty retrievedResult = retrievedResponse.Result;
}
TrainAgentAsync(LocationName, CallSettings)
Trains the specified agent.
This method is a long-running
operation.
The returned Operation
type has the following method-specific fields:
metadata
: An empty Struct messageresponse
: An Empty message
Note: You should always train an agent prior to sending it queries. See the training documentation.
Declaration
public virtual Task<Operation<Empty, Struct>> TrainAgentAsync(LocationName parent, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
LocationName | parent | Required. The project that the agent to train is associated with.
Format: |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Task<Operation<Empty, Struct>> | A Task containing the RPC response. |
Sample code
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
// Make the request
Operation<Empty, Struct> response = await agentsClient.TrainAgentAsync(parent);
// Poll until the returned long-running operation is complete
Operation<Empty, Struct> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Empty result = completedResponse.Result;
// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Empty, Struct> retrievedResponse = await agentsClient.PollOnceTrainAgentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
Empty retrievedResult = retrievedResponse.Result;
}
TrainAgentAsync(LocationName, CancellationToken)
Trains the specified agent.
This method is a long-running
operation.
The returned Operation
type has the following method-specific fields:
metadata
: An empty Struct messageresponse
: An Empty message
Note: You should always train an agent prior to sending it queries. See the training documentation.
Declaration
public virtual Task<Operation<Empty, Struct>> TrainAgentAsync(LocationName parent, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
LocationName | parent | Required. The project that the agent to train is associated with.
Format: |
CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
Type | Description |
---|---|
Task<Operation<Empty, Struct>> | A Task containing the RPC response. |
Sample code
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
// Make the request
Operation<Empty, Struct> response = await agentsClient.TrainAgentAsync(parent);
// Poll until the returned long-running operation is complete
Operation<Empty, Struct> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Empty result = completedResponse.Result;
// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Empty, Struct> retrievedResponse = await agentsClient.PollOnceTrainAgentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
Empty retrievedResult = retrievedResponse.Result;
}
TrainAgentAsync(ProjectName, CallSettings)
Trains the specified agent.
This method is a long-running
operation.
The returned Operation
type has the following method-specific fields:
metadata
: An empty Struct messageresponse
: An Empty message
Note: You should always train an agent prior to sending it queries. See the training documentation.
Declaration
public virtual Task<Operation<Empty, Struct>> TrainAgentAsync(ProjectName parent, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
ProjectName | parent | Required. The project that the agent to train is associated with.
Format: |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Task<Operation<Empty, Struct>> | A Task containing the RPC response. |
Sample code
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
// Make the request
Operation<Empty, Struct> response = await agentsClient.TrainAgentAsync(parent);
// Poll until the returned long-running operation is complete
Operation<Empty, Struct> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Empty result = completedResponse.Result;
// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Empty, Struct> retrievedResponse = await agentsClient.PollOnceTrainAgentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
Empty retrievedResult = retrievedResponse.Result;
}
TrainAgentAsync(ProjectName, CancellationToken)
Trains the specified agent.
This method is a long-running
operation.
The returned Operation
type has the following method-specific fields:
metadata
: An empty Struct messageresponse
: An Empty message
Note: You should always train an agent prior to sending it queries. See the training documentation.
Declaration
public virtual Task<Operation<Empty, Struct>> TrainAgentAsync(ProjectName parent, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
ProjectName | parent | Required. The project that the agent to train is associated with.
Format: |
CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
Type | Description |
---|---|
Task<Operation<Empty, Struct>> | A Task containing the RPC response. |
Sample code
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
// Make the request
Operation<Empty, Struct> response = await agentsClient.TrainAgentAsync(parent);
// Poll until the returned long-running operation is complete
Operation<Empty, Struct> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Empty result = completedResponse.Result;
// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Empty, Struct> retrievedResponse = await agentsClient.PollOnceTrainAgentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
Empty retrievedResult = retrievedResponse.Result;
}
TrainAgentAsync(TrainAgentRequest, CallSettings)
Trains the specified agent.
This method is a long-running
operation.
The returned Operation
type has the following method-specific fields:
metadata
: An empty Struct messageresponse
: An Empty message
Note: You should always train an agent prior to sending it queries. See the training documentation.
Declaration
public virtual Task<Operation<Empty, Struct>> TrainAgentAsync(TrainAgentRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
TrainAgentRequest | request | 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 |
---|---|
Task<Operation<Empty, Struct>> | A Task containing the RPC response. |
Sample code
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
TrainAgentRequest request = new TrainAgentRequest
{
ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
};
// Make the request
Operation<Empty, Struct> response = await agentsClient.TrainAgentAsync(request);
// Poll until the returned long-running operation is complete
Operation<Empty, Struct> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Empty result = completedResponse.Result;
// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Empty, Struct> retrievedResponse = await agentsClient.PollOnceTrainAgentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
Empty retrievedResult = retrievedResponse.Result;
}
TrainAgentAsync(TrainAgentRequest, CancellationToken)
Trains the specified agent.
This method is a long-running
operation.
The returned Operation
type has the following method-specific fields:
metadata
: An empty Struct messageresponse
: An Empty message
Note: You should always train an agent prior to sending it queries. See the training documentation.
Declaration
public virtual Task<Operation<Empty, Struct>> TrainAgentAsync(TrainAgentRequest request, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
TrainAgentRequest | request | The request object containing all of the parameters for the API call. |
CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
Type | Description |
---|---|
Task<Operation<Empty, Struct>> | A Task containing the RPC response. |
Sample code
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
TrainAgentRequest request = new TrainAgentRequest
{
ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
};
// Make the request
Operation<Empty, Struct> response = await agentsClient.TrainAgentAsync(request);
// Poll until the returned long-running operation is complete
Operation<Empty, Struct> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Empty result = completedResponse.Result;
// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Empty, Struct> retrievedResponse = await agentsClient.PollOnceTrainAgentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
Empty retrievedResult = retrievedResponse.Result;
}
TrainAgentAsync(string, CallSettings)
Trains the specified agent.
This method is a long-running
operation.
The returned Operation
type has the following method-specific fields:
metadata
: An empty Struct messageresponse
: An Empty message
Note: You should always train an agent prior to sending it queries. See the training documentation.
Declaration
public virtual Task<Operation<Empty, Struct>> TrainAgentAsync(string parent, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
string | parent | Required. The project that the agent to train is associated with.
Format: |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Task<Operation<Empty, Struct>> | A Task containing the RPC response. |
Sample code
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
// Make the request
Operation<Empty, Struct> response = await agentsClient.TrainAgentAsync(parent);
// Poll until the returned long-running operation is complete
Operation<Empty, Struct> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Empty result = completedResponse.Result;
// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Empty, Struct> retrievedResponse = await agentsClient.PollOnceTrainAgentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
Empty retrievedResult = retrievedResponse.Result;
}
TrainAgentAsync(string, CancellationToken)
Trains the specified agent.
This method is a long-running
operation.
The returned Operation
type has the following method-specific fields:
metadata
: An empty Struct messageresponse
: An Empty message
Note: You should always train an agent prior to sending it queries. See the training documentation.
Declaration
public virtual Task<Operation<Empty, Struct>> TrainAgentAsync(string parent, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
string | parent | Required. The project that the agent to train is associated with.
Format: |
CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
Type | Description |
---|---|
Task<Operation<Empty, Struct>> | A Task containing the RPC response. |
Sample code
// Create client
AgentsClient agentsClient = await AgentsClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
// Make the request
Operation<Empty, Struct> response = await agentsClient.TrainAgentAsync(parent);
// Poll until the returned long-running operation is complete
Operation<Empty, Struct> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Empty result = completedResponse.Result;
// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Empty, Struct> retrievedResponse = await agentsClient.PollOnceTrainAgentAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
Empty retrievedResult = retrievedResponse.Result;
}