Google Cloud Dialogflow v2 API - Class AgentsClient (4.16.0)

public abstract class AgentsClient

Reference documentation and code samples for the Google Cloud Dialogflow v2 API class AgentsClient.

Agents client wrapper, for convenient use.

Inheritance

object > AgentsClient

Derived Types

Namespace

Google.Cloud.Dialogflow.V2

Assembly

Google.Cloud.Dialogflow.V2.dll

Remarks

Service for managing [Agents][google.cloud.dialogflow.v2.Agent].

Properties

DefaultEndpoint

public static string DefaultEndpoint { get; }

The default endpoint for the Agents service, which is a host of "dialogflow.googleapis.com" and a port of 443.

Property Value
TypeDescription
string

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default Agents scopes.

Property Value
TypeDescription
IReadOnlyListstring
Remarks

ExportAgentOperationsClient

public virtual OperationsClient ExportAgentOperationsClient { get; }

The long-running operations client for ExportAgent.

Property Value
TypeDescription
OperationsClient

GrpcClient

public virtual Agents.AgentsClient GrpcClient { get; }

The underlying gRPC Agents client

Property Value
TypeDescription
AgentsAgentsClient

ImportAgentOperationsClient

public virtual OperationsClient ImportAgentOperationsClient { get; }

The long-running operations client for ImportAgent.

Property Value
TypeDescription
OperationsClient

LocationsClient

public virtual LocationsClient LocationsClient { get; }

The LocationsClient associated with this client.

Property Value
TypeDescription
LocationsClient

RestoreAgentOperationsClient

public virtual OperationsClient RestoreAgentOperationsClient { get; }

The long-running operations client for RestoreAgent.

Property Value
TypeDescription
OperationsClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
TypeDescription
ServiceMetadata

TrainAgentOperationsClient

public virtual OperationsClient TrainAgentOperationsClient { get; }

The long-running operations client for TrainAgent.

Property Value
TypeDescription
OperationsClient

Methods

Create()

public static AgentsClient Create()

Synchronously creates a AgentsClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use AgentsClientBuilder.

Returns
TypeDescription
AgentsClient

The created AgentsClient.

CreateAsync(CancellationToken)

public static Task<AgentsClient> CreateAsync(CancellationToken cancellationToken = default)

Asynchronously creates a AgentsClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use AgentsClientBuilder.

Parameter
NameDescription
cancellationTokenCancellationToken

The CancellationToken to use while creating the client.

Returns
TypeDescription
TaskAgentsClient

The task representing the created AgentsClient.

DeleteAgent(LocationName, CallSettings)

public virtual void DeleteAgent(LocationName parent, CallSettings callSettings = null)

Deletes the specified agent.

Parameters
NameDescription
parentLocationName

Required. The project that the agent to delete is associated with. Format: projects/<Project ID>.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Example
// 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)

public virtual void DeleteAgent(ProjectName parent, CallSettings callSettings = null)

Deletes the specified agent.

Parameters
NameDescription
parentProjectName

Required. The project that the agent to delete is associated with. Format: projects/<Project ID>.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Example
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
ProjectName parent = ProjectName.FromProject("[PROJECT]");
// Make the request
agentsClient.DeleteAgent(parent);

DeleteAgent(DeleteAgentRequest, CallSettings)

public virtual void DeleteAgent(DeleteAgentRequest request, CallSettings callSettings = null)

Deletes the specified agent.

Parameters
NameDescription
requestDeleteAgentRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Example
// 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)

public virtual void DeleteAgent(string parent, CallSettings callSettings = null)

Deletes the specified agent.

Parameters
NameDescription
parentstring

Required. The project that the agent to delete is associated with. Format: projects/<Project ID>.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Example
// Create client
AgentsClient agentsClient = AgentsClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]";
// Make the request
agentsClient.DeleteAgent(parent);

DeleteAgentAsync(LocationName, CallSettings)

public virtual Task DeleteAgentAsync(LocationName parent, CallSettings callSettings = null)

Deletes the specified agent.

Parameters
NameDescription
parentLocationName

Required. The project that the agent to delete is associated with. Format: projects/<Project ID>.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task

A Task containing the RPC response.

Example
// 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)

public virtual Task DeleteAgentAsync(LocationName parent, CancellationToken cancellationToken)

Deletes the specified agent.

Parameters
NameDescription
parentLocationName

Required. The project that the agent to delete is associated with. Format: projects/<Project ID>.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task

A Task containing the RPC response.

Example
// 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)

public virtual Task DeleteAgentAsync(ProjectName parent, CallSettings callSettings = null)

Deletes the specified agent.

Parameters
NameDescription
parentProjectName

Required. The project that the agent to delete is associated with. Format: projects/<Project ID>.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task

A Task containing the RPC response.

Example
// 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)

public virtual Task DeleteAgentAsync(ProjectName parent, CancellationToken cancellationToken)

Deletes the specified agent.

Parameters
NameDescription
parentProjectName

Required. The project that the agent to delete is associated with. Format: projects/<Project ID>.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task

A Task containing the RPC response.

Example
// 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)

public virtual Task DeleteAgentAsync(DeleteAgentRequest request, CallSettings callSettings = null)

Deletes the specified agent.

Parameters
NameDescription
requestDeleteAgentRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task

A Task containing the RPC response.

Example
// 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)

public virtual Task DeleteAgentAsync(DeleteAgentRequest request, CancellationToken cancellationToken)

Deletes the specified agent.

Parameters
NameDescription
requestDeleteAgentRequest

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task

A Task containing the RPC response.

Example
// 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)

public virtual Task DeleteAgentAsync(string parent, CallSettings callSettings = null)

Deletes the specified agent.

Parameters
NameDescription
parentstring

Required. The project that the agent to delete is associated with. Format: projects/<Project ID>.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task

A Task containing the RPC response.

Example
// 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)

public virtual Task DeleteAgentAsync(string parent, CancellationToken cancellationToken)

Deletes the specified agent.

Parameters
NameDescription
parentstring

Required. The project that the agent to delete is associated with. Format: projects/<Project ID>.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task

A Task containing the RPC response.

Example
// 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)

public virtual Operation<ExportAgentResponse, Struct> ExportAgent(LocationName parent, CallSettings callSettings = null)

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 message
  • response: [ExportAgentResponse][google.cloud.dialogflow.v2.ExportAgentResponse]
Parameters
NameDescription
parentLocationName

Required. The project that the agent to export is associated with. Format: projects/<Project ID>.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationExportAgentResponseStruct

The RPC response.

Example
// 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)

public virtual Operation<ExportAgentResponse, Struct> ExportAgent(ProjectName parent, CallSettings callSettings = null)

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 message
  • response: [ExportAgentResponse][google.cloud.dialogflow.v2.ExportAgentResponse]
Parameters
NameDescription
parentProjectName

Required. The project that the agent to export is associated with. Format: projects/<Project ID>.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationExportAgentResponseStruct

The RPC response.

Example
// 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)

public virtual Operation<ExportAgentResponse, Struct> ExportAgent(ExportAgentRequest request, CallSettings callSettings = null)

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 message
  • response: [ExportAgentResponse][google.cloud.dialogflow.v2.ExportAgentResponse]
Parameters
NameDescription
requestExportAgentRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationExportAgentResponseStruct

The RPC response.

Example
// 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)

public virtual Operation<ExportAgentResponse, Struct> ExportAgent(string parent, CallSettings callSettings = null)

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 message
  • response: [ExportAgentResponse][google.cloud.dialogflow.v2.ExportAgentResponse]
Parameters
NameDescription
parentstring

Required. The project that the agent to export is associated with. Format: projects/<Project ID>.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationExportAgentResponseStruct

The RPC response.

Example
// 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)

public virtual Task<Operation<ExportAgentResponse, Struct>> ExportAgentAsync(LocationName parent, CallSettings callSettings = null)

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 message
  • response: [ExportAgentResponse][google.cloud.dialogflow.v2.ExportAgentResponse]
Parameters
NameDescription
parentLocationName

Required. The project that the agent to export is associated with. Format: projects/<Project ID>.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationExportAgentResponseStruct

A Task containing the RPC response.

Example
// 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)

public virtual Task<Operation<ExportAgentResponse, Struct>> ExportAgentAsync(LocationName parent, CancellationToken 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 message
  • response: [ExportAgentResponse][google.cloud.dialogflow.v2.ExportAgentResponse]
Parameters
NameDescription
parentLocationName

Required. The project that the agent to export is associated with. Format: projects/<Project ID>.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskOperationExportAgentResponseStruct

A Task containing the RPC response.

Example
// 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)

public virtual Task<Operation<ExportAgentResponse, Struct>> ExportAgentAsync(ProjectName parent, CallSettings callSettings = null)

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 message
  • response: [ExportAgentResponse][google.cloud.dialogflow.v2.ExportAgentResponse]
Parameters
NameDescription
parentProjectName

Required. The project that the agent to export is associated with. Format: projects/<Project ID>.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationExportAgentResponseStruct

A Task containing the RPC response.

Example
// 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)

public virtual Task<Operation<ExportAgentResponse, Struct>> ExportAgentAsync(ProjectName parent, CancellationToken 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 message
  • response: [ExportAgentResponse][google.cloud.dialogflow.v2.ExportAgentResponse]
Parameters
NameDescription
parentProjectName

Required. The project that the agent to export is associated with. Format: projects/<Project ID>.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskOperationExportAgentResponseStruct

A Task containing the RPC response.

Example
// 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)

public virtual Task<Operation<ExportAgentResponse, Struct>> ExportAgentAsync(ExportAgentRequest request, CallSettings callSettings = null)

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 message
  • response: [ExportAgentResponse][google.cloud.dialogflow.v2.ExportAgentResponse]
Parameters
NameDescription
requestExportAgentRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationExportAgentResponseStruct

A Task containing the RPC response.

Example
// 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)

public virtual Task<Operation<ExportAgentResponse, Struct>> ExportAgentAsync(ExportAgentRequest request, CancellationToken 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 message
  • response: [ExportAgentResponse][google.cloud.dialogflow.v2.ExportAgentResponse]
Parameters
NameDescription
requestExportAgentRequest

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskOperationExportAgentResponseStruct

A Task containing the RPC response.

Example
// 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)

public virtual Task<Operation<ExportAgentResponse, Struct>> ExportAgentAsync(string parent, CallSettings callSettings = null)

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 message
  • response: [ExportAgentResponse][google.cloud.dialogflow.v2.ExportAgentResponse]
Parameters
NameDescription
parentstring

Required. The project that the agent to export is associated with. Format: projects/<Project ID>.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationExportAgentResponseStruct

A Task containing the RPC response.

Example
// 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)

public virtual Task<Operation<ExportAgentResponse, Struct>> ExportAgentAsync(string parent, CancellationToken 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 message
  • response: [ExportAgentResponse][google.cloud.dialogflow.v2.ExportAgentResponse]
Parameters
NameDescription
parentstring

Required. The project that the agent to export is associated with. Format: projects/<Project ID>.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskOperationExportAgentResponseStruct

A Task containing the RPC response.

Example
// 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)

public virtual Agent GetAgent(LocationName parent, CallSettings callSettings = null)

Retrieves the specified agent.

Parameters
NameDescription
parentLocationName

Required. The project that the agent to fetch is associated with. Format: projects/<Project ID>.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Agent

The RPC response.

Example
// 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)

public virtual Agent GetAgent(ProjectName parent, CallSettings callSettings = null)

Retrieves the specified agent.

Parameters
NameDescription
parentProjectName

Required. The project that the agent to fetch is associated with. Format: projects/<Project ID>.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Agent

The RPC response.

Example
// 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)

public virtual Agent GetAgent(GetAgentRequest request, CallSettings callSettings = null)

Retrieves the specified agent.

Parameters
NameDescription
requestGetAgentRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Agent

The RPC response.

Example
// 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)

public virtual Agent GetAgent(string parent, CallSettings callSettings = null)

Retrieves the specified agent.

Parameters
NameDescription
parentstring

Required. The project that the agent to fetch is associated with. Format: projects/<Project ID>.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Agent

The RPC response.

Example
// 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)

public virtual Task<Agent> GetAgentAsync(LocationName parent, CallSettings callSettings = null)

Retrieves the specified agent.

Parameters
NameDescription
parentLocationName

Required. The project that the agent to fetch is associated with. Format: projects/<Project ID>.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskAgent

A Task containing the RPC response.

Example
// 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)

public virtual Task<Agent> GetAgentAsync(LocationName parent, CancellationToken cancellationToken)

Retrieves the specified agent.

Parameters
NameDescription
parentLocationName

Required. The project that the agent to fetch is associated with. Format: projects/<Project ID>.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskAgent

A Task containing the RPC response.

Example
// 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)

public virtual Task<Agent> GetAgentAsync(ProjectName parent, CallSettings callSettings = null)

Retrieves the specified agent.

Parameters
NameDescription
parentProjectName

Required. The project that the agent to fetch is associated with. Format: projects/<Project ID>.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskAgent

A Task containing the RPC response.

Example
// 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)

public virtual Task<Agent> GetAgentAsync(ProjectName parent, CancellationToken cancellationToken)

Retrieves the specified agent.

Parameters
NameDescription
parentProjectName

Required. The project that the agent to fetch is associated with. Format: projects/<Project ID>.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskAgent

A Task containing the RPC response.

Example
// 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)

public virtual Task<Agent> GetAgentAsync(GetAgentRequest request, CallSettings callSettings = null)

Retrieves the specified agent.

Parameters
NameDescription
requestGetAgentRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskAgent

A Task containing the RPC response.

Example
// 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)

public virtual Task<Agent> GetAgentAsync(GetAgentRequest request, CancellationToken cancellationToken)

Retrieves the specified agent.

Parameters
NameDescription
requestGetAgentRequest

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskAgent

A Task containing the RPC response.

Example
// 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)

public virtual Task<Agent> GetAgentAsync(string parent, CallSettings callSettings = null)

Retrieves the specified agent.

Parameters
NameDescription
parentstring

Required. The project that the agent to fetch is associated with. Format: projects/<Project ID>.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskAgent

A Task containing the RPC response.

Example
// 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)

public virtual Task<Agent> GetAgentAsync(string parent, CancellationToken cancellationToken)

Retrieves the specified agent.

Parameters
NameDescription
parentstring

Required. The project that the agent to fetch is associated with. Format: projects/<Project ID>.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskAgent

A Task containing the RPC response.

Example
// 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)

public virtual ValidationResult GetValidationResult(GetValidationResultRequest request, CallSettings callSettings = null)

Gets agent validation result. Agent validation is performed during training time and is updated automatically when training is completed.

Parameters
NameDescription
requestGetValidationResultRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
ValidationResult

The RPC response.

Example
// 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)

public virtual Task<ValidationResult> GetValidationResultAsync(GetValidationResultRequest request, CallSettings callSettings = null)

Gets agent validation result. Agent validation is performed during training time and is updated automatically when training is completed.

Parameters
NameDescription
requestGetValidationResultRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskValidationResult

A Task containing the RPC response.

Example
// 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)

public virtual Task<ValidationResult> GetValidationResultAsync(GetValidationResultRequest request, CancellationToken cancellationToken)

Gets agent validation result. Agent validation is performed during training time and is updated automatically when training is completed.

Parameters
NameDescription
requestGetValidationResultRequest

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskValidationResult

A Task containing the RPC response.

Example
// 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)

public virtual Operation<Empty, Struct> ImportAgent(ImportAgentRequest request, CallSettings callSettings = null)

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:

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.

Parameters
NameDescription
requestImportAgentRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationEmptyStruct

The RPC response.

Example
// 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)

public virtual Task<Operation<Empty, Struct>> ImportAgentAsync(ImportAgentRequest request, CallSettings callSettings = null)

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:

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.

Parameters
NameDescription
requestImportAgentRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationEmptyStruct

A Task containing the RPC response.

Example
// 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)

public virtual Task<Operation<Empty, Struct>> ImportAgentAsync(ImportAgentRequest request, CancellationToken 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:

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.

Parameters
NameDescription
requestImportAgentRequest

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskOperationEmptyStruct

A Task containing the RPC response.

Example
// 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)

public virtual Operation<ExportAgentResponse, Struct> PollOnceExportAgent(string operationName, CallSettings callSettings = null)

Poll an operation once, using an operationName from a previous invocation of ExportAgent.

Parameters
NameDescription
operationNamestring

The name of a previously invoked operation. Must not be null or empty.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationExportAgentResponseStruct

The result of polling the operation.

PollOnceExportAgentAsync(string, CallSettings)

public virtual Task<Operation<ExportAgentResponse, Struct>> PollOnceExportAgentAsync(string operationName, CallSettings callSettings = null)

Asynchronously poll an operation once, using an operationName from a previous invocation of ExportAgent.

Parameters
NameDescription
operationNamestring

The name of a previously invoked operation. Must not be null or empty.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationExportAgentResponseStruct

A task representing the result of polling the operation.

PollOnceImportAgent(string, CallSettings)

public virtual Operation<Empty, Struct> PollOnceImportAgent(string operationName, CallSettings callSettings = null)

Poll an operation once, using an operationName from a previous invocation of ImportAgent.

Parameters
NameDescription
operationNamestring

The name of a previously invoked operation. Must not be null or empty.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationEmptyStruct

The result of polling the operation.

PollOnceImportAgentAsync(string, CallSettings)

public virtual Task<Operation<Empty, Struct>> PollOnceImportAgentAsync(string operationName, CallSettings callSettings = null)

Asynchronously poll an operation once, using an operationName from a previous invocation of ImportAgent.

Parameters
NameDescription
operationNamestring

The name of a previously invoked operation. Must not be null or empty.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationEmptyStruct

A task representing the result of polling the operation.

PollOnceRestoreAgent(string, CallSettings)

public virtual Operation<Empty, Struct> PollOnceRestoreAgent(string operationName, CallSettings callSettings = null)

Poll an operation once, using an operationName from a previous invocation of RestoreAgent.

Parameters
NameDescription
operationNamestring

The name of a previously invoked operation. Must not be null or empty.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationEmptyStruct

The result of polling the operation.

PollOnceRestoreAgentAsync(string, CallSettings)

public virtual Task<Operation<Empty, Struct>> PollOnceRestoreAgentAsync(string operationName, CallSettings callSettings = null)

Asynchronously poll an operation once, using an operationName from a previous invocation of RestoreAgent.

Parameters
NameDescription
operationNamestring

The name of a previously invoked operation. Must not be null or empty.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationEmptyStruct

A task representing the result of polling the operation.

PollOnceTrainAgent(string, CallSettings)

public virtual Operation<Empty, Struct> PollOnceTrainAgent(string operationName, CallSettings callSettings = null)

Poll an operation once, using an operationName from a previous invocation of TrainAgent.

Parameters
NameDescription
operationNamestring

The name of a previously invoked operation. Must not be null or empty.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationEmptyStruct

The result of polling the operation.

PollOnceTrainAgentAsync(string, CallSettings)

public virtual Task<Operation<Empty, Struct>> PollOnceTrainAgentAsync(string operationName, CallSettings callSettings = null)

Asynchronously poll an operation once, using an operationName from a previous invocation of TrainAgent.

Parameters
NameDescription
operationNamestring

The name of a previously invoked operation. Must not be null or empty.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationEmptyStruct

A task representing the result of polling the operation.

RestoreAgent(RestoreAgentRequest, CallSettings)

public virtual Operation<Empty, Struct> RestoreAgent(RestoreAgentRequest request, CallSettings callSettings = null)

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:

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.

Parameters
NameDescription
requestRestoreAgentRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationEmptyStruct

The RPC response.

Example
// 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)

public virtual Task<Operation<Empty, Struct>> RestoreAgentAsync(RestoreAgentRequest request, CallSettings callSettings = null)

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:

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.

Parameters
NameDescription
requestRestoreAgentRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationEmptyStruct

A Task containing the RPC response.

Example
// 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)

public virtual Task<Operation<Empty, Struct>> RestoreAgentAsync(RestoreAgentRequest request, CancellationToken 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:

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.

Parameters
NameDescription
requestRestoreAgentRequest

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskOperationEmptyStruct

A Task containing the RPC response.

Example
// 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)

public virtual PagedEnumerable<SearchAgentsResponse, Agent> SearchAgents(LocationName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

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.

Parameters
NameDescription
parentLocationName

Required. The project to list agents from. Format: projects/<Project ID or '-'>.

pageTokenstring

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeint

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerableSearchAgentsResponseAgent

A pageable sequence of Agent resources.

Example
// 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)

public virtual PagedEnumerable<SearchAgentsResponse, Agent> SearchAgents(ProjectName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

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.

Parameters
NameDescription
parentProjectName

Required. The project to list agents from. Format: projects/<Project ID or '-'>.

pageTokenstring

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeint

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerableSearchAgentsResponseAgent

A pageable sequence of Agent resources.

Example
// 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)

public virtual PagedEnumerable<SearchAgentsResponse, Agent> SearchAgents(SearchAgentsRequest request, CallSettings callSettings = null)

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.

Parameters
NameDescription
requestSearchAgentsRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerableSearchAgentsResponseAgent

A pageable sequence of Agent resources.

Example
// 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)

public virtual PagedEnumerable<SearchAgentsResponse, Agent> SearchAgents(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

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.

Parameters
NameDescription
parentstring

Required. The project to list agents from. Format: projects/<Project ID or '-'>.

pageTokenstring

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeint

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerableSearchAgentsResponseAgent

A pageable sequence of Agent resources.

Example
// 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)

public virtual PagedAsyncEnumerable<SearchAgentsResponse, Agent> SearchAgentsAsync(LocationName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

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.

Parameters
NameDescription
parentLocationName

Required. The project to list agents from. Format: projects/<Project ID or '-'>.

pageTokenstring

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeint

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerableSearchAgentsResponseAgent

A pageable asynchronous sequence of Agent resources.

Example
// 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)

public virtual PagedAsyncEnumerable<SearchAgentsResponse, Agent> SearchAgentsAsync(ProjectName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

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.

Parameters
NameDescription
parentProjectName

Required. The project to list agents from. Format: projects/<Project ID or '-'>.

pageTokenstring

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeint

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerableSearchAgentsResponseAgent

A pageable asynchronous sequence of Agent resources.

Example
// 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)

public virtual PagedAsyncEnumerable<SearchAgentsResponse, Agent> SearchAgentsAsync(SearchAgentsRequest request, CallSettings callSettings = null)

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.

Parameters
NameDescription
requestSearchAgentsRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerableSearchAgentsResponseAgent

A pageable asynchronous sequence of Agent resources.

Example
// 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)

public virtual PagedAsyncEnumerable<SearchAgentsResponse, Agent> SearchAgentsAsync(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

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.

Parameters
NameDescription
parentstring

Required. The project to list agents from. Format: projects/<Project ID or '-'>.

pageTokenstring

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeint

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerableSearchAgentsResponseAgent

A pageable asynchronous sequence of Agent resources.

Example
// 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)

public virtual Agent SetAgent(Agent agent, CallSettings callSettings = null)

Creates/updates the specified agent.

Note: You should always train an agent prior to sending it queries. See the training documentation.

Parameters
NameDescription
agentAgent

Required. The agent to update.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Agent

The RPC response.

Example
// 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)

public virtual Agent SetAgent(SetAgentRequest request, CallSettings callSettings = null)

Creates/updates the specified agent.

Note: You should always train an agent prior to sending it queries. See the training documentation.

Parameters
NameDescription
requestSetAgentRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Agent

The RPC response.

Example
// 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)

public virtual Task<Agent> SetAgentAsync(Agent agent, CallSettings callSettings = null)

Creates/updates the specified agent.

Note: You should always train an agent prior to sending it queries. See the training documentation.

Parameters
NameDescription
agentAgent

Required. The agent to update.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskAgent

A Task containing the RPC response.

Example
// 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)

public virtual Task<Agent> SetAgentAsync(Agent agent, CancellationToken cancellationToken)

Creates/updates the specified agent.

Note: You should always train an agent prior to sending it queries. See the training documentation.

Parameters
NameDescription
agentAgent

Required. The agent to update.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskAgent

A Task containing the RPC response.

Example
// 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)

public virtual Task<Agent> SetAgentAsync(SetAgentRequest request, CallSettings callSettings = null)

Creates/updates the specified agent.

Note: You should always train an agent prior to sending it queries. See the training documentation.

Parameters
NameDescription
requestSetAgentRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskAgent

A Task containing the RPC response.

Example
// 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)

public virtual Task<Agent> SetAgentAsync(SetAgentRequest request, CancellationToken cancellationToken)

Creates/updates the specified agent.

Note: You should always train an agent prior to sending it queries. See the training documentation.

Parameters
NameDescription
requestSetAgentRequest

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskAgent

A Task containing the RPC response.

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

public static Task ShutdownDefaultChannelsAsync()

Shuts down any channels automatically created by Create() and CreateAsync(CancellationToken). Channels which weren't automatically created are not affected.

Returns
TypeDescription
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)

public virtual Operation<Empty, Struct> TrainAgent(LocationName parent, CallSettings callSettings = null)

Trains the specified agent.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

Note: You should always train an agent prior to sending it queries. See the training documentation.

Parameters
NameDescription
parentLocationName

Required. The project that the agent to train is associated with. Format: projects/<Project ID>.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationEmptyStruct

The RPC response.

Example
// 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)

public virtual Operation<Empty, Struct> TrainAgent(ProjectName parent, CallSettings callSettings = null)

Trains the specified agent.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

Note: You should always train an agent prior to sending it queries. See the training documentation.

Parameters
NameDescription
parentProjectName

Required. The project that the agent to train is associated with. Format: projects/<Project ID>.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationEmptyStruct

The RPC response.

Example
// 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)

public virtual Operation<Empty, Struct> TrainAgent(TrainAgentRequest request, CallSettings callSettings = null)

Trains the specified agent.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

Note: You should always train an agent prior to sending it queries. See the training documentation.

Parameters
NameDescription
requestTrainAgentRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationEmptyStruct

The RPC response.

Example
// 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)

public virtual Operation<Empty, Struct> TrainAgent(string parent, CallSettings callSettings = null)

Trains the specified agent.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

Note: You should always train an agent prior to sending it queries. See the training documentation.

Parameters
NameDescription
parentstring

Required. The project that the agent to train is associated with. Format: projects/<Project ID>.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationEmptyStruct

The RPC response.

Example
// 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)

public virtual Task<Operation<Empty, Struct>> TrainAgentAsync(LocationName parent, CallSettings callSettings = null)

Trains the specified agent.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

Note: You should always train an agent prior to sending it queries. See the training documentation.

Parameters
NameDescription
parentLocationName

Required. The project that the agent to train is associated with. Format: projects/<Project ID>.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationEmptyStruct

A Task containing the RPC response.

Example
// 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)

public virtual Task<Operation<Empty, Struct>> TrainAgentAsync(LocationName parent, CancellationToken cancellationToken)

Trains the specified agent.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

Note: You should always train an agent prior to sending it queries. See the training documentation.

Parameters
NameDescription
parentLocationName

Required. The project that the agent to train is associated with. Format: projects/<Project ID>.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskOperationEmptyStruct

A Task containing the RPC response.

Example
// 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)

public virtual Task<Operation<Empty, Struct>> TrainAgentAsync(ProjectName parent, CallSettings callSettings = null)

Trains the specified agent.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

Note: You should always train an agent prior to sending it queries. See the training documentation.

Parameters
NameDescription
parentProjectName

Required. The project that the agent to train is associated with. Format: projects/<Project ID>.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationEmptyStruct

A Task containing the RPC response.

Example
// 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)

public virtual Task<Operation<Empty, Struct>> TrainAgentAsync(ProjectName parent, CancellationToken cancellationToken)

Trains the specified agent.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

Note: You should always train an agent prior to sending it queries. See the training documentation.

Parameters
NameDescription
parentProjectName

Required. The project that the agent to train is associated with. Format: projects/<Project ID>.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskOperationEmptyStruct

A Task containing the RPC response.

Example
// 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)

public virtual Task<Operation<Empty, Struct>> TrainAgentAsync(TrainAgentRequest request, CallSettings callSettings = null)

Trains the specified agent.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

Note: You should always train an agent prior to sending it queries. See the training documentation.

Parameters
NameDescription
requestTrainAgentRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationEmptyStruct

A Task containing the RPC response.

Example
// 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)

public virtual Task<Operation<Empty, Struct>> TrainAgentAsync(TrainAgentRequest request, CancellationToken cancellationToken)

Trains the specified agent.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

Note: You should always train an agent prior to sending it queries. See the training documentation.

Parameters
NameDescription
requestTrainAgentRequest

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskOperationEmptyStruct

A Task containing the RPC response.

Example
// 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)

public virtual Task<Operation<Empty, Struct>> TrainAgentAsync(string parent, CallSettings callSettings = null)

Trains the specified agent.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

Note: You should always train an agent prior to sending it queries. See the training documentation.

Parameters
NameDescription
parentstring

Required. The project that the agent to train is associated with. Format: projects/<Project ID>.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationEmptyStruct

A Task containing the RPC response.

Example
// 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)

public virtual Task<Operation<Empty, Struct>> TrainAgentAsync(string parent, CancellationToken cancellationToken)

Trains the specified agent.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

Note: You should always train an agent prior to sending it queries. See the training documentation.

Parameters
NameDescription
parentstring

Required. The project that the agent to train is associated with. Format: projects/<Project ID>.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskOperationEmptyStruct

A Task containing the RPC response.

Example
// 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;
}