Class ContextsClient
Contexts client wrapper, for convenient use.
Namespace: Google.Cloud.Dialogflow.V2
Assembly: Google.Cloud.Dialogflow.V2.dll
Syntax
public abstract class ContextsClient
Remarks
Service for managing [Contexts][google.cloud.dialogflow.v2.Context].
Properties
DefaultEndpoint
The default endpoint for the Contexts service, which is a host of "dialogflow.googleapis.com" and a port of 443.
Declaration
public static string DefaultEndpoint { get; }
Property Value
Type | Description |
---|---|
string |
DefaultScopes
The default Contexts scopes.
Declaration
public static IReadOnlyList<string> DefaultScopes { get; }
Property Value
Type | Description |
---|---|
IReadOnlyList<string> |
Remarks
The default Contexts scopes are:
- https://www.googleapis.com/auth/cloud-platform
- https://www.googleapis.com/auth/dialogflow
GrpcClient
The underlying gRPC Contexts client
Declaration
public virtual Contexts.ContextsClient GrpcClient { get; }
Property Value
Type | Description |
---|---|
Contexts.ContextsClient |
LocationsClient
The Google.Cloud.Location.LocationsClient associated with this client.
Declaration
public virtual LocationsClient LocationsClient { get; }
Property Value
Type | Description |
---|---|
LocationsClient |
ServiceMetadata
The service metadata associated with this client type.
Declaration
public static ServiceMetadata ServiceMetadata { get; }
Property Value
Type | Description |
---|---|
ServiceMetadata |
Methods
Create()
Synchronously creates a ContextsClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use ContextsClientBuilder.
Declaration
public static ContextsClient Create()
Returns
Type | Description |
---|---|
ContextsClient | The created ContextsClient. |
CreateAsync(CancellationToken)
Asynchronously creates a ContextsClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use ContextsClientBuilder.
Declaration
public static Task<ContextsClient> CreateAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | The CancellationToken to use while creating the client. |
Returns
Type | Description |
---|---|
Task<ContextsClient> | The task representing the created ContextsClient. |
CreateContext(CreateContextRequest, CallSettings)
Creates a context.
If the specified context already exists, overrides the context.
Declaration
public virtual Context CreateContext(CreateContextRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
CreateContextRequest | request | The request object containing all of the parameters for the API call. |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Context | The RPC response. |
Sample code
// Create client
ContextsClient contextsClient = ContextsClient.Create();
// Initialize request argument(s)
CreateContextRequest request = new CreateContextRequest
{
ParentAsSessionName = SessionName.FromProjectSession("[PROJECT]", "[SESSION]"),
Context = new Context(),
};
// Make the request
Context response = contextsClient.CreateContext(request);
CreateContext(SessionName, Context, CallSettings)
Creates a context.
If the specified context already exists, overrides the context.
Declaration
public virtual Context CreateContext(SessionName parent, Context context, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
SessionName | parent | Required. The session to create a context for.
Format: |
Context | context | Required. The context to create. |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Context | The RPC response. |
Sample code
// Create client
ContextsClient contextsClient = ContextsClient.Create();
// Initialize request argument(s)
SessionName parent = SessionName.FromProjectSession("[PROJECT]", "[SESSION]");
Context context = new Context();
// Make the request
Context response = contextsClient.CreateContext(parent, context);
CreateContext(string, Context, CallSettings)
Creates a context.
If the specified context already exists, overrides the context.
Declaration
public virtual Context CreateContext(string parent, Context context, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
string | parent | Required. The session to create a context for.
Format: |
Context | context | Required. The context to create. |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Context | The RPC response. |
Sample code
// Create client
ContextsClient contextsClient = ContextsClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/agent/sessions/[SESSION]";
Context context = new Context();
// Make the request
Context response = contextsClient.CreateContext(parent, context);
CreateContextAsync(CreateContextRequest, CallSettings)
Creates a context.
If the specified context already exists, overrides the context.
Declaration
public virtual Task<Context> CreateContextAsync(CreateContextRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
CreateContextRequest | request | The request object containing all of the parameters for the API call. |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Task<Context> | A Task containing the RPC response. |
Sample code
// Create client
ContextsClient contextsClient = await ContextsClient.CreateAsync();
// Initialize request argument(s)
CreateContextRequest request = new CreateContextRequest
{
ParentAsSessionName = SessionName.FromProjectSession("[PROJECT]", "[SESSION]"),
Context = new Context(),
};
// Make the request
Context response = await contextsClient.CreateContextAsync(request);
CreateContextAsync(CreateContextRequest, CancellationToken)
Creates a context.
If the specified context already exists, overrides the context.
Declaration
public virtual Task<Context> CreateContextAsync(CreateContextRequest request, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
CreateContextRequest | request | The request object containing all of the parameters for the API call. |
CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
Type | Description |
---|---|
Task<Context> | A Task containing the RPC response. |
Sample code
// Create client
ContextsClient contextsClient = await ContextsClient.CreateAsync();
// Initialize request argument(s)
CreateContextRequest request = new CreateContextRequest
{
ParentAsSessionName = SessionName.FromProjectSession("[PROJECT]", "[SESSION]"),
Context = new Context(),
};
// Make the request
Context response = await contextsClient.CreateContextAsync(request);
CreateContextAsync(SessionName, Context, CallSettings)
Creates a context.
If the specified context already exists, overrides the context.
Declaration
public virtual Task<Context> CreateContextAsync(SessionName parent, Context context, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
SessionName | parent | Required. The session to create a context for.
Format: |
Context | context | Required. The context to create. |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Task<Context> | A Task containing the RPC response. |
Sample code
// Create client
ContextsClient contextsClient = await ContextsClient.CreateAsync();
// Initialize request argument(s)
SessionName parent = SessionName.FromProjectSession("[PROJECT]", "[SESSION]");
Context context = new Context();
// Make the request
Context response = await contextsClient.CreateContextAsync(parent, context);
CreateContextAsync(SessionName, Context, CancellationToken)
Creates a context.
If the specified context already exists, overrides the context.
Declaration
public virtual Task<Context> CreateContextAsync(SessionName parent, Context context, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
SessionName | parent | Required. The session to create a context for.
Format: |
Context | context | Required. The context to create. |
CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
Type | Description |
---|---|
Task<Context> | A Task containing the RPC response. |
Sample code
// Create client
ContextsClient contextsClient = await ContextsClient.CreateAsync();
// Initialize request argument(s)
SessionName parent = SessionName.FromProjectSession("[PROJECT]", "[SESSION]");
Context context = new Context();
// Make the request
Context response = await contextsClient.CreateContextAsync(parent, context);
CreateContextAsync(string, Context, CallSettings)
Creates a context.
If the specified context already exists, overrides the context.
Declaration
public virtual Task<Context> CreateContextAsync(string parent, Context context, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
string | parent | Required. The session to create a context for.
Format: |
Context | context | Required. The context to create. |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Task<Context> | A Task containing the RPC response. |
Sample code
// Create client
ContextsClient contextsClient = await ContextsClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/agent/sessions/[SESSION]";
Context context = new Context();
// Make the request
Context response = await contextsClient.CreateContextAsync(parent, context);
CreateContextAsync(string, Context, CancellationToken)
Creates a context.
If the specified context already exists, overrides the context.
Declaration
public virtual Task<Context> CreateContextAsync(string parent, Context context, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
string | parent | Required. The session to create a context for.
Format: |
Context | context | Required. The context to create. |
CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
Type | Description |
---|---|
Task<Context> | A Task containing the RPC response. |
Sample code
// Create client
ContextsClient contextsClient = await ContextsClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/agent/sessions/[SESSION]";
Context context = new Context();
// Make the request
Context response = await contextsClient.CreateContextAsync(parent, context);
DeleteAllContexts(DeleteAllContextsRequest, CallSettings)
Deletes all active contexts in the specified session.
Declaration
public virtual void DeleteAllContexts(DeleteAllContextsRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
DeleteAllContextsRequest | request | The request object containing all of the parameters for the API call. |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Sample code
// Create client
ContextsClient contextsClient = ContextsClient.Create();
// Initialize request argument(s)
DeleteAllContextsRequest request = new DeleteAllContextsRequest
{
ParentAsSessionName = SessionName.FromProjectSession("[PROJECT]", "[SESSION]"),
};
// Make the request
contextsClient.DeleteAllContexts(request);
DeleteAllContexts(SessionName, CallSettings)
Deletes all active contexts in the specified session.
Declaration
public virtual void DeleteAllContexts(SessionName parent, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
SessionName | parent | Required. The name of the session to delete all contexts from. Format:
|
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Sample code
// Create client
ContextsClient contextsClient = ContextsClient.Create();
// Initialize request argument(s)
SessionName parent = SessionName.FromProjectSession("[PROJECT]", "[SESSION]");
// Make the request
contextsClient.DeleteAllContexts(parent);
DeleteAllContexts(string, CallSettings)
Deletes all active contexts in the specified session.
Declaration
public virtual void DeleteAllContexts(string parent, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
string | parent | Required. The name of the session to delete all contexts from. Format:
|
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Sample code
// Create client
ContextsClient contextsClient = ContextsClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/agent/sessions/[SESSION]";
// Make the request
contextsClient.DeleteAllContexts(parent);
DeleteAllContextsAsync(DeleteAllContextsRequest, CallSettings)
Deletes all active contexts in the specified session.
Declaration
public virtual Task DeleteAllContextsAsync(DeleteAllContextsRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
DeleteAllContextsRequest | request | The request object containing all of the parameters for the API call. |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Task | A Task containing the RPC response. |
Sample code
// Create client
ContextsClient contextsClient = await ContextsClient.CreateAsync();
// Initialize request argument(s)
DeleteAllContextsRequest request = new DeleteAllContextsRequest
{
ParentAsSessionName = SessionName.FromProjectSession("[PROJECT]", "[SESSION]"),
};
// Make the request
await contextsClient.DeleteAllContextsAsync(request);
DeleteAllContextsAsync(DeleteAllContextsRequest, CancellationToken)
Deletes all active contexts in the specified session.
Declaration
public virtual Task DeleteAllContextsAsync(DeleteAllContextsRequest request, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
DeleteAllContextsRequest | request | The request object containing all of the parameters for the API call. |
CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
Type | Description |
---|---|
Task | A Task containing the RPC response. |
Sample code
// Create client
ContextsClient contextsClient = await ContextsClient.CreateAsync();
// Initialize request argument(s)
DeleteAllContextsRequest request = new DeleteAllContextsRequest
{
ParentAsSessionName = SessionName.FromProjectSession("[PROJECT]", "[SESSION]"),
};
// Make the request
await contextsClient.DeleteAllContextsAsync(request);
DeleteAllContextsAsync(SessionName, CallSettings)
Deletes all active contexts in the specified session.
Declaration
public virtual Task DeleteAllContextsAsync(SessionName parent, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
SessionName | parent | Required. The name of the session to delete all contexts from. Format:
|
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Task | A Task containing the RPC response. |
Sample code
// Create client
ContextsClient contextsClient = await ContextsClient.CreateAsync();
// Initialize request argument(s)
SessionName parent = SessionName.FromProjectSession("[PROJECT]", "[SESSION]");
// Make the request
await contextsClient.DeleteAllContextsAsync(parent);
DeleteAllContextsAsync(SessionName, CancellationToken)
Deletes all active contexts in the specified session.
Declaration
public virtual Task DeleteAllContextsAsync(SessionName parent, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
SessionName | parent | Required. The name of the session to delete all contexts from. Format:
|
CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
Type | Description |
---|---|
Task | A Task containing the RPC response. |
Sample code
// Create client
ContextsClient contextsClient = await ContextsClient.CreateAsync();
// Initialize request argument(s)
SessionName parent = SessionName.FromProjectSession("[PROJECT]", "[SESSION]");
// Make the request
await contextsClient.DeleteAllContextsAsync(parent);
DeleteAllContextsAsync(string, CallSettings)
Deletes all active contexts in the specified session.
Declaration
public virtual Task DeleteAllContextsAsync(string parent, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
string | parent | Required. The name of the session to delete all contexts from. Format:
|
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Task | A Task containing the RPC response. |
Sample code
// Create client
ContextsClient contextsClient = await ContextsClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/agent/sessions/[SESSION]";
// Make the request
await contextsClient.DeleteAllContextsAsync(parent);
DeleteAllContextsAsync(string, CancellationToken)
Deletes all active contexts in the specified session.
Declaration
public virtual Task DeleteAllContextsAsync(string parent, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
string | parent | Required. The name of the session to delete all contexts from. Format:
|
CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
Type | Description |
---|---|
Task | A Task containing the RPC response. |
Sample code
// Create client
ContextsClient contextsClient = await ContextsClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/agent/sessions/[SESSION]";
// Make the request
await contextsClient.DeleteAllContextsAsync(parent);
DeleteContext(ContextName, CallSettings)
Deletes the specified context.
Declaration
public virtual void DeleteContext(ContextName name, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
ContextName | name | Required. The name of the context to delete. Format:
|
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Sample code
// Create client
ContextsClient contextsClient = ContextsClient.Create();
// Initialize request argument(s)
ContextName name = ContextName.FromProjectSessionContext("[PROJECT]", "[SESSION]", "[CONTEXT]");
// Make the request
contextsClient.DeleteContext(name);
DeleteContext(DeleteContextRequest, CallSettings)
Deletes the specified context.
Declaration
public virtual void DeleteContext(DeleteContextRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
DeleteContextRequest | request | The request object containing all of the parameters for the API call. |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Sample code
// Create client
ContextsClient contextsClient = ContextsClient.Create();
// Initialize request argument(s)
DeleteContextRequest request = new DeleteContextRequest
{
ContextName = ContextName.FromProjectSessionContext("[PROJECT]", "[SESSION]", "[CONTEXT]"),
};
// Make the request
contextsClient.DeleteContext(request);
DeleteContext(string, CallSettings)
Deletes the specified context.
Declaration
public virtual void DeleteContext(string name, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
string | name | Required. The name of the context to delete. Format:
|
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Sample code
// Create client
ContextsClient contextsClient = ContextsClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/agent/sessions/[SESSION]/contexts/[CONTEXT]";
// Make the request
contextsClient.DeleteContext(name);
DeleteContextAsync(ContextName, CallSettings)
Deletes the specified context.
Declaration
public virtual Task DeleteContextAsync(ContextName name, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
ContextName | name | Required. The name of the context to delete. Format:
|
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Task | A Task containing the RPC response. |
Sample code
// Create client
ContextsClient contextsClient = await ContextsClient.CreateAsync();
// Initialize request argument(s)
ContextName name = ContextName.FromProjectSessionContext("[PROJECT]", "[SESSION]", "[CONTEXT]");
// Make the request
await contextsClient.DeleteContextAsync(name);
DeleteContextAsync(ContextName, CancellationToken)
Deletes the specified context.
Declaration
public virtual Task DeleteContextAsync(ContextName name, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
ContextName | name | Required. The name of the context to delete. Format:
|
CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
Type | Description |
---|---|
Task | A Task containing the RPC response. |
Sample code
// Create client
ContextsClient contextsClient = await ContextsClient.CreateAsync();
// Initialize request argument(s)
ContextName name = ContextName.FromProjectSessionContext("[PROJECT]", "[SESSION]", "[CONTEXT]");
// Make the request
await contextsClient.DeleteContextAsync(name);
DeleteContextAsync(DeleteContextRequest, CallSettings)
Deletes the specified context.
Declaration
public virtual Task DeleteContextAsync(DeleteContextRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
DeleteContextRequest | request | The request object containing all of the parameters for the API call. |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Task | A Task containing the RPC response. |
Sample code
// Create client
ContextsClient contextsClient = await ContextsClient.CreateAsync();
// Initialize request argument(s)
DeleteContextRequest request = new DeleteContextRequest
{
ContextName = ContextName.FromProjectSessionContext("[PROJECT]", "[SESSION]", "[CONTEXT]"),
};
// Make the request
await contextsClient.DeleteContextAsync(request);
DeleteContextAsync(DeleteContextRequest, CancellationToken)
Deletes the specified context.
Declaration
public virtual Task DeleteContextAsync(DeleteContextRequest request, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
DeleteContextRequest | request | The request object containing all of the parameters for the API call. |
CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
Type | Description |
---|---|
Task | A Task containing the RPC response. |
Sample code
// Create client
ContextsClient contextsClient = await ContextsClient.CreateAsync();
// Initialize request argument(s)
DeleteContextRequest request = new DeleteContextRequest
{
ContextName = ContextName.FromProjectSessionContext("[PROJECT]", "[SESSION]", "[CONTEXT]"),
};
// Make the request
await contextsClient.DeleteContextAsync(request);
DeleteContextAsync(string, CallSettings)
Deletes the specified context.
Declaration
public virtual Task DeleteContextAsync(string name, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
string | name | Required. The name of the context to delete. Format:
|
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Task | A Task containing the RPC response. |
Sample code
// Create client
ContextsClient contextsClient = await ContextsClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/agent/sessions/[SESSION]/contexts/[CONTEXT]";
// Make the request
await contextsClient.DeleteContextAsync(name);
DeleteContextAsync(string, CancellationToken)
Deletes the specified context.
Declaration
public virtual Task DeleteContextAsync(string name, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
string | name | Required. The name of the context to delete. Format:
|
CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
Type | Description |
---|---|
Task | A Task containing the RPC response. |
Sample code
// Create client
ContextsClient contextsClient = await ContextsClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/agent/sessions/[SESSION]/contexts/[CONTEXT]";
// Make the request
await contextsClient.DeleteContextAsync(name);
GetContext(ContextName, CallSettings)
Retrieves the specified context.
Declaration
public virtual Context GetContext(ContextName name, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
ContextName | name | Required. The name of the context. Format:
|
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Context | The RPC response. |
Sample code
// Create client
ContextsClient contextsClient = ContextsClient.Create();
// Initialize request argument(s)
ContextName name = ContextName.FromProjectSessionContext("[PROJECT]", "[SESSION]", "[CONTEXT]");
// Make the request
Context response = contextsClient.GetContext(name);
GetContext(GetContextRequest, CallSettings)
Retrieves the specified context.
Declaration
public virtual Context GetContext(GetContextRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
GetContextRequest | request | The request object containing all of the parameters for the API call. |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Context | The RPC response. |
Sample code
// Create client
ContextsClient contextsClient = ContextsClient.Create();
// Initialize request argument(s)
GetContextRequest request = new GetContextRequest
{
ContextName = ContextName.FromProjectSessionContext("[PROJECT]", "[SESSION]", "[CONTEXT]"),
};
// Make the request
Context response = contextsClient.GetContext(request);
GetContext(string, CallSettings)
Retrieves the specified context.
Declaration
public virtual Context GetContext(string name, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
string | name | Required. The name of the context. Format:
|
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Context | The RPC response. |
Sample code
// Create client
ContextsClient contextsClient = ContextsClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/agent/sessions/[SESSION]/contexts/[CONTEXT]";
// Make the request
Context response = contextsClient.GetContext(name);
GetContextAsync(ContextName, CallSettings)
Retrieves the specified context.
Declaration
public virtual Task<Context> GetContextAsync(ContextName name, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
ContextName | name | Required. The name of the context. Format:
|
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Task<Context> | A Task containing the RPC response. |
Sample code
// Create client
ContextsClient contextsClient = await ContextsClient.CreateAsync();
// Initialize request argument(s)
ContextName name = ContextName.FromProjectSessionContext("[PROJECT]", "[SESSION]", "[CONTEXT]");
// Make the request
Context response = await contextsClient.GetContextAsync(name);
GetContextAsync(ContextName, CancellationToken)
Retrieves the specified context.
Declaration
public virtual Task<Context> GetContextAsync(ContextName name, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
ContextName | name | Required. The name of the context. Format:
|
CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
Type | Description |
---|---|
Task<Context> | A Task containing the RPC response. |
Sample code
// Create client
ContextsClient contextsClient = await ContextsClient.CreateAsync();
// Initialize request argument(s)
ContextName name = ContextName.FromProjectSessionContext("[PROJECT]", "[SESSION]", "[CONTEXT]");
// Make the request
Context response = await contextsClient.GetContextAsync(name);
GetContextAsync(GetContextRequest, CallSettings)
Retrieves the specified context.
Declaration
public virtual Task<Context> GetContextAsync(GetContextRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
GetContextRequest | request | The request object containing all of the parameters for the API call. |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Task<Context> | A Task containing the RPC response. |
Sample code
// Create client
ContextsClient contextsClient = await ContextsClient.CreateAsync();
// Initialize request argument(s)
GetContextRequest request = new GetContextRequest
{
ContextName = ContextName.FromProjectSessionContext("[PROJECT]", "[SESSION]", "[CONTEXT]"),
};
// Make the request
Context response = await contextsClient.GetContextAsync(request);
GetContextAsync(GetContextRequest, CancellationToken)
Retrieves the specified context.
Declaration
public virtual Task<Context> GetContextAsync(GetContextRequest request, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
GetContextRequest | request | The request object containing all of the parameters for the API call. |
CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
Type | Description |
---|---|
Task<Context> | A Task containing the RPC response. |
Sample code
// Create client
ContextsClient contextsClient = await ContextsClient.CreateAsync();
// Initialize request argument(s)
GetContextRequest request = new GetContextRequest
{
ContextName = ContextName.FromProjectSessionContext("[PROJECT]", "[SESSION]", "[CONTEXT]"),
};
// Make the request
Context response = await contextsClient.GetContextAsync(request);
GetContextAsync(string, CallSettings)
Retrieves the specified context.
Declaration
public virtual Task<Context> GetContextAsync(string name, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
string | name | Required. The name of the context. Format:
|
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Task<Context> | A Task containing the RPC response. |
Sample code
// Create client
ContextsClient contextsClient = await ContextsClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/agent/sessions/[SESSION]/contexts/[CONTEXT]";
// Make the request
Context response = await contextsClient.GetContextAsync(name);
GetContextAsync(string, CancellationToken)
Retrieves the specified context.
Declaration
public virtual Task<Context> GetContextAsync(string name, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
string | name | Required. The name of the context. Format:
|
CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
Type | Description |
---|---|
Task<Context> | A Task containing the RPC response. |
Sample code
// Create client
ContextsClient contextsClient = await ContextsClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/agent/sessions/[SESSION]/contexts/[CONTEXT]";
// Make the request
Context response = await contextsClient.GetContextAsync(name);
ListContexts(ListContextsRequest, CallSettings)
Returns the list of all contexts in the specified session.
Declaration
public virtual PagedEnumerable<ListContextsResponse, Context> ListContexts(ListContextsRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
ListContextsRequest | request | The request object containing all of the parameters for the API call. |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
PagedEnumerable<ListContextsResponse, Context> | A pageable sequence of Context resources. |
Sample code
// Create client
ContextsClient contextsClient = ContextsClient.Create();
// Initialize request argument(s)
ListContextsRequest request = new ListContextsRequest
{
ParentAsSessionName = SessionName.FromProjectSession("[PROJECT]", "[SESSION]"),
};
// Make the request
PagedEnumerable<ListContextsResponse, Context> response = contextsClient.ListContexts(request);
// Iterate over all response items, lazily performing RPCs as required
foreach (Context 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 (ListContextsResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Context 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<Context> 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 (Context 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;
ListContexts(SessionName, string, int?, CallSettings)
Returns the list of all contexts in the specified session.
Declaration
public virtual PagedEnumerable<ListContextsResponse, Context> ListContexts(SessionName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
SessionName | parent | Required. The session to list all contexts from.
Format: |
string | pageToken | The token returned from the previous request. A value of |
int? | pageSize | The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
PagedEnumerable<ListContextsResponse, Context> | A pageable sequence of Context resources. |
Sample code
// Create client
ContextsClient contextsClient = ContextsClient.Create();
// Initialize request argument(s)
SessionName parent = SessionName.FromProjectSession("[PROJECT]", "[SESSION]");
// Make the request
PagedEnumerable<ListContextsResponse, Context> response = contextsClient.ListContexts(parent);
// Iterate over all response items, lazily performing RPCs as required
foreach (Context 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 (ListContextsResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Context 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<Context> 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 (Context 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;
ListContexts(string, string, int?, CallSettings)
Returns the list of all contexts in the specified session.
Declaration
public virtual PagedEnumerable<ListContextsResponse, Context> ListContexts(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
string | parent | Required. The session to list all contexts from.
Format: |
string | pageToken | The token returned from the previous request. A value of |
int? | pageSize | The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
PagedEnumerable<ListContextsResponse, Context> | A pageable sequence of Context resources. |
Sample code
// Create client
ContextsClient contextsClient = ContextsClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/agent/sessions/[SESSION]";
// Make the request
PagedEnumerable<ListContextsResponse, Context> response = contextsClient.ListContexts(parent);
// Iterate over all response items, lazily performing RPCs as required
foreach (Context 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 (ListContextsResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Context 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<Context> 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 (Context 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;
ListContextsAsync(ListContextsRequest, CallSettings)
Returns the list of all contexts in the specified session.
Declaration
public virtual PagedAsyncEnumerable<ListContextsResponse, Context> ListContextsAsync(ListContextsRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
ListContextsRequest | request | The request object containing all of the parameters for the API call. |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
PagedAsyncEnumerable<ListContextsResponse, Context> | A pageable asynchronous sequence of Context resources. |
Sample code
// Create client
ContextsClient contextsClient = await ContextsClient.CreateAsync();
// Initialize request argument(s)
ListContextsRequest request = new ListContextsRequest
{
ParentAsSessionName = SessionName.FromProjectSession("[PROJECT]", "[SESSION]"),
};
// Make the request
PagedAsyncEnumerable<ListContextsResponse, Context> response = contextsClient.ListContextsAsync(request);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Context 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((ListContextsResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Context 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<Context> 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 (Context 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;
ListContextsAsync(SessionName, string, int?, CallSettings)
Returns the list of all contexts in the specified session.
Declaration
public virtual PagedAsyncEnumerable<ListContextsResponse, Context> ListContextsAsync(SessionName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
SessionName | parent | Required. The session to list all contexts from.
Format: |
string | pageToken | The token returned from the previous request. A value of |
int? | pageSize | The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
PagedAsyncEnumerable<ListContextsResponse, Context> | A pageable asynchronous sequence of Context resources. |
Sample code
// Create client
ContextsClient contextsClient = await ContextsClient.CreateAsync();
// Initialize request argument(s)
SessionName parent = SessionName.FromProjectSession("[PROJECT]", "[SESSION]");
// Make the request
PagedAsyncEnumerable<ListContextsResponse, Context> response = contextsClient.ListContextsAsync(parent);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Context 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((ListContextsResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Context 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<Context> 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 (Context 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;
ListContextsAsync(string, string, int?, CallSettings)
Returns the list of all contexts in the specified session.
Declaration
public virtual PagedAsyncEnumerable<ListContextsResponse, Context> ListContextsAsync(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
string | parent | Required. The session to list all contexts from.
Format: |
string | pageToken | The token returned from the previous request. A value of |
int? | pageSize | The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
PagedAsyncEnumerable<ListContextsResponse, Context> | A pageable asynchronous sequence of Context resources. |
Sample code
// Create client
ContextsClient contextsClient = await ContextsClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/agent/sessions/[SESSION]";
// Make the request
PagedAsyncEnumerable<ListContextsResponse, Context> response = contextsClient.ListContextsAsync(parent);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Context 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((ListContextsResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Context 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<Context> 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 (Context item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
ShutdownDefaultChannelsAsync()
Shuts down any channels automatically created by Create() and CreateAsync(CancellationToken). Channels which weren't automatically created are not affected.
Declaration
public static Task ShutdownDefaultChannelsAsync()
Returns
Type | Description |
---|---|
Task | A task representing the asynchronous shutdown operation. |
Remarks
After calling this method, further calls to Create() and CreateAsync(CancellationToken) will create new channels, which could in turn be shut down by another call to this method.
UpdateContext(Context, FieldMask, CallSettings)
Updates the specified context.
Declaration
public virtual Context UpdateContext(Context context, FieldMask updateMask, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
Context | context | Required. The context to update. |
FieldMask | updateMask | Optional. The mask to control which fields get updated. |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Context | The RPC response. |
Sample code
// Create client
ContextsClient contextsClient = ContextsClient.Create();
// Initialize request argument(s)
Context context = new Context();
FieldMask updateMask = new FieldMask();
// Make the request
Context response = contextsClient.UpdateContext(context, updateMask);
UpdateContext(UpdateContextRequest, CallSettings)
Updates the specified context.
Declaration
public virtual Context UpdateContext(UpdateContextRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
UpdateContextRequest | request | The request object containing all of the parameters for the API call. |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Context | The RPC response. |
Sample code
// Create client
ContextsClient contextsClient = ContextsClient.Create();
// Initialize request argument(s)
UpdateContextRequest request = new UpdateContextRequest
{
Context = new Context(),
UpdateMask = new FieldMask(),
};
// Make the request
Context response = contextsClient.UpdateContext(request);
UpdateContextAsync(Context, FieldMask, CallSettings)
Updates the specified context.
Declaration
public virtual Task<Context> UpdateContextAsync(Context context, FieldMask updateMask, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
Context | context | Required. The context to update. |
FieldMask | updateMask | Optional. The mask to control which fields get updated. |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Task<Context> | A Task containing the RPC response. |
Sample code
// Create client
ContextsClient contextsClient = await ContextsClient.CreateAsync();
// Initialize request argument(s)
Context context = new Context();
FieldMask updateMask = new FieldMask();
// Make the request
Context response = await contextsClient.UpdateContextAsync(context, updateMask);
UpdateContextAsync(Context, FieldMask, CancellationToken)
Updates the specified context.
Declaration
public virtual Task<Context> UpdateContextAsync(Context context, FieldMask updateMask, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
Context | context | Required. The context to update. |
FieldMask | updateMask | Optional. The mask to control which fields get updated. |
CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
Type | Description |
---|---|
Task<Context> | A Task containing the RPC response. |
Sample code
// Create client
ContextsClient contextsClient = await ContextsClient.CreateAsync();
// Initialize request argument(s)
Context context = new Context();
FieldMask updateMask = new FieldMask();
// Make the request
Context response = await contextsClient.UpdateContextAsync(context, updateMask);
UpdateContextAsync(UpdateContextRequest, CallSettings)
Updates the specified context.
Declaration
public virtual Task<Context> UpdateContextAsync(UpdateContextRequest request, CallSettings callSettings = null)
Parameters
Type | Name | Description |
---|---|---|
UpdateContextRequest | request | The request object containing all of the parameters for the API call. |
CallSettings | callSettings | If not null, applies overrides to this RPC call. |
Returns
Type | Description |
---|---|
Task<Context> | A Task containing the RPC response. |
Sample code
// Create client
ContextsClient contextsClient = await ContextsClient.CreateAsync();
// Initialize request argument(s)
UpdateContextRequest request = new UpdateContextRequest
{
Context = new Context(),
UpdateMask = new FieldMask(),
};
// Make the request
Context response = await contextsClient.UpdateContextAsync(request);
UpdateContextAsync(UpdateContextRequest, CancellationToken)
Updates the specified context.
Declaration
public virtual Task<Context> UpdateContextAsync(UpdateContextRequest request, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
UpdateContextRequest | request | The request object containing all of the parameters for the API call. |
CancellationToken | cancellationToken | A CancellationToken to use for this RPC. |
Returns
Type | Description |
---|---|
Task<Context> | A Task containing the RPC response. |
Sample code
// Create client
ContextsClient contextsClient = await ContextsClient.CreateAsync();
// Initialize request argument(s)
UpdateContextRequest request = new UpdateContextRequest
{
Context = new Context(),
UpdateMask = new FieldMask(),
};
// Make the request
Context response = await contextsClient.UpdateContextAsync(request);