Class AgentsClient (3.4.0)

public abstract 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
IReadOnlyList<String>
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
Agents.AgentsClient

ImportAgentOperationsClient

public virtual OperationsClient ImportAgentOperationsClient { get; }

The long-running operations client for ImportAgent.

Property Value
TypeDescription
OperationsClient

RestoreAgentOperationsClient

public virtual OperationsClient RestoreAgentOperationsClient { get; }

The long-running operations client for RestoreAgent.

Property Value
TypeDescription
OperationsClient

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

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
Task<AgentsClient>

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.

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
Operation<ExportAgentResponse, Struct>

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.

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
Operation<ExportAgentResponse, Struct>

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.

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
Operation<ExportAgentResponse, Struct>

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.

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
Operation<ExportAgentResponse, Struct>

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.

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
Task<Operation<ExportAgentResponse, Struct>>

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.

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
Task<Operation<ExportAgentResponse, Struct>>

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.

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
Task<Operation<ExportAgentResponse, Struct>>

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.

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
Task<Operation<ExportAgentResponse, Struct>>

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.

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
Task<Operation<ExportAgentResponse, Struct>>

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.

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
Task<Operation<ExportAgentResponse, Struct>>

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.

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
Task<Operation<ExportAgentResponse, Struct>>

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.

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
Task<Operation<ExportAgentResponse, Struct>>

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
Task<Agent>

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
Task<Agent>

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
Task<Agent>

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
Task<Agent>

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
Task<Agent>

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
Task<Agent>

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
Task<Agent>

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
Task<Agent>

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
Task<ValidationResult>

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
Task<ValidationResult>

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.

An operation which tracks when importing is complete. It only tracks when the draft agent is updated 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
Operation<Empty, Struct>

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.

An operation which tracks when importing is complete. It only tracks when the draft agent is updated 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
Task<Operation<Empty, Struct>>

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.

An operation which tracks when importing is complete. It only tracks when the draft agent is updated 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
Task<Operation<Empty, Struct>>

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
Operation<ExportAgentResponse, Struct>

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
Task<Operation<ExportAgentResponse, Struct>>

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
Operation<Empty, Struct>

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
Task<Operation<Empty, Struct>>

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
Operation<Empty, Struct>

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
Task<Operation<Empty, Struct>>

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
Operation<Empty, Struct>

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
Task<Operation<Empty, Struct>>

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.

An operation which tracks when restoring is complete. It only tracks when the draft agent is updated 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
Operation<Empty, Struct>

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.

An operation which tracks when restoring is complete. It only tracks when the draft agent is updated 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
Task<Operation<Empty, Struct>>

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.

An operation which tracks when restoring is complete. It only tracks when the draft agent is updated 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
Task<Operation<Empty, Struct>>

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, Nullable<Int32>, CallSettings)

public virtual PagedEnumerable<SearchAgentsResponse, Agent> SearchAgents(LocationName parent, string pageToken = null, int? pageSize = default(int? ), 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 &apos;-&apos;}.

pageTokenString

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

pageSizeNullable<Int32>

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
PagedEnumerable<SearchAgentsResponse, Agent>

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, Nullable<Int32>, CallSettings)

public virtual PagedEnumerable<SearchAgentsResponse, Agent> SearchAgents(ProjectName parent, string pageToken = null, int? pageSize = default(int? ), 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 &apos;-&apos;}.

pageTokenString

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

pageSizeNullable<Int32>

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
PagedEnumerable<SearchAgentsResponse, Agent>

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
PagedEnumerable<SearchAgentsResponse, Agent>

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, Nullable<Int32>, CallSettings)

public virtual PagedEnumerable<SearchAgentsResponse, Agent> SearchAgents(string parent, string pageToken = null, int? pageSize = default(int? ), 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 &apos;-&apos;}.

pageTokenString

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

pageSizeNullable<Int32>

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
PagedEnumerable<SearchAgentsResponse, Agent>

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, Nullable<Int32>, CallSettings)

public virtual PagedAsyncEnumerable<SearchAgentsResponse, Agent> SearchAgentsAsync(LocationName parent, string pageToken = null, int? pageSize = default(int? ), 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 &apos;-&apos;}.

pageTokenString

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

pageSizeNullable<Int32>

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
PagedAsyncEnumerable<SearchAgentsResponse, Agent>

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, Nullable<Int32>, CallSettings)

public virtual PagedAsyncEnumerable<SearchAgentsResponse, Agent> SearchAgentsAsync(ProjectName parent, string pageToken = null, int? pageSize = default(int? ), 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 &apos;-&apos;}.

pageTokenString

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

pageSizeNullable<Int32>

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
PagedAsyncEnumerable<SearchAgentsResponse, Agent>

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
PagedAsyncEnumerable<SearchAgentsResponse, Agent>

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, Nullable<Int32>, CallSettings)

public virtual PagedAsyncEnumerable<SearchAgentsResponse, Agent> SearchAgentsAsync(string parent, string pageToken = null, int? pageSize = default(int? ), 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 &apos;-&apos;}.

pageTokenString

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

pageSizeNullable<Int32>

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
PagedAsyncEnumerable<SearchAgentsResponse, Agent>

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
Task<Agent>

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
Task<Agent>

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
Task<Agent>

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
Task<Agent>

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.

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
Operation<Empty, Struct>

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.

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
Operation<Empty, Struct>

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.

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
Operation<Empty, Struct>

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.

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
Operation<Empty, Struct>

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.

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
Task<Operation<Empty, Struct>>

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.

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
Task<Operation<Empty, Struct>>

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.

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
Task<Operation<Empty, Struct>>

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.

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
Task<Operation<Empty, Struct>>

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.

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
Task<Operation<Empty, Struct>>

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.

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
Task<Operation<Empty, Struct>>

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.

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
Task<Operation<Empty, Struct>>

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.

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
Task<Operation<Empty, Struct>>

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